mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-04-21 01:46:08 +00:00
fhemweb.js: fix RawDef/Probably assoc. with & codeMirror (Forum #81595)
git-svn-id: https://svn.fhem.de/fhem/trunk@15701 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
60601c3235
commit
9cdc24caa8
@ -235,6 +235,8 @@ FW_Define($$)
|
|||||||
return "Usage: define <name> FHEMWEB [IPV6:]<tcp-portnr> [global]"
|
return "Usage: define <name> FHEMWEB [IPV6:]<tcp-portnr> [global]"
|
||||||
if($port !~ m/^(IPV6:)?\d+$/ || ($global && $global ne "global"));
|
if($port !~ m/^(IPV6:)?\d+$/ || ($global && $global ne "global"));
|
||||||
|
|
||||||
|
FW_Undef($hash) if($hash->{OLDDEF}); # modify
|
||||||
|
|
||||||
foreach my $pe ("fhemSVG", "openautomation", "default") {
|
foreach my $pe ("fhemSVG", "openautomation", "default") {
|
||||||
FW_readIcons($pe);
|
FW_readIcons($pe);
|
||||||
}
|
}
|
||||||
|
@ -720,15 +720,18 @@ FW_rawDef()
|
|||||||
var textAreaStyle = typeof AddCodeMirror == 'function'?'opacity:0':'';
|
var textAreaStyle = typeof AddCodeMirror == 'function'?'opacity:0':'';
|
||||||
|
|
||||||
$("#content").append('<div id="rawDef">'+
|
$("#content").append('<div id="rawDef">'+
|
||||||
'<textarea id="td_rawDef" rows="25" cols="60" style="width:99%; '+textAreaStyle+'"/>'+
|
'<textarea id="td_rawDef" rows="25" cols="60" style="width:99%; '+
|
||||||
|
textAreaStyle+'"/>'+
|
||||||
'<button>Execute commands</button>'+
|
'<button>Execute commands</button>'+
|
||||||
' Dump "Probably associated with" too <input type="checkbox">'+
|
' Dump "Probably associated with" too <input type="checkbox">'+
|
||||||
'<br><br></div>');
|
'<br><br></div>');
|
||||||
|
|
||||||
|
var cmVar;
|
||||||
|
|
||||||
function
|
function
|
||||||
fillData(opt)
|
fillData(opt)
|
||||||
{
|
{
|
||||||
var s = $('#rawDef textarea');
|
var s = $('#rawDef textarea');
|
||||||
|
|
||||||
FW_cmd(FW_root+"?cmd=list "+opt+" "+dev+"&XHR=1", function(data) {
|
FW_cmd(FW_root+"?cmd=list "+opt+" "+dev+"&XHR=1", function(data) {
|
||||||
var re = new RegExp("^define", "gm");
|
var re = new RegExp("^define", "gm");
|
||||||
@ -749,12 +752,15 @@ FW_rawDef()
|
|||||||
|
|
||||||
s.bind('input propertychange', propertychange);
|
s.bind('input propertychange', propertychange);
|
||||||
|
|
||||||
if( typeof AddCodeMirror == 'function') {
|
if(cmVar) {
|
||||||
$('#rawDef textarea + .CodeMirror').remove();
|
cmVar.setValue(data);
|
||||||
|
|
||||||
|
} else if(typeof AddCodeMirror == 'function') {
|
||||||
AddCodeMirror(s, function(cm) {
|
AddCodeMirror(s, function(cm) {
|
||||||
|
cmVar = cm;
|
||||||
cm.on("change", function() {
|
cm.on("change", function() {
|
||||||
s.val(cm.getValue());
|
s.val(cm.getValue());
|
||||||
propertychange();
|
propertychange();
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user