diff --git a/apps/www/src/registry/default/plate-ui/image-element.tsx b/apps/www/src/registry/default/plate-ui/image-element.tsx index d3bd85951f..f6e71dfc93 100644 --- a/apps/www/src/registry/default/plate-ui/image-element.tsx +++ b/apps/www/src/registry/default/plate-ui/image-element.tsx @@ -1,5 +1,10 @@ import React from 'react'; -import { PlateElement, PlateElementProps, Value, withHOC } from '@udecode/plate-common'; +import { + PlateElement, + PlateElementProps, + Value, + withHOC, +} from '@udecode/plate-common'; import { ELEMENT_IMAGE, Image, @@ -18,58 +23,61 @@ import { ResizeHandle, } from './resizable'; -const ImageElement = withHOC(ResizableProvider, ({ - className, - children, - nodeProps, - ...props -}: PlateElementProps) => { - const { readOnly, focused, selected, align = 'center' } = useMediaState(); - const width = useResizableStore().get.width(); +const ImageElement = withHOC( + ResizableProvider, + ({ + className, + children, + nodeProps, + ...props + }: PlateElementProps) => { + const { readOnly, focused, selected, align = 'center' } = useMediaState(); + const width = useResizableStore().get.width(); - return ( - - -
- - - - - + return ( + + +
+ + + + + - - - -
+ + + +
- {children} -
-
- ); -}); + {children} + + + ); + } +); ImageElement.displayName = 'ImageElement'; export { ImageElement }; diff --git a/apps/www/src/registry/default/plate-ui/media-embed-element.tsx b/apps/www/src/registry/default/plate-ui/media-embed-element.tsx index a32f0238b1..470aa5e050 100644 --- a/apps/www/src/registry/default/plate-ui/media-embed-element.tsx +++ b/apps/www/src/registry/default/plate-ui/media-embed-element.tsx @@ -1,5 +1,10 @@ import React from 'react'; -import { PlateElement, PlateElementProps, Value, withHOC } from '@udecode/plate-common'; +import { + PlateElement, + PlateElementProps, + Value, + withHOC, +} from '@udecode/plate-common'; import { ELEMENT_MEDIA_EMBED, parseTwitterUrl, @@ -21,121 +26,125 @@ import { ResizeHandle, } from './resizable'; -const MediaEmbedElement = withHOC(ResizableProvider, React.forwardRef< - React.ElementRef, - PlateElementProps ->(({ className, children, ...props }, ref) => { - const { - align = 'center', - focused, - readOnly, - selected, - embed, - isTweet, - isVideo, - isYoutube, - } = useMediaState({ - urlParsers: [parseTwitterUrl, parseVideoUrl], - }); - const width = useResizableStore().get.width(); - const provider = embed?.provider; +const MediaEmbedElement = withHOC( + ResizableProvider, + // eslint-disable-next-line react/display-name + React.forwardRef< + React.ElementRef, + PlateElementProps + >(({ className, children, ...props }, ref) => { + const { + align = 'center', + focused, + readOnly, + selected, + embed, + isTweet, + isVideo, + isYoutube, + } = useMediaState({ + urlParsers: [parseTwitterUrl, parseVideoUrl], + }); + const width = useResizableStore().get.width(); + const provider = embed?.provider; - return ( - - -
- - + return ( + + +
+ + - {isVideo ? ( - isYoutube ? ( - _iframe]:absolute [&_>_iframe]:left-0 [&_>_iframe]:top-0 [&_>_iframe]:h-full [&_>_iframe]:w-full', - '[&_>_.lty-playbtn]:z-[1] [&_>_.lty-playbtn]:h-[46px] [&_>_.lty-playbtn]:w-[70px] [&_>_.lty-playbtn]:rounded-[14%] [&_>_.lty-playbtn]:bg-[#212121] [&_>_.lty-playbtn]:opacity-80 [&_>_.lty-playbtn]:[transition:all_0.2s_cubic-bezier(0,_0,_0.2,_1)]', - '[&:hover_>_.lty-playbtn]:bg-[red] [&:hover_>_.lty-playbtn]:opacity-100', - '[&_>_.lty-playbtn]:before:border-y-[11px] [&_>_.lty-playbtn]:before:border-l-[19px] [&_>_.lty-playbtn]:before:border-r-0 [&_>_.lty-playbtn]:before:border-[transparent_transparent_transparent_#fff] [&_>_.lty-playbtn]:before:content-[""]', - '[&_>_.lty-playbtn]:absolute [&_>_.lty-playbtn]:left-1/2 [&_>_.lty-playbtn]:top-1/2 [&_>_.lty-playbtn]:[transform:translate3d(-50%,-50%,0)]', - '[&_>_.lty-playbtn]:before:absolute [&_>_.lty-playbtn]:before:left-1/2 [&_>_.lty-playbtn]:before:top-1/2 [&_>_.lty-playbtn]:before:[transform:translate3d(-50%,-50%,0)]', - '[&.lyt-activated]:cursor-[unset]', - '[&.lyt-activated]:before:pointer-events-none [&.lyt-activated]:before:opacity-0', - '[&.lyt-activated_>_.lty-playbtn]:pointer-events-none [&.lyt-activated_>_.lty-playbtn]:!opacity-0' - )} - /> - ) : ( + {isVideo ? ( + isYoutube ? ( + _iframe]:absolute [&_>_iframe]:left-0 [&_>_iframe]:top-0 [&_>_iframe]:h-full [&_>_iframe]:w-full', + '[&_>_.lty-playbtn]:z-[1] [&_>_.lty-playbtn]:h-[46px] [&_>_.lty-playbtn]:w-[70px] [&_>_.lty-playbtn]:rounded-[14%] [&_>_.lty-playbtn]:bg-[#212121] [&_>_.lty-playbtn]:opacity-80 [&_>_.lty-playbtn]:[transition:all_0.2s_cubic-bezier(0,_0,_0.2,_1)]', + '[&:hover_>_.lty-playbtn]:bg-[red] [&:hover_>_.lty-playbtn]:opacity-100', + '[&_>_.lty-playbtn]:before:border-y-[11px] [&_>_.lty-playbtn]:before:border-l-[19px] [&_>_.lty-playbtn]:before:border-r-0 [&_>_.lty-playbtn]:before:border-[transparent_transparent_transparent_#fff] [&_>_.lty-playbtn]:before:content-[""]', + '[&_>_.lty-playbtn]:absolute [&_>_.lty-playbtn]:left-1/2 [&_>_.lty-playbtn]:top-1/2 [&_>_.lty-playbtn]:[transform:translate3d(-50%,-50%,0)]', + '[&_>_.lty-playbtn]:before:absolute [&_>_.lty-playbtn]:before:left-1/2 [&_>_.lty-playbtn]:before:top-1/2 [&_>_.lty-playbtn]:before:[transform:translate3d(-50%,-50%,0)]', + '[&.lyt-activated]:cursor-[unset]', + '[&.lyt-activated]:before:pointer-events-none [&.lyt-activated]:before:opacity-0', + '[&.lyt-activated_>_.lty-playbtn]:pointer-events-none [&.lyt-activated_>_.lty-playbtn]:!opacity-0' + )} + /> + ) : ( +
+