tfrere HF Staff commited on
Commit
edbe0c1
·
1 Parent(s): 46d0ae2

fix: adapt to StarterKit v3 API changes

Browse files

StarterKit v3 now includes Link, Underline, and UndoRedo by default.
- Remove separate Link import/config, use StarterKit's link option
- Disable undoRedo in StarterKit (replaced by CollaborationUndo)
- Apply same fix to backend publisher extensions

Made-with: Cursor

backend/src/publisher/extensions.ts CHANGED
@@ -10,7 +10,6 @@
10
  import { Node, mergeAttributes, type Extensions } from "@tiptap/core";
11
  import StarterKit from "@tiptap/starter-kit";
12
  import CodeBlockLowlight from "@tiptap/extension-code-block-lowlight";
13
- import Link from "@tiptap/extension-link";
14
  import Mathematics from "@tiptap/extension-mathematics";
15
  import Image from "@tiptap/extension-image";
16
  import { Table } from "@tiptap/extension-table";
@@ -306,9 +305,9 @@ export function getServerExtensions(): Extensions {
306
  return [
307
  StarterKit.configure({
308
  codeBlock: false,
 
309
  } as any),
310
  CodeBlockLowlight.configure({ lowlight }),
311
- Link.configure({ openOnClick: false }),
312
  Mathematics.configure({ katexOptions: { throwOnError: false } }),
313
  Image.configure({ allowBase64: true }),
314
  Table.configure({ resizable: false }),
 
10
  import { Node, mergeAttributes, type Extensions } from "@tiptap/core";
11
  import StarterKit from "@tiptap/starter-kit";
12
  import CodeBlockLowlight from "@tiptap/extension-code-block-lowlight";
 
13
  import Mathematics from "@tiptap/extension-mathematics";
14
  import Image from "@tiptap/extension-image";
15
  import { Table } from "@tiptap/extension-table";
 
305
  return [
306
  StarterKit.configure({
307
  codeBlock: false,
308
+ link: { openOnClick: false },
309
  } as any),
310
  CodeBlockLowlight.configure({ lowlight }),
 
311
  Mathematics.configure({ katexOptions: { throwOnError: false } }),
312
  Image.configure({ allowBase64: true }),
313
  Table.configure({ resizable: false }),
frontend/src/editor/Editor.tsx CHANGED
@@ -5,7 +5,7 @@ import Collaboration from "@tiptap/extension-collaboration";
5
  import CollaborationCursor from "@tiptap/extension-collaboration-cursor";
6
  import Placeholder from "@tiptap/extension-placeholder";
7
  import CodeBlockLowlight from "@tiptap/extension-code-block-lowlight";
8
- import Link from "@tiptap/extension-link";
9
  import Mathematics from "@tiptap/extension-mathematics";
10
  import "katex/dist/katex.min.css";
11
  import { all, createLowlight } from "lowlight";
@@ -149,17 +149,17 @@ export function Editor({
149
  },
150
  extensions: [
151
  StarterKit.configure({
152
- history: false,
153
  codeBlock: false,
154
- }),
 
 
 
 
 
155
  CodeBlockLowlight.configure({ lowlight }),
156
  Placeholder.configure({
157
  placeholder: 'Type "/" for commands...',
158
  }),
159
- Link.configure({
160
- openOnClick: false,
161
- HTMLAttributes: { class: "editor-link" },
162
- }),
163
  Collaboration.configure({
164
  document: ydoc,
165
  }),
 
5
  import CollaborationCursor from "@tiptap/extension-collaboration-cursor";
6
  import Placeholder from "@tiptap/extension-placeholder";
7
  import CodeBlockLowlight from "@tiptap/extension-code-block-lowlight";
8
+ // Link is included in StarterKit v3, configured via StarterKit options
9
  import Mathematics from "@tiptap/extension-mathematics";
10
  import "katex/dist/katex.min.css";
11
  import { all, createLowlight } from "lowlight";
 
149
  },
150
  extensions: [
151
  StarterKit.configure({
 
152
  codeBlock: false,
153
+ undoRedo: false,
154
+ link: {
155
+ openOnClick: false,
156
+ HTMLAttributes: { class: "editor-link" },
157
+ },
158
+ } as any),
159
  CodeBlockLowlight.configure({ lowlight }),
160
  Placeholder.configure({
161
  placeholder: 'Type "/" for commands...',
162
  }),
 
 
 
 
163
  Collaboration.configure({
164
  document: ydoc,
165
  }),