add old content and a warning to the events page
This commit is contained in:
@@ -1 +1,34 @@
|
|||||||
# Events
|
# Events
|
||||||
|
|
||||||
|
:::warning Out of date
|
||||||
|
This content is written for tiptap 1 and needs an update.
|
||||||
|
:::
|
||||||
|
|
||||||
|
There are some events you can listen for. A full list of events can be found [here](/api/classes.md#editor-options).
|
||||||
|
|
||||||
|
```js
|
||||||
|
const editor = new Editor({
|
||||||
|
onInit: () => {
|
||||||
|
// editor is initialized
|
||||||
|
},
|
||||||
|
onUpdate: ({ getHTML }) => {
|
||||||
|
// get new content on update
|
||||||
|
const newContent = getHTML()
|
||||||
|
},
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
|
It's also possible to register event listeners afterwards.
|
||||||
|
|
||||||
|
```js
|
||||||
|
const editor = new Editor(…)
|
||||||
|
|
||||||
|
editor.on('init', () => {
|
||||||
|
// editor is initialized
|
||||||
|
})
|
||||||
|
|
||||||
|
editor.on('update', ({ getHTML }) => {
|
||||||
|
// get new content on update
|
||||||
|
const newContent = getHTML()
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|||||||
Reference in New Issue
Block a user