Copy and paste as well as dragging files added
This commit is contained in:
@@ -24,6 +24,17 @@ export const CustomImage = Image.extend({
|
||||
};
|
||||
},
|
||||
|
||||
addCommands() {
|
||||
return {
|
||||
setImage: (options: { src: string, alt?: string, title?: string, filename?: string }) => ({ commands }) => {
|
||||
return commands.insertContent({
|
||||
type: this.name,
|
||||
attrs: options,
|
||||
});
|
||||
},
|
||||
};
|
||||
},
|
||||
|
||||
addNodeView() {
|
||||
return ({ node, getPos, editor }) => {
|
||||
const wrapper = document.createElement('div');
|
||||
@@ -76,10 +87,14 @@ export const CustomImage = Image.extend({
|
||||
},
|
||||
});
|
||||
|
||||
import type { SetImageOptions } from "@tiptap/extension-image";
|
||||
|
||||
declare module '@tiptap/core' {
|
||||
interface Commands<ReturnType> {
|
||||
image: {
|
||||
setImage: (options: { src: string, alt?: string, title?: string, filename?: string }) => ReturnType;
|
||||
// @ts-ignore
|
||||
setImage: (options: SetImageOptions & { filename?: string }) => ReturnType;
|
||||
};
|
||||
}
|
||||
}
|
||||
// @ts-ignore
|
||||
|
||||
Reference in New Issue
Block a user