1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-06-24 22:33:16 +00:00

CodeMirror plugin now refreshes the tiddler type

This commit is contained in:
Andreas Hahn 2015-05-28 14:24:04 +02:00
parent fdbde1b389
commit d8366cc45f

View File

@ -173,18 +173,20 @@ EditCodeMirrorWidget.prototype.refresh = function(changedTiddlers) {
this.refreshSelf(); this.refreshSelf();
return true; return true;
} else if(changedTiddlers[this.editTitle]) { } else if(changedTiddlers[this.editTitle]) {
this.updateEditor(this.getEditInfo().value); var editInfo = this.getEditInfo();
this.updateEditor(editInfo.value, editInfo.type);
return true; return true;
} }
return false; return false;
}; };
/* /*
Update the editor with new text. This method is separate from updateEditorDomNode() Update the editor with new text and type. This method is separate from updateEditorDomNode()
so that subclasses can override updateEditor() and still use updateEditorDomNode() so that subclasses can override updateEditor() and still use updateEditorDomNode()
*/ */
EditCodeMirrorWidget.prototype.updateEditor = function(text) { EditCodeMirrorWidget.prototype.updateEditor = function(text, type) {
this.updateEditorDomNode(text); this.updateEditorDomNode(text);
this.codeMirrorInstance.setOption("mode", type);
}; };
/* /*