diff --git a/docs/src/docPages/overview/upgrade-guide.md b/docs/src/docPages/overview/upgrade-guide.md index 8cd1a0e5..98a7be1b 100644 --- a/docs/src/docPages/overview/upgrade-guide.md +++ b/docs/src/docPages/overview/upgrade-guide.md @@ -35,8 +35,6 @@ We’re [waiting for Gridsome](https://github.com/gridsome/gridsome/issues/1289) ### Explicitly register the Document, Text and Paragraph extensions tiptap 1 tried to hide a few required extensions from you with the default setting `useBuiltInExtensions: true`. That setting has been removed and you’re required to import all extensions. Be sure to explicitly import at least the [Document](/api/nodes/document), [Paragraph](/api/nodes/paragraph) and [Text](/api/nodes/text) extensions. -TODO: removed dropCursor, enableDropCursor, enableGapCursor - ```js import Document from '@tiptap/extension-document' import Paragraph from '@tiptap/extension-paragraph' @@ -52,11 +50,13 @@ 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. + ### New document type ~~**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.~~ ### Removed methods -TODO: state() +We removed the `.state()` method. No worries though, it’s still available through `editor.state`. ### New extension API In case you’ve built some custom extensions for your project, you’re required to rewrite them to fit the new API. No worries, you can keep a lot of your work though. The `schema`, `commands`, `keys`, `inputRules` and `pasteRules` all work like they did before. It’s just different how you register them. @@ -100,6 +100,30 @@ Read more about [all the nifty details building custom extensions](/guide/build- | --------------- | ----------- | | ~~`autoFocus`~~ | `autofocus` | +### 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. + +| Old name | New name | +| ------------------------ | ------------------------- | +| ~~`.blockquote()`~~ | `.toggleBlockquote()` | +| ~~`.bold()`~~ | `.toggleBold()` | +| ~~`.bullet_list()`~~ | `.toggleBulletList()` | +| ~~`.code()`~~ | `.toggleCode()` | +| ~~`.code_block()`~~ | `.toggleCodeBlock()` | +| ~~`.hard_break()`~~ | `.toggleHardBreak()` | +| ~~`.heading()`~~ | `.toggleHeading()` | +| ~~`.horizontal_rule()`~~ | `.toggleHorizontalRule()` | +| ~~`.italic()`~~ | `.toggleItalic()` | +| ~~`.link()`~~ | `.toggleLink()` | +| ~~`.ordered_list()`~~ | `.toggleOrderedList()` | +| ~~`.paragraph()`~~ | `.toggleParagraph()` | +| ~~`.redo()`~~ | `.toggleRedo()` | +| ~~`.strike()`~~ | `.toggleStrike()` | +| ~~`.todo_list()`~~ | `.toggleTaskList()` | +| ~~`.underline()`~~ | `.toggleUnderline()` | +| ~~`.undo()`~~ | `.toggleUndo()` | +| … | … | + ### 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: