fix(RichEditor): remove comment about underline default in useRichEditor

This commit is contained in:
suyao 2025-10-28 20:12:09 +08:00
parent b7d8dff0d3
commit c2fe2160b5
No known key found for this signature in database
4 changed files with 45 additions and 4 deletions

View File

@ -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);

View File

@ -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",

View File

@ -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,

View File

@ -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"