From b59de2055647625395cdaf9ee38304d3be5cb9aa Mon Sep 17 00:00:00 2001 From: Sergey Kozyrenko Date: Thu, 2 Jul 2026 15:50:50 +0700 Subject: [PATCH] refactor(markdown-editor): drop dead export + trim duplicated comment MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - FaithfulMarkdownText: drop the `export` — it has zero importers, used only inline by createMarkdownLayer in the same file (its sibling createFaithfulMarked is already a private const). - markdown-editor.tsx: remove the reset-history tail comment that restated verbatim the invariant already in resetUndoHistory's header (lines 52-53); the 'when it fires' explanation above it stays. Co-Authored-By: Claude Opus 4.8 --- .../shared/markdown-editor/markdown-editor-marked.ts | 2 +- .../src/components/shared/markdown-editor/markdown-editor.tsx | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/frontend/src/components/shared/markdown-editor/markdown-editor-marked.ts b/frontend/src/components/shared/markdown-editor/markdown-editor-marked.ts index baed5088..9c950745 100644 --- a/frontend/src/components/shared/markdown-editor/markdown-editor-marked.ts +++ b/frontend/src/components/shared/markdown-editor/markdown-editor-marked.ts @@ -64,7 +64,7 @@ const createFaithfulMarked = () => { // per-extension hook), so replace that one method with identity, keeping load and save byte-symmetric. type ManagerWithEncode = { encodeTextForMarkdown: (text: string) => string }; -export const FaithfulMarkdownText = Extension.create({ +const FaithfulMarkdownText = Extension.create({ name: 'faithfulMarkdownText', onBeforeCreate() { const manager = this.editor.markdown as unknown as ManagerWithEncode | undefined; diff --git a/frontend/src/components/shared/markdown-editor/markdown-editor.tsx b/frontend/src/components/shared/markdown-editor/markdown-editor.tsx index 4c73eb59..3058a8da 100644 --- a/frontend/src/components/shared/markdown-editor/markdown-editor.tsx +++ b/frontend/src/components/shared/markdown-editor/markdown-editor.tsx @@ -234,10 +234,6 @@ function MarkdownEditor({ // - on every external `setContent` (e.g. parent calls // form.reset(serverDocument)), because that transaction is // not a user edit either. - // - // We MUST NOT reset on every render: when the user types, - // `value` changes too, and resetting then would erase the - // user's own undo history. if (!hasResetInitialHistoryRef.current || shouldExternalSync) { hasResetInitialHistoryRef.current = true; resetUndoHistory(editor);