mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2025-12-27 22:22:42 +00:00
Return to official package; use custom addHook
This commit is contained in:
@@ -18,13 +18,7 @@ const { printCurrentBrew } = require('../../../shared/helpers.js');
|
||||
import DOMPurify from 'dompurify';
|
||||
|
||||
const purifyConfig = {
|
||||
ADD_ATTR : ['id', 'target'],
|
||||
IGNORE_BASIC_CUSTOM_ELEMENT : true, // ignore the custom-element naming specification
|
||||
CUSTOM_ELEMENT_HANDLING : {
|
||||
tagNameCheck : ()=>{ return true; }, // all elements are allowed
|
||||
attributeNameCheck : null, // default / standard attribute allow-list is used
|
||||
allowCustomizedBuiltInElements : false, // no customized built-ins allowed
|
||||
},
|
||||
ADD_ATTR : ['id', 'target']
|
||||
};
|
||||
|
||||
const Themes = require('themes/themes.json');
|
||||
@@ -180,6 +174,11 @@ const BrewRenderer = (props)=>{
|
||||
};
|
||||
|
||||
const frameDidMount = ()=>{ //This triggers when iFrame finishes internal "componentDidMount"
|
||||
DOMPurify.addHook('uponSanitizeElement', (node, data, config)=>{
|
||||
const tagName = node.tagName?.toLowerCase();
|
||||
data.allowedTags[tagName] = true;
|
||||
});
|
||||
|
||||
setTimeout(()=>{ //We still see a flicker where the style isn't applied yet, so wait 100ms before showing iFrame
|
||||
updateSize();
|
||||
window.addEventListener('resize', updateSize);
|
||||
|
||||
6
package-lock.json
generated
6
package-lock.json
generated
@@ -21,7 +21,7 @@
|
||||
"cookie-parser": "^1.4.6",
|
||||
"create-react-class": "^15.7.0",
|
||||
"dedent-tabs": "^0.10.3",
|
||||
"dompurify": "git+https://github.com/G-Ambatte/DOMPurify.git#AddConfigOption-IGNORE_BASIC_CUSTOM_ELEMENT",
|
||||
"dompurify": "^3.1.5",
|
||||
"expr-eval": "^2.0.2",
|
||||
"express": "^4.19.2",
|
||||
"express-async-handler": "^1.2.0",
|
||||
@@ -5469,8 +5469,8 @@
|
||||
},
|
||||
"node_modules/dompurify": {
|
||||
"version": "3.1.5",
|
||||
"resolved": "git+ssh://git@github.com/G-Ambatte/DOMPurify.git#b6cc41ec10b6fb6de17b29015ea0718eccd752f9",
|
||||
"license": "(MPL-2.0 OR Apache-2.0)"
|
||||
"resolved": "https://registry.npmjs.org/dompurify/-/dompurify-3.1.5.tgz",
|
||||
"integrity": "sha512-lwG+n5h8QNpxtyrJW/gJWckL+1/DQiYMX8f7t8Z2AZTPw1esVrqjI63i7Zc2Gz0aKzLVMYC1V1PL/ky+aY/NgA=="
|
||||
},
|
||||
"node_modules/duplexer2": {
|
||||
"version": "0.1.4",
|
||||
|
||||
@@ -93,7 +93,7 @@
|
||||
"cookie-parser": "^1.4.6",
|
||||
"create-react-class": "^15.7.0",
|
||||
"dedent-tabs": "^0.10.3",
|
||||
"dompurify": "git+https://github.com/G-Ambatte/DOMPurify.git#AddConfigOption-IGNORE_BASIC_CUSTOM_ELEMENT",
|
||||
"dompurify": "^3.1.5",
|
||||
"expr-eval": "^2.0.2",
|
||||
"express": "^4.19.2",
|
||||
"express-async-handler": "^1.2.0",
|
||||
|
||||
Reference in New Issue
Block a user