Skip to content

Commit

Permalink
feat: Add auto-apply markdown features on editor: Enable WYSIWYG (#1068)
Browse files Browse the repository at this point in the history
* chore: update the theme of dropdown menu on articles page (for dark mode)

* chore: fix dark mode theme in profile page

* format the files

* fix: lint of profile page

* feat: Auto-apply markdown features on editor: Enable WYSIWYG
  • Loading branch information
nawinsharma authored Oct 6, 2024
1 parent 7cc3d4f commit bc82b28
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 3 deletions.
12 changes: 9 additions & 3 deletions components/editor/editor/index.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,26 @@
"use client";

import { useEditor, EditorContent } from "@tiptap/react";
import Highlight from '@tiptap/extension-highlight'
import Typography from '@tiptap/extension-typography'
import { EditorContent, useEditor } from '@tiptap/react'
import StarterKit from '@tiptap/starter-kit'
import { TiptapEditorProps } from "./props";
import { CustomCodeBlockEdit, TiptapExtensions } from "./extensions";
import { EditorBubbleMenu } from "./components/bubble-menu";
import { MediaResizer } from "./components/image-resizer";
import Toolbar from "./components/Toolbar/Toolbar";

interface EditorProps {
initialValue: string;
onChange: (value: string) => void;
}

export default function Editor({ onChange, initialValue }: EditorProps) {
const editor = useEditor({
extensions: [...TiptapExtensions, CustomCodeBlockEdit],
extensions: [
StarterKit,
Highlight,
Typography],
editorProps: TiptapEditorProps,
content: JSON.parse(initialValue),
onUpdate: (e) => {
Expand Down
14 changes: 14 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
"@tiptap/extension-table-row": "^2.6.6",
"@tiptap/extension-text-align": "^2.6.6",
"@tiptap/extension-text-style": "^2.3.1",
"@tiptap/extension-typography": "^2.8.0",
"@tiptap/extension-underline": "^2.6.6",
"@tiptap/extension-youtube": "^2.6.6",
"@tiptap/pm": "^2.5.1",
Expand Down

0 comments on commit bc82b28

Please sign in to comment.