mirror of
https://github.com/purrgrammer/grimoire.git
synced 2026-04-10 15:36:53 +02:00
The previous `isEditorReady()` helper was a callback that could become stale in closures, and didn't properly track when the editor view was fully mounted. Changes: - Add `isEditorReady` state that's set via TipTap's `onCreate` callback - Add `onDestroy` callback to reset state when editor is destroyed - Replace `isEditorReady()` callback with `checkEditorReady()` that checks both the state flag AND actual editor/view existence - Check `editor.isDestroyed` to handle destroyed editor edge cases - Use non-null assertion after `checkEditorReady()` passes - Remove manual `editor.destroy()` in MentionEditor (useEditor handles this) - Add `isEditorReady` to useEffect dependencies for keydown listener This fixes intermittent "DOM not available" errors in the POST composer that occurred when parent components called editor methods before the view was fully mounted. https://claude.ai/code/session_01Y1xotRNwx95jUAHARNavEn