javascript - Creating CodeMirror dynamically - rendering issues -
i started develop class manipulates on codemirror - dynamically links necessary libraries, provides comunication server , on. because of hold in variables, , upon initialisation, codemirror appended dom node not within document tree. that:
var holder = document.createelement("div"); var textarea = document.createelement("textarea"); holder.appendchild(textarea); this.editor = codemirror.fromtextarea(textarea, {/*options*/});
then append div myself when .show()
method called upon class:
this.show(node) { if(this.editor!=null) { node.parentnode.replacechild(holder,node); } }
the editor ok since click , seek draw, or after resize window. before, see blank area disabled scroll bar. believe because of way initialise whole codemirror. should create work, if want maintain class structure? link live code (not ie).
a more direct way phone call .refresh()
on codemirror instance after showing it. see http://codemirror.net/doc/manual.html#refresh
javascript codemirror
No comments:
Post a Comment