feat(editor): keep the caret clear of the floating toolbar

This commit is contained in:
pj committed 2026-08-10 18:36:18 +05:30
1 parent abcd133b19
commit 742e42d65b
1 file changed
+7 -1
+7 -1
View File
@@ -21,6 +21,8 @@ interface Cached {
scroll: number;
}
const SCROLL_KEEPOUT = { top: 32, right: 0, bottom: 96, left: 0 };
function buildState(editor: TiptapEditor, content: JSONContent, onError: (error: Error) => void): EditorState {
const base = editor.view.state;
try {
@@ -49,7 +51,11 @@ export function Editor({ bookId, chapterId, content, onChange, onReady, onConten
content,
immediatelyRender: false,
enableContentCheck: true,
editorProps: { attributes: { class: "prose" } },
editorProps: {
attributes: { class: "prose" },
scrollThreshold: SCROLL_KEEPOUT,
scrollMargin: SCROLL_KEEPOUT,
},
onContentError: ({ error }) => onContentErrorRef.current(error),
onUpdate: ({ editor }) => onChangeRef.current(editor.getJSON()),
});