From d8366cc45f25d16c9085e05ee18965e626e218ff Mon Sep 17 00:00:00 2001 From: Andreas Hahn Date: Thu, 28 May 2015 14:24:04 +0200 Subject: [PATCH] CodeMirror plugin now refreshes the tiddler type --- plugins/tiddlywiki/codemirror/edit-codemirror.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/plugins/tiddlywiki/codemirror/edit-codemirror.js b/plugins/tiddlywiki/codemirror/edit-codemirror.js index 3a8d16b4b..6417da89a 100644 --- a/plugins/tiddlywiki/codemirror/edit-codemirror.js +++ b/plugins/tiddlywiki/codemirror/edit-codemirror.js @@ -173,18 +173,20 @@ EditCodeMirrorWidget.prototype.refresh = function(changedTiddlers) { this.refreshSelf(); return true; } else if(changedTiddlers[this.editTitle]) { - this.updateEditor(this.getEditInfo().value); + var editInfo = this.getEditInfo(); + this.updateEditor(editInfo.value, editInfo.type); return true; } 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() */ -EditCodeMirrorWidget.prototype.updateEditor = function(text) { +EditCodeMirrorWidget.prototype.updateEditor = function(text, type) { this.updateEditorDomNode(text); + this.codeMirrorInstance.setOption("mode", type); }; /*