mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
unvendor: Replace DOMPurify
This commit is contained in:
@ -3,7 +3,33 @@
|
||||
* They are bundled and exposed by Webpack in the /lib.js file.
|
||||
*/
|
||||
import Fuse from 'fuse.js';
|
||||
import DOMPurify from 'dompurify';
|
||||
|
||||
/**
|
||||
* Expose the libraries to the 'window' object.
|
||||
* Needed for compatibility with old extensions.
|
||||
* Note: New extensions are encouraged to import the libraries directly from lib.js.
|
||||
*/
|
||||
export function initLibraryShims() {
|
||||
if (!window) {
|
||||
return;
|
||||
}
|
||||
if (!('Fuse' in window)) {
|
||||
// @ts-ignore
|
||||
window.Fuse = Fuse;
|
||||
}
|
||||
if (!('DOMPurify' in window)) {
|
||||
// @ts-ignore
|
||||
window.DOMPurify = DOMPurify;
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
Fuse,
|
||||
DOMPurify,
|
||||
};
|
||||
|
||||
export {
|
||||
Fuse,
|
||||
DOMPurify,
|
||||
};
|
||||
|
Reference in New Issue
Block a user