Convert advisory html images before editor mount

This commit is contained in:
Dotta committed 2026-04-15 07:24:21 -05:00
1 parent de4432c3ec
commit 92ce9cd61c
2 files changed
-5

No files matched your search

@@ -126,8 +126,6 @@ vi.mock("@mdxeditor/editor", async () => {
markdownShortcutPlugin: () => ({}),
quotePlugin: () => ({}),
realmPlugin: (plugin: unknown) => plugin,
jsxPlugin: () => ({}),
GenericJsxEditor: () => null,
tablePlugin: () => ({}),
thematicBreakPlugin: () => ({}),
};
-3
View File
@@ -505,7 +505,6 @@ export const MarkdownEditor = forwardRef<MarkdownEditorRef, MarkdownEditorProps>
const [isDragOver, setIsDragOver] = useState(false);
const [richEditorError, setRichEditorError] = useState<string | null>(null);
const dragDepthRef = useRef(0);
const suppressHtmlProcessing = /<img\s/i.test(value);
// Stable ref for imageUploadHandler so plugins don't recreate on every render
const imageUploadHandlerRef = useRef(imageUploadHandler);
@@ -1056,11 +1055,9 @@ export const MarkdownEditor = forwardRef<MarkdownEditorRef, MarkdownEditorProps>
onPasteCapture={handlePasteCapture}
>
<MDXEditor
key={suppressHtmlProcessing ? "mdxeditor-no-html" : "mdxeditor-default"}
ref={setEditorRef}
markdown={editorValue}
placeholder={placeholder}
suppressHtmlProcessing={suppressHtmlProcessing}
onChange={(next) => {
const echo = echoIgnoreMarkdownRef.current;
if (echo !== null && next === echo) {