Skip to content

armgit / kaneo

Public Imported from GitHub
0

⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.

fix(web): prevent Tiptap TransformError from duplicate Link extension

(justin)randoneering83702eea120f
diff --git a/apps/web/src/components/activity/comment-editor.tsx b/apps/web/src/components/activity/comment-editor.tsx
index 1360414ff..8ff383bb7 100644
--- a/apps/web/src/components/activity/comment-editor.tsx
+++ b/apps/web/src/components/activity/comment-editor.tsx
@@ -1,6 +1,5 @@
import type { Editor } from "@tiptap/core";
import Image from "@tiptap/extension-image";
-import Link from "@tiptap/extension-link";
import Placeholder from "@tiptap/extension-placeholder";
import { Table } from "@tiptap/extension-table";
import TableCell from "@tiptap/extension-table-cell";
@@ -613,12 +612,6 @@ export default function CommentEditor({
HTMLAttributes: { class: "kaneo-tiptap-codeblock" },
},
}),
- Link.configure({
- autolink: true,
- defaultProtocol: "https",
- linkOnPaste: true,
- openOnClick: readOnly,
- }),
Markdown.configure({
markedOptions: {
breaks: true,
@@ -743,6 +736,16 @@ export default function CommentEditor({
setEmbedComposerError(null);
return true;
},
+ handleClick: (view, _pos, event) => {
+ if (!readOnly) return false;
+ const target = event.target as HTMLElement;
+ const anchor = target.closest("a");
+ if (anchor?.href) {
+ window.open(anchor.href, "_blank", "noopener,noreferrer");
+ return true;
+ }
+ return false;
+ },
handleDrop: (view, event) => {
if (readOnly || disabled) return false;
diff --git a/apps/web/src/components/task/task-description.tsx b/apps/web/src/components/task/task-description.tsx
index e7d2c1781..4f7f3903f 100644
--- a/apps/web/src/components/task/task-description.tsx
+++ b/apps/web/src/components/task/task-description.tsx
@@ -1,6 +1,5 @@
import type { Editor } from "@tiptap/core";
import Image from "@tiptap/extension-image";
-import Link from "@tiptap/extension-link";
import Placeholder from "@tiptap/extension-placeholder";
import { Table } from "@tiptap/extension-table";
import TableCell from "@tiptap/extension-table-cell";
@@ -624,12 +623,6 @@ export default function TaskDescription({ taskId }: TaskDescriptionProps) {
trailingNode: false,
heading: { levels: [1, 2, 3] },
}),
- Link.configure({
- autolink: true,
- defaultProtocol: "https",
- linkOnPaste: true,
- openOnClick: false,
- }),
Markdown.configure({
markedOptions: {
breaks: true,