Get CodeMirror instance

后端 未结 6 795
礼貌的吻别
礼貌的吻别 2020-12-23 17:14

I want to get an instance of CodeMirror (it is binded to a textarea \'#code\'). From an onclick-event I want to add a value to the current value of the CodeMirror instance.

6条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-23 17:38

    You can simply drop the var: instead of having

    var editor = CodeMirror.fromTextArea...
    

    Just have

    editor = CodeMirror.fromTextArea...
    

    Then editor is directly available to use in other functions

提交回复
热议问题