diff --git a/WebContent/WEB-INF/jsp/dataPointEdit.jsp b/WebContent/WEB-INF/jsp/dataPointEdit.jsp index 1ffb2da1b7..8de649b777 100644 --- a/WebContent/WEB-INF/jsp/dataPointEdit.jsp +++ b/WebContent/WEB-INF/jsp/dataPointEdit.jsp @@ -396,13 +396,9 @@ } } // const - var pathArray = location.href.split( '/' ); - var protocol = pathArray[0]; - var host = pathArray[2]; - var appScada = pathArray[3]; var myLocation; if (!myLocation) { - myLocation = protocol + "//" + host + "/" + appScada + "/"; + myLocation = getAppLocation(); } var arrDictLoggingType = ["", "When point value changes", "All data", "Do not log", "Interval", "When point timestamp changes"]; @@ -813,7 +809,7 @@ jQuery.ajax({ type: "GET", dataType: "json", - url:myLocation+"/api/point_properties/getPropertiesBaseOnId/"+idPointConfigurationToBaseOnExistingPoint, + url:myLocation+"api/point_properties/getPropertiesBaseOnId/"+idPointConfigurationToBaseOnExistingPoint, success: function(properties){ setConfig(properties); }, @@ -836,7 +832,7 @@ jQuery.ajax({ type: "GET", dataType: "json", - url:myLocation+"/api/point_properties/getPropertiesBaseOnId/"+idPointConfigurationToBaseOnExistingPoint, + url:myLocation+"api/point_properties/getPropertiesBaseOnId/"+idPointConfigurationToBaseOnExistingPoint, success: function(properties){ let bCheckedType = checkType(properties.dataTypeId); diff --git a/WebContent/WEB-INF/jsp/include/highlight.jsp b/WebContent/WEB-INF/jsp/include/highlight.jsp index 2606160d24..1f2d229dc4 100644 --- a/WebContent/WEB-INF/jsp/include/highlight.jsp +++ b/WebContent/WEB-INF/jsp/include/highlight.jsp @@ -13,6 +13,15 @@ function updateCodeText(text, destination) { hljs.highlightElement(result_element); } +function updateCodeTextEscaped(text, destination) { + let result_element = document.querySelector(destination); + if(text[text.length-1] == "\n") { + text += " "; + } + result_element.innerHTML = text; + hljs.highlightElement(result_element); +} + function syncCodeScroll(element, destination) { let result_element = document.querySelector(destination); result_element.scrollTop = element.scrollTop; diff --git a/WebContent/WEB-INF/jsp/systemSettings.jsp b/WebContent/WEB-INF/jsp/systemSettings.jsp index 519bdb7606..3e516448b6 100644 --- a/WebContent/WEB-INF/jsp/systemSettings.jsp +++ b/WebContent/WEB-INF/jsp/systemSettings.jsp @@ -514,8 +514,9 @@ function initCustomCssData() { fetchCustomCssConfig().then((val) => { - document.getElementById('cssEditor').value = val; - updateCodeText(val, '#cssHighlightingContent'); + let res = JSON.parse(val); + document.getElementById('cssEditor').innerHTML = res.content; + updateCodeTextEscaped(res.content, '#cssHighlightingContent'); }); } @@ -525,7 +526,7 @@ req.open('GET', customCssUrl, true); req.onload = () => { if (req.status === 200) { - resolve(req.responseText); + resolve(req.response); } else { reject(req.status); } @@ -1129,7 +1130,7 @@ id="cssEditor" class="hgl-editor" spellcheck="false" - oninput="updateCodeText(this.value, '#cssHighlightingContent');" + oninput="updateCodeTextEscaped(this.value, '#cssHighlightingContent');" onscroll="syncCodeScroll(this, '#cssHighlightingContent');">