add AllExtensions interface

This commit is contained in:
Philipp Kühn
2020-10-22 22:40:40 +02:00
parent 79172753ef
commit 6746163dda
23 changed files with 231 additions and 180 deletions

View File

@@ -8,18 +8,7 @@ export interface CollaborationCursorOptions {
render (user: { name: string, color: string }): HTMLElement,
}
// export type UserCommand = (attributes: {
// name: string,
// color: string,
// }) => Command
// declare module '@tiptap/core/src/Editor' {
// interface Commands {
// user: UserCommand,
// }
// }
export default createExtension({
const CollaborationCursor = createExtension({
name: 'collaboration_cursor',
defaultOptions: <CollaborationCursorOptions>{
@@ -43,7 +32,10 @@ export default createExtension({
addCommands() {
return {
user: attributes => () => {
user: (attributes: {
name: string,
color: string,
}): Command => () => {
this.options.provider.awareness.setLocalStateField('user', attributes)
return true
@@ -68,3 +60,11 @@ export default createExtension({
]
},
})
export default CollaborationCursor
declare module '@tiptap/core/src/Editor' {
interface AllExtensions {
CollaborationCursor: typeof CollaborationCursor,
}
}