improve a few pages
This commit is contained in:
@@ -1,8 +1,8 @@
|
|||||||
# Contributing
|
# Contributing
|
||||||
|
|
||||||
Tiptap would be nothing, without its lively community. Contributions have always been and will always be welcome. Here is a little bit you should know, before you send your contributions:
|
Tiptap would be nothing without its lively community. Contributions have always been and will always be welcome. Here is a little bit you should know, before you send your contribution:
|
||||||
|
|
||||||
## What kind of contributions are welcome
|
## Examples
|
||||||
|
|
||||||
* Improved documentation, e. g. fixing typos, new sections, further explanation …)
|
* Improved documentation, e. g. fixing typos, new sections, further explanation …)
|
||||||
* New features for existing extensions, e. g. a new option
|
* New features for existing extensions, e. g. a new option
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ You’re free to use tiptap with the framework of your choice. Depending on what
|
|||||||
|
|
||||||
## Option 1: Vanilla JavaScript
|
## Option 1: Vanilla JavaScript
|
||||||
|
|
||||||
Use tiptap with vanilla JavaScript for a very lightweight and raw experience. If you feel like it, you can even use it to connect the tiptap core with other frameworks (Svelte 👋) not mentioned here.
|
Use tiptap with vanilla JavaScript for a very lightweight and raw experience. If you feel like it, you can even use it to connect tiptap with other frameworks not mentioned here.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# With npm
|
# With npm
|
||||||
|
|||||||
@@ -1,19 +1,20 @@
|
|||||||
# Upgrade Guide
|
# Upgrade Guide
|
||||||
|
|
||||||
## Reasons to upgrade to tiptap 2.x
|
## Reasons to upgrade to tiptap 2.x
|
||||||
* autocomplete in your IDE (thanks to TypeScript)
|
Yes, it’s tedious work to upgrade your favorite text editor to a new API, but we made sure you’ve got enough reasons to upgrade to the newest version
|
||||||
* an amazing documentation with 100+ pages
|
|
||||||
* active development, new features in the making
|
* Autocomplete in your IDE (thanks to TypeScript)
|
||||||
* tons of new extensions planned
|
* Amazing documentation with 100+ pages
|
||||||
* well-tested code base
|
* Active development, new features in the making
|
||||||
|
* Tons of new extensions planned
|
||||||
|
* Well-tested code base
|
||||||
|
|
||||||
## Upgrading from 1.x to 2.x
|
## Upgrading from 1.x to 2.x
|
||||||
|
|
||||||
The new API will look pretty familiar too you, but there are a ton of changes though. To make the upgrade a little bit easier, here is everything you need to know:
|
The new API will look pretty familiar too you, but there are a ton of changes though. To make the upgrade a little bit easier, here is everything you need to know:
|
||||||
|
|
||||||
### 1. Explicitly register the Document, Text and Paragraph extensions
|
### 1. 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`. Be sure to explicitly import the [Document](/api/extensions/document), [Paragraph](/api/extensions/paragraph) and [Text](/api/extensions/text) 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/extensions/document), [Paragraph](/api/extensions/paragraph) and [Text](/api/extensions/text) extensions.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
import Document from '@tiptap/extension-document'
|
import Document from '@tiptap/extension-document'
|
||||||
@@ -25,18 +26,19 @@ new Editor({
|
|||||||
Document(),
|
Document(),
|
||||||
Paragraph(),
|
Paragraph(),
|
||||||
Text(),
|
Text(),
|
||||||
…
|
// all your other extensions
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
```
|
```
|
||||||
|
|
||||||
The `useBuiltInExtensions` setting has been removed.
|
|
||||||
|
|
||||||
### 2. New document type
|
### 2. 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.
|
**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.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
import Document from '@tiptap/extension-document'
|
import Document from '@tiptap/extension-document'
|
||||||
|
|
||||||
const CustomDocument = Document.name('doc').create()
|
const CustomDocument = Document.name('doc').create()
|
||||||
|
|
||||||
new Editor({
|
new Editor({
|
||||||
@@ -48,13 +50,36 @@ new Editor({
|
|||||||
```
|
```
|
||||||
|
|
||||||
### 3. New extension API
|
### 3. 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.
|
||||||
In case you’ve built some custom extensions for your project, you’ll need to rewrite them to fit the new API. No worries, though, you can keep a lot of your work though. The schema, commands, keys, inputRules, pasteRules all work like they did before. It’s just different how you register them.
|
|
||||||
|
|
||||||
```js
|
```js
|
||||||
const CustomExtension = …
|
import { Node } from '@tiptap/core'
|
||||||
|
|
||||||
|
const CustomExtension = new Node()
|
||||||
|
.name('custom_extension')
|
||||||
|
.defaults({
|
||||||
|
// …
|
||||||
|
})
|
||||||
|
.schema(() => ({
|
||||||
|
// …
|
||||||
|
}))
|
||||||
|
.commands(({ editor, name }) => ({
|
||||||
|
// …
|
||||||
|
}))
|
||||||
|
.keys(({ editor }) => ({
|
||||||
|
// …
|
||||||
|
}))
|
||||||
|
.inputRules(({ type }) => [
|
||||||
|
// …
|
||||||
|
])
|
||||||
|
.pasteRules(({ type }) => [
|
||||||
|
// …
|
||||||
|
])
|
||||||
|
.create()
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Don’t forget to call `create()` in the end! Read more about [all the nifty details building custom extensions](/guide/custom-extensions) in our guide.
|
||||||
|
|
||||||
### 4. Blockquotes must not be nested anymore
|
### 4. Blockquotes must not be nested anymore
|
||||||
|
|
||||||
:::warning Breaking Change
|
:::warning Breaking Change
|
||||||
|
|||||||
Reference in New Issue
Block a user