Follow on twitter
Docs
Image (Extended)

Image (Extended)

Extended image extension for tiptap, adding support for alignment and scaling.

Installation

Run the following command to install the extension & associated toolbar component.

npx shadcn add https://tiptap.niazmorshed.dev/r/image.json

Copy & paste the following code in your @lib/utils.ts file.

export const NODE_HANDLES_SELECTED_STYLE_CLASSNAME = "node-handles-selected-style";
 
export function isValidUrl(url: string) {
	return /^https?:\/\/\S+$/.test(url);
}

Usage

const extensions = [
	StarterKit.configure({
		// ...
	}),
	ImageExtension,
	ImagePlaceholder,
];
 
const editor = useEditor({
	extensions,
});