From 5dafeb91393cf5c9fb55b8b2bb1b76b748a97d9d Mon Sep 17 00:00:00 2001 From: rapster Date: Tue, 19 Apr 2016 14:02:21 +0000 Subject: [PATCH] www/codemirror/fhem_codemirror.js: New codemirrorParam 'height' for auto or custom height of editor window in DEF an Attr git-svn-id: https://svn.fhem.de/fhem/trunk@11286 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/www/codemirror/fhem_codemirror.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/fhem/www/codemirror/fhem_codemirror.js b/fhem/www/codemirror/fhem_codemirror.js index d9e5816c0..04e9ef0da 100644 --- a/fhem/www/codemirror/fhem_codemirror.js +++ b/fhem/www/codemirror/fhem_codemirror.js @@ -17,6 +17,7 @@ var cm_attr = { autofocus: true, lineNumbers: true, smartIndent: false, + height: false, extraKeys: { 'Tab': function(cm) { if (cm.somethingSelected()) { @@ -65,6 +66,7 @@ function AddCodeMirror(e, cb) { loadLink("codemirror/codemirror.css"); loadScript("codemirror/codemirror.js", function(){cm_loaded++;} ); + // load additional addons if (cm_attr.autoCloseBrackets) { cm_active++; loadScript("codemirror/closebrackets.js", function(){cm_loaded++;} ); } @@ -94,6 +96,16 @@ function AddCodeMirror(e, cb) { cm_active++; loadScript("codemirror/autorefresh.js", function(){cm_loaded++;} ); } + // editor user preferences + if (cm_attr.height) { + if(cm_attr.height == true) + cm_attr.height = "auto"; + if(isNaN(cm_attr.height)) { + $("head").append('