docs: use regular case for Tiptap
This commit is contained in:
@@ -5,11 +5,11 @@ tableOfContents: true
|
||||
# Schema
|
||||
|
||||
## Introduction
|
||||
Unlike many other editors, tiptap is based on a [schema](https://prosemirror.net/docs/guide/#schema) that defines how your content is structured. That enables you to define the kind of nodes that may occur in the document, its attributes and the way they can be nested.
|
||||
Unlike many other editors, Tiptap is based on a [schema](https://prosemirror.net/docs/guide/#schema) that defines how your content is structured. That enables you to define the kind of nodes that may occur in the document, its attributes and the way they can be nested.
|
||||
|
||||
This schema is *very* strict. You can’t use any HTML element or attribute that is not defined in your schema.
|
||||
|
||||
Let me give you one example: If you paste something like `This is <strong>important</strong>` into tiptap, but don’t have any extension that handles `strong` tags, you’ll only see `This is important` – without the strong tags.
|
||||
Let me give you one example: If you paste something like `This is <strong>important</strong>` into Tiptap, but don’t have any extension that handles `strong` tags, you’ll only see `This is important` – without the strong tags.
|
||||
|
||||
## How a schema looks like
|
||||
When you’ll work with the provided extensions only, you don’t have to care that much about the schema. If you’re building your own extensions, it’s probably helpful to understand how the schema works. Let’s look at the most simple schema for a typical ProseMirror editor:
|
||||
@@ -36,10 +36,10 @@ When you’ll work with the provided extensions only, you don’t have to care t
|
||||
|
||||
We register three nodes here. `doc`, `paragraph` and `text`. `doc` is the root node which allows one or more block nodes as children (`content: 'block+'`). Since `paragraph` is in the group of block nodes (`group: 'block'`) our document can only contain paragraphs. Our paragraphs allow zero or more inline nodes as children (`content: 'inline*'`) so there can only be `text` in it. `parseDOM` defines how a node can be parsed from pasted HTML. `toDOM` defines how it will be rendered in the DOM.
|
||||
|
||||
In tiptap every node, mark and extension is living in its own file. This allows us to split the logic. Under the hood the whole schema will be merged together:
|
||||
In Tiptap every node, mark and extension is living in its own file. This allows us to split the logic. Under the hood the whole schema will be merged together:
|
||||
|
||||
```js
|
||||
// the tiptap schema API
|
||||
// the Tiptap schema API
|
||||
import { Node } from '@tiptap/core'
|
||||
|
||||
const Document = Node.create({
|
||||
@@ -294,7 +294,7 @@ Mark.create({
|
||||
```
|
||||
|
||||
## Get the underlying ProseMirror schema
|
||||
There are a few use cases where you need to work with the underlying schema. You’ll need that if you’re using the tiptap collaborative text editing features or if you want to manually render your content as HTML.
|
||||
There are a few use cases where you need to work with the underlying schema. You’ll need that if you’re using the Tiptap collaborative text editing features or if you want to manually render your content as HTML.
|
||||
|
||||
### Option 1: With an Editor
|
||||
If you need this on the client side and need an editor instance anyway, it’s available through the editor:
|
||||
|
||||
Reference in New Issue
Block a user