add moooore content

This commit is contained in:
Hans Pagel
2020-09-24 18:29:53 +02:00
parent e283ec4399
commit ab64afc249
7 changed files with 127 additions and 5 deletions

View File

@@ -2,14 +2,15 @@
Lets extend tiptap with a custom extension!
## Option 1: Change defaults
Lets say you want to change the keyboard shortcuts for the bullet list. You should start by looking at [the source code of the `Bold` extension](https://github.com/ueberdosis/tiptap-next/blob/main/packages/extension-bold/index.ts) and find the default youd like to change. In that case, the keyboard shortcut.
Lets say you want to change the keyboard shortcuts for the bullet list. You should start by looking at [the source code of the `BulletList` extension](https://github.com/ueberdosis/tiptap-next/blob/main/packages/extension-bullet-list/index.ts) and find the default youd like to change. In that case, the keyboard shortcut, and just that.
```js
// 1. Import the extension
import BulletList from '@tiptap/extension-bullet-list'
// 2. Overwrite the keyboard shortcuts
const CustomBulletList = new Node()
const CustomBulletList = BulletList()
.keys(({ editor }) => ({
'Mod-l': () => editor.bulletList(),
}))
@@ -24,6 +25,8 @@ new Editor({
})
```
You can overwrite every aspect of an existing extension. [Read more about that here.](/guide/custom-extensions/overwrite-defaults)
## Option 2: Extend existing extensions
## Option 3: Start from scratch