Skip to content

Use prosemirror schema instead of node extension API? #2077

Discussion options

You must be logged in to vote

TLDR: Not really.

You can use the onBeforeCreate event to overwrite the schema. At this time the view is not created.

import { Editor } from '@tiptap/core'

const editor = new Editor({
  onBeforeCreate() {
    this.editor.schema = new Schema({
      // ...
    })
  },
})

But I think this will throw a ProseMirror error because tiptap creates the schema right before onBeforeCreate. Without a topNode and a text extension, ProseMirror throws an error.

You can use a minimal setup to create a valid schema. After that you can overwrite it.

import { Editor } from '@tiptap/core'
import Document from '@tiptap/extension-document'
import Paragraph from '@tiptap/extension-paragraph'
import Text from '…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@tslocke
Comment options

@tslocke
Comment options

@philippkuehn
Comment options

Answer selected by tslocke
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants