Skip to content

Commit

Permalink
feat: remove editors export
Browse files Browse the repository at this point in the history
  • Loading branch information
robertu7 committed Aug 1, 2024
1 parent 24f5c28 commit 9fc882a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 71 deletions.
7 changes: 4 additions & 3 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,16 @@ The editor core, built with [TipTap](https://tiptap.dev) & [ProseMirror](https:/
```tsx
import {
EditorContent,
useArticleEditor,
useCommentEditor,
articleEditorExtensions,
useEditor,
} from '@matters/matters-editor'

const Editor = () => {
const editor = useArticleEditor({
const editor = useEditor({
editable: true,
placeholder: 'Write your article here...',
content: '', // initial content
extensions: articleEditorExtensions,
onUpdate: async ({ editor, transaction }) => {
const content = editor.getHTML()
// update({ content })
Expand Down
68 changes: 0 additions & 68 deletions src/editors/index.ts
Original file line number Diff line number Diff line change
@@ -1,71 +1,3 @@
export * from './extensions'
export * from '@tiptap/react'
export * from '@tiptap/suggestion'

import type { EditorOptions } from '@tiptap/react'
import { useEditor } from '@tiptap/react'

import {
articleEditorExtensions,
campaignEditorExtensions,
commentEditorExtensions,
momentEditorExtensions,
} from './extensions'

type UseEditorProps = EditorOptions

export const useArticleEditor = ({
extensions,
content,
...restProps
}: UseEditorProps) => {
const editor = useEditor({
extensions: [...articleEditorExtensions, ...(extensions ?? [])],
content,
...restProps,
})

return editor
}

export const useCommentEditor = ({
extensions,
content,
...restProps
}: UseEditorProps) => {
const editor = useEditor({
extensions: [...commentEditorExtensions, ...(extensions ?? [])],
content,
...restProps,
})

return editor
}

export const useMomentEditor = ({
extensions,
content,
...restProps
}: UseEditorProps) => {
const editor = useEditor({
extensions: [...momentEditorExtensions, ...(extensions ?? [])],
content,
...restProps,
})

return editor
}

export const useCampaignEditor = ({
extensions,
content,
...restProps
}: UseEditorProps) => {
const editor = useEditor({
extensions: [...campaignEditorExtensions, ...(extensions ?? [])],
content,
...restProps,
})

return editor
}

0 comments on commit 9fc882a

Please sign in to comment.