add Commands interface
This commit is contained in:
@@ -27,9 +27,3 @@ export const ColorHighlighter = Extension.create({
|
||||
]
|
||||
},
|
||||
})
|
||||
|
||||
declare module '@tiptap/core' {
|
||||
interface AllExtensions {
|
||||
ColorHighlighter: typeof ColorHighlighter,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,13 @@ export interface AnnotationOptions {
|
||||
onUpdate: (items: [any?]) => {},
|
||||
}
|
||||
|
||||
declare module '@tiptap/core' {
|
||||
interface Commands {
|
||||
addAnnotation: (content: any) => Command,
|
||||
deleteAnnotation: (id: number) => Command,
|
||||
}
|
||||
}
|
||||
|
||||
export const Annotation = Extension.create({
|
||||
name: 'annotation',
|
||||
|
||||
@@ -25,7 +32,7 @@ export const Annotation = Extension.create({
|
||||
|
||||
addCommands() {
|
||||
return {
|
||||
addAnnotation: (content: any): Command => ({ dispatch, state }) => {
|
||||
addAnnotation: (content: any) => ({ dispatch, state }) => {
|
||||
const { selection } = state
|
||||
|
||||
if (selection.empty) {
|
||||
@@ -46,7 +53,7 @@ export const Annotation = Extension.create({
|
||||
|
||||
return true
|
||||
},
|
||||
deleteAnnotation: (id: number): Command => ({ dispatch, state }) => {
|
||||
deleteAnnotation: (id: number) => ({ dispatch, state }) => {
|
||||
if (dispatch) {
|
||||
dispatch(state.tr.setMeta(AnnotationPluginKey, { type: 'deleteAnnotation', id }))
|
||||
}
|
||||
@@ -62,9 +69,3 @@ export const Annotation = Extension.create({
|
||||
]
|
||||
},
|
||||
})
|
||||
|
||||
declare module '@tiptap/core' {
|
||||
interface AllExtensions {
|
||||
Annotation: typeof Annotation,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,9 +60,3 @@ export const Color = Extension.create({
|
||||
]
|
||||
},
|
||||
})
|
||||
|
||||
declare module '@tiptap/core' {
|
||||
interface AllExtensions {
|
||||
Color: typeof Color,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,12 @@ export interface IframeOptions {
|
||||
},
|
||||
}
|
||||
|
||||
declare module '@tiptap/core' {
|
||||
interface Commands {
|
||||
setIframe: (options: { src: string }) => Command,
|
||||
}
|
||||
}
|
||||
|
||||
export default Node.create({
|
||||
name: 'iframe',
|
||||
|
||||
@@ -55,7 +61,7 @@ export default Node.create({
|
||||
/**
|
||||
* Add an iframe
|
||||
*/
|
||||
setIframe: (options: { src: string }): Command => ({ tr, dispatch }) => {
|
||||
setIframe: (options: { src: string }) => ({ tr, dispatch }) => {
|
||||
const { selection } = tr
|
||||
const node = this.type.create(options)
|
||||
|
||||
|
||||
@@ -90,9 +90,3 @@ export const Linter = Extension.create({
|
||||
]
|
||||
},
|
||||
})
|
||||
|
||||
declare module '@tiptap/core' {
|
||||
interface AllExtensions {
|
||||
Linter: typeof Linter,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user