'use client'; import React from 'react'; import { cn, withRef } from '@udecode/cn'; import { withHOC } from '@udecode/plate-common/react'; import { Image, ImagePlugin, useMediaState } from '@udecode/plate-media/react'; import { ResizableProvider, useResizableStore } from '@udecode/plate-resizable'; import { Caption, CaptionTextarea } from './caption'; import { MediaPopover } from './media-popover'; import { PlateElement } from './plate-element'; import { Resizable, ResizeHandle, mediaResizeHandleVariants, } from './resizable'; export const ImageElement = withHOC( ResizableProvider, withRef( ({ children, className, nodeProps, ...props }, ref) => { const { align = 'center', focused, readOnly, selected } = useMediaState(); const width = useResizableStore().get.width(); return (
{ e.preventDefault(); }} placeholder="Write a caption..." />
{children}
); } ) );