mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-06-15 23:01:44 +03:00
Started migrating tag manager JS to HTML-first component
This commit is contained in:
@ -45,4 +45,19 @@ export function scrollAndHighlightElement(element) {
|
||||
element.classList.remove('selectFade');
|
||||
element.style.backgroundColor = '';
|
||||
}, 3000);
|
||||
}
|
||||
|
||||
/**
|
||||
* Escape any HTML in the given 'unsafe' string.
|
||||
* Take from https://stackoverflow.com/a/6234804.
|
||||
* @param {String} unsafe
|
||||
* @returns {string}
|
||||
*/
|
||||
export function escapeHtml(unsafe) {
|
||||
return unsafe
|
||||
.replace(/&/g, "&")
|
||||
.replace(/</g, "<")
|
||||
.replace(/>/g, ">")
|
||||
.replace(/"/g, """)
|
||||
.replace(/'/g, "'");
|
||||
}
|
Reference in New Issue
Block a user