Skip to content

Commit

Permalink
fix: get editor instance
Browse files Browse the repository at this point in the history
  • Loading branch information
sxzz committed Jan 30, 2024
1 parent 6da1dec commit f7be112
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions components/CodeEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,9 @@ const options = computed<monaco.editor.IStandaloneEditorConstructionOptions>(
},
)
onMounted(() => {
const editor = toRaw(
container.value!.$editor as monaco.editor.IStandaloneCodeEditor,
)
watchEffect(() => {
const editor = toRaw(container.value?.$editor)
if (!editor) return
editor.onDidChangeCursorPosition((e) => {
editorCursor.value = editor.getModel()!.getOffsetAt(e.position)
})
Expand Down

0 comments on commit f7be112

Please sign in to comment.