Skip to content

Commit 66c19f6

Browse files
committed
Fix: code is fixed unintentionally in single pane mode
1 parent f87bb68 commit 66c19f6

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/code-editor.vue

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ export default {
186186
if (editor != null && editor.getModifiedEditor != null) {
187187
return editor.getModifiedEditor()
188188
}
189-
return editor
189+
return null
190190
},
191191
},
192192
@@ -241,16 +241,17 @@ export default {
241241
},
242242
243243
createEditor() {
244-
const editor = monaco.editor.create(
245-
this.$el,
246-
Object.assign({ value: this.code, language: "html" }, EDITOR_OPTS)
247-
)
244+
const editor = monaco.editor.create(this.$el, EDITOR_OPTS)
245+
const model = monaco.editor.createModel(this.code, "html")
248246
249247
// Set change event.
250-
editor.getModel().onDidChangeContent(() => {
248+
model.onDidChangeContent(() => {
251249
this.invalidate()
252250
})
253251
252+
// Set model.
253+
editor.setModel(model)
254+
254255
// Set markers.
255256
updateMarkers(editor, this.messages)
256257

0 commit comments

Comments
 (0)