import { Node, mergeAttributes } from '@tiptap/core'; import { ReactNodeViewRenderer } from '@tiptap/react'; import ResizableImage from './ResizableImage'; // Import your ResizableImage component const CustomImage = Node.create({ name: 'image', inline: false, group: 'block', draggable: true, addAttributes() { return { src: { default: null, }, alt: { default: null, }, title: { default: null, }, width: { default: 'auto', }, }; }, parseHTML() { return [ { tag: 'img[src]', }, ]; }, renderHTML({ HTMLAttributes }) { return ['img', mergeAttributes(HTMLAttributes)]; }, addNodeView() { return ReactNodeViewRenderer(ResizableImage); }, addCommands() { return { setImage: (options) => ({ commands }) => { return commands.insertContent({ type: this.name, attrs: options, }); }, }; }, }); export default CustomImage;