From c2fe2160b57219d81678e790a49684c8365d6838 Mon Sep 17 00:00:00 2001 From: suyao Date: Tue, 28 Oct 2025 20:12:09 +0800 Subject: [PATCH] fix(RichEditor): remove comment about underline default in useRichEditor --- ...tiptap-markdown-npm-3.7.2-165301ab30.patch | 30 +++++++++++++++++++ package.json | 2 +- .../components/RichEditor/useRichEditor.ts | 1 - yarn.lock | 16 ++++++++-- 4 files changed, 45 insertions(+), 4 deletions(-) create mode 100644 .yarn/patches/@tiptap-markdown-npm-3.7.2-165301ab30.patch diff --git a/.yarn/patches/@tiptap-markdown-npm-3.7.2-165301ab30.patch b/.yarn/patches/@tiptap-markdown-npm-3.7.2-165301ab30.patch new file mode 100644 index 0000000000..517cc095d1 --- /dev/null +++ b/.yarn/patches/@tiptap-markdown-npm-3.7.2-165301ab30.patch @@ -0,0 +1,30 @@ +diff --git a/dist/index.js b/dist/index.js +index 09b04baf28c18d8ee20e6d0644329a830915e893..f2b3e8df251c3f56074937dc0c6e658930d5303b 100644 +--- a/dist/index.js ++++ b/dist/index.js +@@ -558,14 +558,24 @@ var MarkdownManager = class { + nextNode, + this.markSetsEqual.bind(this) + ); ++ ++ // Collect all closing marks with their markdown syntax ++ const closingMarks = []; + marksToCloseAtEnd.forEach((markType) => { + const mark = activeMarks.get(markType); + const closeMarkdown = this.getMarkClosing(markType, mark); + if (closeMarkdown) { +- textContent += closeMarkdown; ++ closingMarks.push(closeMarkdown); + } + activeMarks.delete(markType); + }); ++ ++ // Reverse the closing marks to match opening order (LIFO) ++ // For example: if we opened as *~~, we should close as ~~* ++ closingMarks.reverse().forEach((closeMarkdown) => { ++ textContent += closeMarkdown; ++ }); ++ + result.push(textContent); + } else { + const marksToReopen = new Map(activeMarks); diff --git a/package.json b/package.json index 4fe01ec6bf..c1e06a7aeb 100644 --- a/package.json +++ b/package.json @@ -180,7 +180,7 @@ "@tiptap/extension-table-of-contents": "^3.7.2", "@tiptap/extension-typography": "^3.7.2", "@tiptap/extension-underline": "^3.7.2", - "@tiptap/markdown": "^3.7.2", + "@tiptap/markdown": "patch:@tiptap/markdown@npm%3A3.7.2#~/.yarn/patches/@tiptap-markdown-npm-3.7.2-165301ab30.patch", "@tiptap/pm": "^3.7.2", "@tiptap/react": "^3.7.2", "@tiptap/starter-kit": "^3.7.2", diff --git a/src/renderer/src/components/RichEditor/useRichEditor.ts b/src/renderer/src/components/RichEditor/useRichEditor.ts index 1b9dc58d11..5510626da7 100644 --- a/src/renderer/src/components/RichEditor/useRichEditor.ts +++ b/src/renderer/src/components/RichEditor/useRichEditor.ts @@ -207,7 +207,6 @@ export const useRichEditor = (options: UseRichEditorOptions = {}): UseRichEditor }, codeBlock: false, link: false - // underline is enabled by default in StarterKit }), EnhancedLink.configure({ onLinkHover: handleLinkHover, diff --git a/yarn.lock b/yarn.lock index eb4b1343f4..40b47797cc 100644 --- a/yarn.lock +++ b/yarn.lock @@ -11881,7 +11881,7 @@ __metadata: languageName: node linkType: hard -"@tiptap/markdown@npm:^3.7.2": +"@tiptap/markdown@npm:3.7.2": version: 3.7.2 resolution: "@tiptap/markdown@npm:3.7.2" dependencies: @@ -11893,6 +11893,18 @@ __metadata: languageName: node linkType: hard +"@tiptap/markdown@patch:@tiptap/markdown@npm%3A3.7.2#~/.yarn/patches/@tiptap-markdown-npm-3.7.2-165301ab30.patch": + version: 3.7.2 + resolution: "@tiptap/markdown@patch:@tiptap/markdown@npm%3A3.7.2#~/.yarn/patches/@tiptap-markdown-npm-3.7.2-165301ab30.patch::version=3.7.2&hash=fe7244" + dependencies: + marked: "npm:^16.1.2" + peerDependencies: + "@tiptap/core": ^3.7.2 + "@tiptap/pm": ^3.7.2 + checksum: 10c0/e10a12b5bdfdd5efea24e7d089832cd2d3192b6222979c19b130e0eea00df0c498dd79efb5aec18e98d0b05627c81691dec3ab0c86f2a15244690cff1e1515f9 + languageName: node + linkType: hard + "@tiptap/pm@npm:^3.7.2": version: 3.7.2 resolution: "@tiptap/pm@npm:3.7.2" @@ -13960,7 +13972,7 @@ __metadata: "@tiptap/extension-table-of-contents": "npm:^3.7.2" "@tiptap/extension-typography": "npm:^3.7.2" "@tiptap/extension-underline": "npm:^3.7.2" - "@tiptap/markdown": "npm:^3.7.2" + "@tiptap/markdown": "patch:@tiptap/markdown@npm%3A3.7.2#~/.yarn/patches/@tiptap-markdown-npm-3.7.2-165301ab30.patch" "@tiptap/pm": "npm:^3.7.2" "@tiptap/react": "npm:^3.7.2" "@tiptap/starter-kit": "npm:^3.7.2"