diff --git a/package.json b/package.json index 1cef2ec3..d1e0fb2d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@matters/matters-editor", - "version": "0.2.0-alpha.47", + "version": "0.2.0-alpha.48", "description": "Editor for matters.news", "author": "https://github.com/thematters", "homepage": "https://github.com/thematters/matters-editor", diff --git a/src/transformers/normalize.ts b/src/transformers/normalize.ts index 926d2b08..8f25aec6 100644 --- a/src/transformers/normalize.ts +++ b/src/transformers/normalize.ts @@ -3,6 +3,7 @@ import { getSchema } from '@tiptap/core' import { DOMParser, DOMSerializer, Node } from '@tiptap/pm/model' import { createHTMLDocument, parseHTML, VHTMLDocument } from 'zeed-dom' import { + Mention, makeArticleEditorExtensions, makeCommentEditorExtensions, } from '../editors/extensions' @@ -29,12 +30,12 @@ export const makeNormalizer = (extensions: Extensions) => { export const normalizeArticleHTML = (html: string): string => { const extensions = makeArticleEditorExtensions({}) - const normalizer = makeNormalizer(extensions) + const normalizer = makeNormalizer([...extensions, Mention]) return normalizer(html) } export const normalizeCommentHTML = (html: string): string => { const extensions = makeCommentEditorExtensions({}) - const normalizer = makeNormalizer(extensions) + const normalizer = makeNormalizer([...extensions, Mention]) return normalizer(html) } diff --git a/src/transformers/options.ts b/src/transformers/options.ts index 53f168aa..caca6164 100644 --- a/src/transformers/options.ts +++ b/src/transformers/options.ts @@ -67,7 +67,7 @@ export const rehypeSanitizeOptions: }, attributes: { ...defaultSchema.attributes, - a: ['href', 'ref', 'target'], + a: ['href', 'ref', 'target', 'className', 'data*'], img: ['src', 'srcSet', 'data*'], audio: ['controls', 'data*', ['preload', 'metadata']], source: ['src', 'type', 'data*'],