Files
DndGamePlayer/app/renderer/npcs/tiptapEditorSafe.ts
T
Ivan Fontosh 04c75cd725 fix(npcs): stop TipTap crash black screen in secondary windows
Guard TipTap getHTML under StrictMode, wrap secondary window roots in WindowErrorBoundary, and add stability regression tests.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-30 09:10:47 +08:00

13 lines
361 B
TypeScript

/** Безопасное чтение HTML из TipTap/ProseMirror (StrictMode / destroy mid-flight). */
export function readTipTapHtmlSafe(editor: {
isDestroyed?: boolean;
getHTML: () => string;
} | null | undefined): string | null {
if (!editor || editor.isDestroyed) return null;
try {
return editor.getHTML();
} catch {
return null;
}
}