mirror of
https://github.com/ueberdosis/tiptap.git
synced 2025-01-18 14:13:21 +08:00
docs: update content
This commit is contained in:
parent
5cba127d78
commit
dbeb426aec
@ -52,8 +52,29 @@ new Editor({
|
|||||||
|
|
||||||
And we removed some settings: `dropCursor`, `enableDropCursor`, and `enableGapCursor`. Those are separate extensions now: [`Dropcursor`](/api/extensions/dropcursor) and [`Gapcursor`](/api/extensions/gapcursor). You probably want to load them, but if you don’t just ignore me.
|
And we removed some settings: `dropCursor`, `enableDropCursor`, and `enableGapCursor`. Those are separate extensions now: [`Dropcursor`](/api/extensions/dropcursor) and [`Gapcursor`](/api/extensions/gapcursor). You probably want to load them, but if you don’t just ignore me.
|
||||||
|
|
||||||
### New document type
|
### New names for most extensions
|
||||||
~~**We renamed the default `Document` type from `doc` to `document`.** To keep it like that, use your own implementation of the `Document` node or migrate the stored JSON to use the new name.~~
|
**We renamed the default `Document` type from `doc` to `document`.** To keep it like that, use your own implementation of the `Document` node or migrate the stored JSON to use the new name.
|
||||||
|
|
||||||
|
Also, we switched to lowerCamelCase, so there’s a lot that changed. If you stored your content as JSON you need to loop through it and rename a lot of types. Sorry for that one.
|
||||||
|
|
||||||
|
| Old type | New type |
|
||||||
|
| --------------------- | ---------------------- |
|
||||||
|
| ~~`blockquote`~~ | `blockquote` |
|
||||||
|
| ~~`bold`~~ | `bold` |
|
||||||
|
| ~~`bullet_list`~~ | `bulletList` |
|
||||||
|
| ~~`code`~~ | `code` |
|
||||||
|
| ~~`code_block`~~ | `codeBlock` |
|
||||||
|
| ~~`hard_break`~~ | `hardBreak` |
|
||||||
|
| ~~`heading`~~ | `heading` |
|
||||||
|
| ~~`horizontal_rule`~~ | `horizontalRule` |
|
||||||
|
| ~~`italic`~~ | `italic` |
|
||||||
|
| ~~`link`~~ | `link` |
|
||||||
|
| ~~`ordered_list`~~ | `orderedList` |
|
||||||
|
| ~~`paragraph`~~ | `paragraph` |
|
||||||
|
| ~~`strike`~~ | `strike` |
|
||||||
|
| ~~`todo_list`~~ | `taskList` (new name!) |
|
||||||
|
| ~~`underline`~~ | `underline` |
|
||||||
|
| … | … |
|
||||||
|
|
||||||
### Removed methods
|
### Removed methods
|
||||||
We removed the `.state()` method. No worries though, it’s still available through `editor.state`.
|
We removed the `.state()` method. No worries though, it’s still available through `editor.state`.
|
||||||
@ -103,26 +124,26 @@ Read more about [all the nifty details building custom extensions](/guide/build-
|
|||||||
### Renamed commands
|
### Renamed commands
|
||||||
All new extensions come with specific commands to set, unset and toggle styles. So instead of `.bold()`, it’s now `.toggleBold()`. Also, we switched to lowerCamelCase, below are a few examples. Oh, and we renamed `todo_list`, to `taskList`, sorry for that one.
|
All new extensions come with specific commands to set, unset and toggle styles. So instead of `.bold()`, it’s now `.toggleBold()`. Also, we switched to lowerCamelCase, below are a few examples. Oh, and we renamed `todo_list`, to `taskList`, sorry for that one.
|
||||||
|
|
||||||
| Old name | New name |
|
| Old command | New command |
|
||||||
| ------------------------ | ------------------------- |
|
| ------------------------ | ------------------------------- |
|
||||||
| ~~`.blockquote()`~~ | `.toggleBlockquote()` |
|
| `.redo()` | `.redo()` (nothing changed) |
|
||||||
| ~~`.bold()`~~ | `.toggleBold()` |
|
| `.undo()` | `.undo()` (nothing changed) |
|
||||||
| ~~`.bullet_list()`~~ | `.toggleBulletList()` |
|
| ~~`.todo_list()`~~ | `.toggleTaskList()` (new name!) |
|
||||||
| ~~`.code()`~~ | `.toggleCode()` |
|
| ~~`.blockquote()`~~ | `.toggleBlockquote()` |
|
||||||
| ~~`.code_block()`~~ | `.toggleCodeBlock()` |
|
| ~~`.bold()`~~ | `.toggleBold()` |
|
||||||
| ~~`.hard_break()`~~ | `.toggleHardBreak()` |
|
| ~~`.bullet_list()`~~ | `.toggleBulletList()` |
|
||||||
| ~~`.heading()`~~ | `.toggleHeading()` |
|
| ~~`.code()`~~ | `.toggleCode()` |
|
||||||
| ~~`.horizontal_rule()`~~ | `.toggleHorizontalRule()` |
|
| ~~`.code_block()`~~ | `.toggleCodeBlock()` |
|
||||||
| ~~`.italic()`~~ | `.toggleItalic()` |
|
| ~~`.hard_break()`~~ | `.toggleHardBreak()` |
|
||||||
| ~~`.link()`~~ | `.toggleLink()` |
|
| ~~`.heading()`~~ | `.toggleHeading()` |
|
||||||
| ~~`.ordered_list()`~~ | `.toggleOrderedList()` |
|
| ~~`.horizontal_rule()`~~ | `.toggleHorizontalRule()` |
|
||||||
| ~~`.paragraph()`~~ | `.toggleParagraph()` |
|
| ~~`.italic()`~~ | `.toggleItalic()` |
|
||||||
| ~~`.redo()`~~ | `.toggleRedo()` |
|
| ~~`.link()`~~ | `.toggleLink()` |
|
||||||
| ~~`.strike()`~~ | `.toggleStrike()` |
|
| ~~`.ordered_list()`~~ | `.toggleOrderedList()` |
|
||||||
| ~~`.todo_list()`~~ | `.toggleTaskList()` |
|
| ~~`.paragraph()`~~ | `.toggleParagraph()` |
|
||||||
| ~~`.underline()`~~ | `.toggleUnderline()` |
|
| ~~`.strike()`~~ | `.toggleStrike()` |
|
||||||
| ~~`.undo()`~~ | `.toggleUndo()` |
|
| ~~`.underline()`~~ | `.toggleUnderline()` |
|
||||||
| … | … |
|
| … | … |
|
||||||
|
|
||||||
### Commands can be chained now
|
### Commands can be chained now
|
||||||
Most commands can be combined to one call now. That’s shorter than separate function calls in most cases. Here is an example to make the selected text bold:
|
Most commands can be combined to one call now. That’s shorter than separate function calls in most cases. Here is an example to make the selected text bold:
|
||||||
@ -142,6 +163,9 @@ With tiptap 2.x you have to explicitly call the `focus()` and you probably want
|
|||||||
editor.chain().focus().toggleBold().run()
|
editor.chain().focus().toggleBold().run()
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Event callbacks have fewer parameters
|
||||||
|
The new event callbacks have fewer parameters. The same things should be available through `this.` now. [Read more about events here.](/api/events)
|
||||||
|
|
||||||
### Collaborative editing
|
### Collaborative editing
|
||||||
The reference implementation for collaborative editing uses Y.js now. That’s a whole different thing. You still can use the tiptap 1 extension, but it’s up to you to adapt it to the new extension API. If you’ve done this, don’t forget to share it with us so we can link to it from here!
|
The reference implementation for collaborative editing uses Y.js now. That’s a whole different thing. You still can use the tiptap 1 extension, but it’s up to you to adapt it to the new extension API. If you’ve done this, don’t forget to share it with us so we can link to it from here!
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user