feat: declare module for updated setImage function

This commit is contained in:
Jacob Overgaard
2024-09-18 14:25:04 +02:00
parent e61f4af84c
commit df78ab6d7a

View File

@@ -22,3 +22,28 @@ export const UmbImage = Image.extend({
};
},
});
declare module '@tiptap/core' {
interface Commands<ReturnType> {
umbImage: {
/**
* Add an image
* @param options The image attributes
* @example
* editor
* .commands
* .setImage({ src: 'https://tiptap.dev/logo.png', alt: 'tiptap', title: 'tiptap logo' })
*/
setImage: (options: {
src: string;
alt?: string;
title?: string;
width?: string;
height?: string;
loading?: string;
srcset?: string;
sizes?: string;
}) => ReturnType;
};
}
}