From 222f60d2dd6f89d065e9280ed67b26b3834dbf3a Mon Sep 17 00:00:00 2001 From: Naiyuan Qing <145280634+NevilleQingNY@users.noreply.github.com> Date: Thu, 2 Apr 2026 16:59:20 +0800 Subject: [PATCH] fix(editor): prevent link mark from sticking to cursor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Override Link extension `inclusive: false` via `.extend()` to decouple it from `autolink: true`. Tiptap's source ties `inclusive` to `autolink`, causing typed text after a link to inherit the link mark. Also set `linkOnPaste: false` — autolink's PasteRule still auto-detects pasted URLs without the sticky cursor issue. Refs: ueberdosis/tiptap#2571, ueberdosis/tiptap#4249 Co-Authored-By: Claude Opus 4.6 (1M context) --- apps/web/components/common/rich-text-editor.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/web/components/common/rich-text-editor.tsx b/apps/web/components/common/rich-text-editor.tsx index a7a92247..c9cf9135 100644 --- a/apps/web/components/common/rich-text-editor.tsx +++ b/apps/web/components/common/rich-text-editor.tsx @@ -50,9 +50,10 @@ interface RichTextEditorRef { insertFile: (filename: string, url: string, isImage: boolean) => void; } -const LinkExtension = Link.configure({ +const LinkExtension = Link.extend({ inclusive: false }).configure({ openOnClick: true, autolink: true, + linkOnPaste: false, HTMLAttributes: { class: "text-primary hover:underline cursor-pointer", },