Skip to content

Commit

Permalink
Version 2.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
LeSuisse committed Aug 10, 2020
1 parent c0dbaaf commit e6d3fed
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 2 deletions.
7 changes: 7 additions & 0 deletions dist/dompurify-html.d.ts
Original file line number Diff line number Diff line change
@@ -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[];
Expand All @@ -20,5 +21,11 @@ export interface MinimalDOMPurifyConfig {
export interface DirectiveConfig {
default?: MinimalDOMPurifyConfig;
namedConfigurations?: Record<string, MinimalDOMPurifyConfig>;
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;
8 changes: 8 additions & 0 deletions dist/dompurify-html.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down

0 comments on commit e6d3fed

Please sign in to comment.