fix: strip html styles on paste

This commit is contained in:
Philipinho
2026-05-22 19:00:30 +01:00
parent 61a91cd086
commit d7c4f0551e
2 changed files with 22 additions and 0 deletions
@@ -0,0 +1,20 @@
import { Extension } from "@tiptap/core";
import { Plugin, PluginKey } from "@tiptap/pm/state";
export const CleanStyles = Extension.create({
name: "cleanStyles",
priority: 80,
addProseMirrorPlugins() {
return [
new Plugin({
key: new PluginKey("cleanStyles"),
props: {
transformPastedHTML(html) {
return html.replace(/\s+style="[^"]*"/gi, "");
},
},
}),
];
},
});