diff --git a/packages/nc-gui/components/cell/RichText.vue b/packages/nc-gui/components/cell/RichText.vue index c4e85fcdb8..93eafbc503 100644 --- a/packages/nc-gui/components/cell/RichText.vue +++ b/packages/nc-gui/components/cell/RichText.vue @@ -125,7 +125,7 @@ const getTiptapExtensions = () => { emptyEditorClass: 'is-editor-empty', placeholder: props.placeholder, }), - Markdown.configure({ breaks: true, transformPastedText: true, transformCopiedText: true }), + Markdown.configure({ breaks: true, transformPastedText: true }), ] if (appInfo.value.ee && !props.hideMention) { diff --git a/packages/nc-gui/components/smartsheet/expanded-form/RichComment.vue b/packages/nc-gui/components/smartsheet/expanded-form/RichComment.vue index 3705127faf..d74b2e81e8 100644 --- a/packages/nc-gui/components/smartsheet/expanded-form/RichComment.vue +++ b/packages/nc-gui/components/smartsheet/expanded-form/RichComment.vue @@ -62,7 +62,7 @@ const tiptapExtensions = [ emptyEditorClass: 'is-editor-empty', placeholder: props.placeholder, }), - Markdown.configure({ breaks: true, transformPastedText: true, transformCopiedText: true }), + Markdown.configure({ breaks: true, transformPastedText: true }), ] const editor = useEditor({ diff --git a/packages/nc-gui/helpers/tiptap/extensions/functionality/markdown/markdown.ts b/packages/nc-gui/helpers/tiptap/extensions/functionality/markdown/markdown.ts index 0646e5fa1a..d2dc945df8 100644 --- a/packages/nc-gui/helpers/tiptap/extensions/functionality/markdown/markdown.ts +++ b/packages/nc-gui/helpers/tiptap/extensions/functionality/markdown/markdown.ts @@ -25,6 +25,10 @@ export interface NcMarkdownParserConstructorType { maxBlockTokens?: number // Add this to limit block tokens } +// Precompiled regex patterns +const taskRegex = /^(?!.*- )(\s*)\[( |x|X)\]/gm // Matches unchecked and checked tasks +const strikeThroughRegex = /(? { + const checked = state.toLowerCase() === 'x' ? '[x]' : '[ ]' + return `${spaces}- ${checked}` + }) } - markdownText = markdownText.replace(/(?$1') - - return markdownText + // Replace single tilde strikethrough syntax with tags + return markdownText.replace(strikeThroughRegex, '$1') } /**