Merge pull request #2871 from steve02081504/patch-4 fix `\x01` display in modern WI editor

6d731bbefe171fdb73264aae6c20cbffc83b214a

Cohee <18619528+Cohee1207@users.noreply.github.com>

Signed
1 files changed, +5 -5Showing whitespace changes
public/scripts/utils.js+5 -5
@@ -1908,13 +1908,13 @@ export function select2ChoiceClickSubscribe(control, action, { buttonStyle = fal
1908 * @returns {string} The html representation of the highlighted regex1908 * @returns {string} The html representation of the highlighted regex
1909 */1909 */
1910export function highlightRegex(regexStr) {1910export function highlightRegex(regexStr) {
1911 // Function to escape HTML special characters for safety1911 // Function to escape special characters for safety or readability
1912 const escapeHtml = (str) => str.replace(/[&<>"']/g, match => ({1912 const escape = (str) => str.replace(/[&<>"'\x01]/g, match => ({
1913 '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', '\'': '&#39;',1913 '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', '\'': '&#39;', '\x01': '\\x01',
1914 })[match]);1914 })[match]);
19151915
1916 // Replace special characters with their HTML-escaped forms1916 // Replace special characters with their escaped forms
1917 regexStr = escapeHtml(regexStr);1917 regexStr = escape(regexStr);
19181918
1919 // Patterns that we want to highlight only if they are not escaped1919 // Patterns that we want to highlight only if they are not escaped
1920 function getPatterns() {1920 function getPatterns() {