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>
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
/** Безопасное чтение 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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user