egoist / vue-monaco

MonacoEditor component for Vue.js
MIT License
690 stars 127 forks source link

can't access to editor instance #189

Open inghvar opened 3 years ago

inghvar commented 3 years ago
      <MonacoEditor
        class="editor"
        ref="editor"
        v-model="code"
        theme="gCodeFirst"
        language="GCodeLanguage"
        @editorWillMount="editorDidMount"
        :options="options"
      >
      </MonacoEditor>
    editorDidMount (editor) {
      // Register a new language
      editor.languages.register({ id: 'GCodeLanguage' })
      var e = this.$refs.editor.getEditor()
      console.log(e)
      ...............................................
     ...............................................

in the console I get undefined this.$refs.editor ==> also does not give access to the instance I need to use functions like getPosition(), setPosition() but i can't access the editor instance, only to the model

barrybb commented 2 years ago

I experienced the same issue too, but was able to solve it like this....

this.$refs.editor[0].getEditor()