Skip to content

Commit 302e1e9

Browse files
committed
feat: Auto-apply markdown features on editor: Enable WYSIWYG
1 parent eed987b commit 302e1e9

File tree

3 files changed

+24
-3
lines changed

3 files changed

+24
-3
lines changed

components/editor/editor/index.tsx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,26 @@
11
"use client";
22

3-
import { useEditor, EditorContent } from "@tiptap/react";
3+
import Highlight from '@tiptap/extension-highlight'
4+
import Typography from '@tiptap/extension-typography'
5+
import { EditorContent, useEditor } from '@tiptap/react'
6+
import StarterKit from '@tiptap/starter-kit'
47
import { TiptapEditorProps } from "./props";
58
import { CustomCodeBlockEdit, TiptapExtensions } from "./extensions";
69
import { EditorBubbleMenu } from "./components/bubble-menu";
710
import { MediaResizer } from "./components/image-resizer";
811
import Toolbar from "./components/Toolbar/Toolbar";
9-
12+
1013
interface EditorProps {
1114
initialValue: string;
1215
onChange: (value: string) => void;
1316
}
1417

1518
export default function Editor({ onChange, initialValue }: EditorProps) {
1619
const editor = useEditor({
17-
extensions: [...TiptapExtensions, CustomCodeBlockEdit],
20+
extensions: [
21+
StarterKit,
22+
Highlight,
23+
Typography],
1824
editorProps: TiptapEditorProps,
1925
content: JSON.parse(initialValue),
2026
onUpdate: (e) => {

package-lock.json

Lines changed: 14 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
"@tiptap/extension-table-row": "^2.6.6",
6060
"@tiptap/extension-text-align": "^2.6.6",
6161
"@tiptap/extension-text-style": "^2.3.1",
62+
"@tiptap/extension-typography": "^2.8.0",
6263
"@tiptap/extension-underline": "^2.6.6",
6364
"@tiptap/extension-youtube": "^2.6.6",
6465
"@tiptap/pm": "^2.5.1",

0 commit comments

Comments
 (0)