diff --git a/src/renderer/src/components/editor/RichMarkdownToolbar.tsx b/src/renderer/src/components/editor/RichMarkdownToolbar.tsx index 38fdf9c9f64..a82ba9bbbe2 100644 --- a/src/renderer/src/components/editor/RichMarkdownToolbar.tsx +++ b/src/renderer/src/components/editor/RichMarkdownToolbar.tsx @@ -1,6 +1,5 @@ import React from 'react' import type { Editor } from '@tiptap/react' -import { useEditorState } from '@tiptap/react' import { Heading1, Heading2, @@ -30,26 +29,6 @@ export function RichMarkdownToolbar({ onToggleLink, onImagePick }: RichMarkdownToolbarProps): React.JSX.Element { - // Why: the editor object reference is stable across transactions, so passing - // it as a prop alone won't re-render this component when the selection moves. - // useEditorState subscribes to editor transactions and returns derived state, - // triggering a re-render only when the active formatting actually changes. - const active = useEditorState({ - editor, - selector: (ctx) => { - const ed = ctx.editor - if (!ed) { - return null - } - return { - bold: ed.isActive('bold'), - italic: ed.isActive('italic'), - strike: ed.isActive('strike'), - link: ed.isActive('link') - } - } - }) - return (