1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2025-06-05 16:14:07 +00:00

Pass content-type to codemirror mode option for syntax highlight

Fixes #605
This commit is contained in:
Jermolene 2014-05-07 14:09:46 +01:00
parent 711b76307c
commit 8b20143b1b

View File

@ -58,7 +58,12 @@ EditTextWidget.prototype.postRender = function() {
cm, config, cv, cm_opts = { cm, config, cv, cm_opts = {
lineWrapping: true, lineWrapping: true,
lineNumbers: true lineNumbers: true
}; },
tid = $tw.wiki.getTiddler(this.editTitle);
if(tid && tid.fields.type) {
cm_opts.mode = tid.fields.type
};
if($tw.browser && window.CodeMirror && this.editTag === "textarea") { if($tw.browser && window.CodeMirror && this.editTag === "textarea") {
if(EditTextWidget.configuration) { if(EditTextWidget.configuration) {
for (cv in EditTextWidget.configuration) { cm_opts[cv] = EditTextWidget.configuration[cv]; } for (cv in EditTextWidget.configuration) { cm_opts[cv] = EditTextWidget.configuration[cv]; }