mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-01-31 06:39:11 +00:00
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
This commit is contained in:
parent
f23d8ee741
commit
8b31368b24
@ -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('<style type="text/css">.CodeMirror {height:auto;}');
|
||||
} else {
|
||||
$("head").append('<style type="text/css">.CodeMirror {height:' + cm_attr.height + 'px;}');
|
||||
}
|
||||
}
|
||||
|
||||
// get the type from hidden filename extension, load the type-file.js, theme.css and call cm_wait
|
||||
var ltype;
|
||||
|
Loading…
Reference in New Issue
Block a user