mirror of
https://github.com/ueberdosis/tiptap.git
synced 2024-12-28 03:47:50 +08:00
40 lines
690 B
TypeScript
40 lines
690 B
TypeScript
import { createExtension } from '@tiptap/core'
|
|
import {
|
|
redo, undo, ySyncPlugin, yUndoPlugin,
|
|
} from 'y-prosemirror'
|
|
|
|
export interface CollaborationOptions {
|
|
provider: any,
|
|
type: any,
|
|
}
|
|
|
|
const Collaboration = createExtension({
|
|
defaultOptions: <CollaborationOptions>{
|
|
provider: null,
|
|
type: null,
|
|
},
|
|
|
|
addProseMirrorPlugins() {
|
|
return [
|
|
ySyncPlugin(this.options.type),
|
|
yUndoPlugin(),
|
|
]
|
|
},
|
|
|
|
addKeyboardShortcuts() {
|
|
return {
|
|
'Mod-z': undo,
|
|
'Mod-y': redo,
|
|
'Mod-Shift-z': redo,
|
|
}
|
|
},
|
|
})
|
|
|
|
export default Collaboration
|
|
|
|
declare module '@tiptap/core' {
|
|
interface AllExtensions {
|
|
Collaboration: typeof Collaboration,
|
|
}
|
|
}
|