2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 06:39:11 +00:00

console.js: fix multiline FHEM-Log (Forum #122316)

git-svn-id: https://svn.fhem.de/fhem/trunk@24820 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2021-08-02 13:04:04 +00:00
parent ae01388c1b
commit d0cfb6c3be

View File

@ -67,10 +67,13 @@ consUpdate(evt)
// Extract the FHEM-Log, to avoid escaping its formatting (Forum #104842)
var logContent = "";
var rTab = {'<':'&lt;', '>':'&gt;',' ':'&nbsp;'};
new_content = new_content.replace(/(<div class='fhemlog'>)(.*?)(<\/div>)/g,
var rTab = {'<':'&lt;', '>':'&gt;',' ':'&nbsp;', '\n':'<br>' };
new_content = new_content.replace(
/(<div class='fhemlog'>)([\s\S]*?)(<\/div>)/gm,
function(all, div1, msg, div2) {
logContent += div1+msg.replace(/[<> ]/g, function(a){return rTab[a]})+div2;
logContent += div1+
msg.replace(/[<> \n]/g, function(a){return rTab[a]})+
div2;
return "";
});