1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-27 03:57:21 +00:00

CodeMirror updates

This commit is contained in:
Jeremy Ruston 2013-05-15 17:32:28 +01:00
parent 8564602256
commit eebf3dae95
2 changed files with 22 additions and 5 deletions

View File

@ -83,15 +83,19 @@ CodeMirrorEditor.prototype.render = function() {
this.editWidget.attributes = {
"class": "tw-edit-CodeMirrorEditor"
};
this.editWidget.children = this.editWidget.renderer.renderTree.createRenderers(this.editWidget.renderer.renderContext,[node]);
this.editWidget.children = this.editWidget.renderer.renderTree.createRenderers(this.editWidget.renderer,[node]);
};
CodeMirrorEditor.prototype.postRenderInDom = function() {
if(this.type === "textarea") {
CodeMirror.fromTextArea(this.editWidget.children[0].domNode,{
lineWrapping: true,
lineNumbers: true
});
var self = this;
// HACK: We use the timeout because postRenderInDom is called before the dom nodes have been added to the document
window.setTimeout(function() {
self.codemirrorInstance = CodeMirror.fromTextArea(self.editWidget.children[0].domNode,{
lineWrapping: true,
lineNumbers: true
});
},1);
}
};

View File

@ -0,0 +1,13 @@
title: $:/plugins/tiddlywiki/codemirror/styles
tags: [[$:/tags/stylesheet]]
/* Make the editor resize to fit its content */
.CodeMirror {
height: auto;
}
.CodeMirror-scroll {
overflow-x: auto;
overflow-y: hidden;
}