04c75cd725
Guard TipTap getHTML under StrictMode, wrap secondary window roots in WindowErrorBoundary, and add stability regression tests. Co-authored-by: Cursor <cursoragent@cursor.com>
13 lines
361 B
TypeScript
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;
|
|
}
|
|
}
|