Merge branch 'main' of github.com:ueberdosis/tiptap-next into main

This commit is contained in:
Hans Pagel
2021-03-10 20:58:14 +01:00
5 changed files with 141 additions and 127 deletions

View File

@@ -30,7 +30,7 @@ import TaskItem from '@tiptap/extension-task-item'
import Highlight from '@tiptap/extension-highlight'
import * as Y from 'yjs'
import { WebsocketProvider } from 'y-websocket'
import { IndexeddbPersistence } from 'y-indexeddb'
// import { IndexeddbPersistence } from 'y-indexeddb'
import MenuBar from './MenuBar.vue'
const CustomTaskItem = TaskItem.extend({
@@ -70,7 +70,7 @@ export default {
window.ydoc = ydoc
this.indexdb = new IndexeddbPersistence('tiptap-collaboration-example', ydoc)
// this.indexdb = new IndexeddbPersistence('tiptap-collaboration-example', ydoc)
this.editor = new Editor({
extensions: [

View File

@@ -10,22 +10,25 @@ You can define your event listeners on a new editor instance right-away:
```js
const editor = new Editor({
onCreate() {
onCreate({ editor }) {
// The editor is ready.
},
onUpdate() {
onUpdate({ editor }) {
// The content has changed.
},
onSelection() {
onSelectionUpdate({ editor }) {
// The selection has changed.
},
onTransaction({ transaction }) {
onViewUpdate({ editor }) {
// The view has changed.
},
onTransaction({ editor, transaction }) {
// The editor state has changed.
},
onFocus({ event }) {
onFocus({ editor, event }) {
// The editor is focused.
},
onBlur({ event }) {
onBlur({ editor, event }) {
// The editor isnt focused anymore.
},
onDestroy() {
@@ -39,31 +42,31 @@ Or you can register your event listeners on a running editor instance:
### Bind event listeners
```js
editor.on('create', () => {
editor.on('create', ({ editor }) => {
// The editor is ready.
}
editor.on('update', () => {
editor.on('update', ({ editor }) => {
// The content has changed.
}
editor.on('selectionUpdate', () => {
editor.on('selectionUpdate', ({ editor }) => {
// The selection has changed.
}
editor.on('viewUpdate', () => {
editor.on('viewUpdate', ({ editor }) => {
// The view has changed.
}
editor.on('transaction', ({ transaction }) => {
editor.on('transaction', ({ editor, transaction }) => {
// The editor state has changed.
}
editor.on('focus', ({ event }) => {
editor.on('focus', ({ editor, event }) => {
// The editor is focused.
}
editor.on('blur', ({ event }) => {
editor.on('blur', ({ editor, event }) => {
// The editor isnt focused anymore.
}
@@ -94,22 +97,25 @@ Moving your event listeners to custom extensions (or nodes, or marks) is also po
import { Extension } from '@tiptap/core'
const CustomExtension = Extension.create({
onCreate() {
onCreate({ editor }) {
// The editor is ready.
},
onUpdate() {
onUpdate({ editor }) {
// The content has changed.
},
onSelection() {
onSelectionUpdate({ editor }) {
// The selection has changed.
},
onTransaction({ transaction }) {
onViewUpdate({ editor }) {
// The view has changed.
},
onTransaction({ editor, transaction }) {
// The editor state has changed.
},
onFocus({ event }) {
onFocus({ editor, event }) {
// The editor is focused.
},
onBlur({ event }) {
onBlur({ editor, event }) {
// The editor isnt focused anymore.
},
onDestroy() {