diff --git a/Frontend/assets/scripts/tools/scripts.js b/Frontend/assets/scripts/tools/scripts.js index 5319322..da508d9 100644 --- a/Frontend/assets/scripts/tools/scripts.js +++ b/Frontend/assets/scripts/tools/scripts.js @@ -126,7 +126,8 @@ function fillDefaultXSLT() { fetch(serverAddress + "/assets/samples/XSLTTemplate.xslt") .then( response => response.text() ) .then( (XSTLTemplate) => { - document.getElementById('transformArea').value = XSTLTemplate; + document.getElementById('transformArea').innerText = XSTLTemplate; + highlightSyntax("transformArea"); } ) } diff --git a/Frontend/tools/xpath.html b/Frontend/tools/xpath.html index c0689c8..f3a8885 100644 --- a/Frontend/tools/xpath.html +++ b/Frontend/tools/xpath.html @@ -69,7 +69,7 @@ -
+
diff --git a/Frontend/tools/xsd.html b/Frontend/tools/xsd.html
index 4cfbd35..3409cdc 100644
--- a/Frontend/tools/xsd.html
+++ b/Frontend/tools/xsd.html
@@ -4,7 +4,11 @@
+
+
+
+
@@ -43,25 +47,18 @@
-
-
+
@@ -115,6 +112,80 @@
}
}
+ const editorEle = document.getElementById('xmlArea');
+
+ // Handle the `paste` event
+ editorEle.addEventListener('paste', function (e) {
+ // Prevent the default action
+ e.preventDefault();
+
+ // Get the copied text from the clipboard
+ const text = e.clipboardData
+ ? (e.originalEvent || e).clipboardData.getData('text/plain')
+ : // For IE
+ window.clipboardData
+ ? window.clipboardData.getData('Text')
+ : '';
+
+ if (document.queryCommandSupported('insertText')) {
+ document.execCommand('insertText', false, text);
+ highlightSyntax(editorEle.id);
+ } else {
+ // Insert text at the current position of caret
+ const range = document.getSelection().getRangeAt(0);
+ range.deleteContents();
+
+ const textNode = document.createTextNode(text);
+ range.insertNode(textNode);
+ range.selectNodeContents(textNode);
+ range.collapse(false);
+
+ const selection = window.getSelection();
+ selection.removeAllRanges();
+ selection.addRange(range);
+
+
+ }
+
+ });
+
+ const transformEle = document.getElementById('transformArea');
+
+ // Handle the `paste` event
+ transformEle.addEventListener('paste', function (e) {
+ // Prevent the default action
+ e.preventDefault();
+
+ // Get the copied text from the clipboard
+ const text = e.clipboardData
+ ? (e.originalEvent || e).clipboardData.getData('text/plain')
+ : // For IE
+ window.clipboardData
+ ? window.clipboardData.getData('Text')
+ : '';
+
+ if (document.queryCommandSupported('insertText')) {
+ document.execCommand('insertText', false, text);
+ highlightSyntax(transformEle.id);
+ } else {
+ // Insert text at the current position of caret
+ const range = document.getSelection().getRangeAt(0);
+ range.deleteContents();
+
+ const textNode = document.createTextNode(text);
+ range.insertNode(textNode);
+ range.selectNodeContents(textNode);
+ range.collapse(false);
+
+ const selection = window.getSelection();
+ selection.removeAllRanges();
+ selection.addRange(range);
+
+
+ }
+
+ });
+
diff --git a/Frontend/tools/xslt.html b/Frontend/tools/xslt.html index 50d3d94..3ba79b9 100644 --- a/Frontend/tools/xslt.html +++ b/Frontend/tools/xslt.html @@ -4,7 +4,13 @@
+
+
+
+
+
+
@@ -45,11 +51,8 @@
-
-
+
+
- +
-
+
-
+
@@ -1227,6 +1225,80 @@ processTooltip(); }) } + + const editorEle = document.getElementById('xmlArea'); + + // Handle the `paste` event + editorEle.addEventListener('paste', function (e) { + // Prevent the default action + e.preventDefault(); + + // Get the copied text from the clipboard + const text = e.clipboardData + ? (e.originalEvent || e).clipboardData.getData('text/plain') + : // For IE + window.clipboardData + ? window.clipboardData.getData('Text') + : ''; + + if (document.queryCommandSupported('insertText')) { + document.execCommand('insertText', false, text); + highlightSyntax(editorEle.id); + } else { + // Insert text at the current position of caret + const range = document.getSelection().getRangeAt(0); + range.deleteContents(); + + const textNode = document.createTextNode(text); + range.insertNode(textNode); + range.selectNodeContents(textNode); + range.collapse(false); + + const selection = window.getSelection(); + selection.removeAllRanges(); + selection.addRange(range); + + + } + + }); + + const transformEle = document.getElementById('transformArea'); + + // Handle the `paste` event + transformEle.addEventListener('paste', function (e) { + // Prevent the default action + e.preventDefault(); + + // Get the copied text from the clipboard + const text = e.clipboardData + ? (e.originalEvent || e).clipboardData.getData('text/plain') + : // For IE + window.clipboardData + ? window.clipboardData.getData('Text') + : ''; + + if (document.queryCommandSupported('insertText')) { + document.execCommand('insertText', false, text); + highlightSyntax(transformEle.id); + } else { + // Insert text at the current position of caret + const range = document.getSelection().getRangeAt(0); + range.deleteContents(); + + const textNode = document.createTextNode(text); + range.insertNode(textNode); + range.selectNodeContents(textNode); + range.collapse(false); + + const selection = window.getSelection(); + selection.removeAllRanges(); + selection.addRange(range); + + + } + + });