diff --git a/dist/dompurify-html.d.ts b/dist/dompurify-html.d.ts
index c9d7a6c1..9861ced9 100644
--- a/dist/dompurify-html.d.ts
+++ b/dist/dompurify-html.d.ts
@@ -1,4 +1,5 @@
import { DirectiveOptions } from 'vue';
+import { HookEvent, HookName, SanitizeAttributeHookEvent, SanitizeElementHookEvent } from 'dompurify';
export interface MinimalDOMPurifyConfig {
ADD_ATTR?: string[];
ADD_DATA_URI_TAGS?: string[];
@@ -20,5 +21,11 @@ export interface MinimalDOMPurifyConfig {
export interface DirectiveConfig {
default?: MinimalDOMPurifyConfig;
namedConfigurations?: Record;
+ hooks?: {
+ uponSanitizeElement?: (currentNode: Element, data: SanitizeElementHookEvent, config: MinimalDOMPurifyConfig) => void;
+ uponSanitizeAttribute?: (currentNode: Element, data: SanitizeAttributeHookEvent, config: MinimalDOMPurifyConfig) => void;
+ } & {
+ [H in HookName]?: (currentNode: Element, data: HookEvent, config: MinimalDOMPurifyConfig) => void;
+ };
}
export declare function buildDirective(config?: DirectiveConfig): DirectiveOptions;
diff --git a/dist/dompurify-html.js b/dist/dompurify-html.js
index bc42173a..00c5bbbd 100644
--- a/dist/dompurify-html.js
+++ b/dist/dompurify-html.js
@@ -2,8 +2,16 @@
Object.defineProperty(exports, "__esModule", { value: true });
exports.buildDirective = void 0;
var dompurify_1 = require("dompurify");
+function setUpHooks(config) {
+ var hooks = config.hooks;
+ var hookName;
+ for (hookName in hooks) {
+ dompurify_1.addHook(hookName, hooks[hookName]);
+ }
+}
function buildDirective(config) {
if (config === void 0) { config = {}; }
+ setUpHooks(config);
var updateComponent = function (el, binding) {
if (binding.oldValue === binding.value) {
return;
diff --git a/package-lock.json b/package-lock.json
index e17c6531..d22a80e3 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,6 +1,6 @@
{
"name": "vue-dompurify-html",
- "version": "2.2.1",
+ "version": "2.3.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
diff --git a/package.json b/package.json
index 9649e883..4f5710ba 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "vue-dompurify-html",
- "version": "2.2.1",
+ "version": "2.3.0",
"description": "Safe replacement for the v-html directive",
"license": "MIT",
"author": "Thomas Gerbet",