diff --git a/apps/client/src/features/editor/components/video/video-view.module.css b/apps/client/src/features/editor/components/video/video-view.module.css index c0e7f99d..8d1d28c2 100644 --- a/apps/client/src/features/editor/components/video/video-view.module.css +++ b/apps/client/src/features/editor/components/video/video-view.module.css @@ -2,6 +2,7 @@ display: flex; justify-content: center; align-items: center; + max-width: 100%; border-radius: 8px; overflow: hidden; animation: pulse 1.2s ease-in-out infinite; diff --git a/packages/editor-ext/src/lib/drawio.ts b/packages/editor-ext/src/lib/drawio.ts index 3705032c..809c4eda 100644 --- a/packages/editor-ext/src/lib/drawio.ts +++ b/packages/editor-ext/src/lib/drawio.ts @@ -318,12 +318,16 @@ export const Drawio = Node.create({ }); } - // Hide until image loads - dom.style.visibility = "hidden"; + // Show skeleton background while image loads from server dom.style.pointerEvents = "none"; + dom.style.overflow = "hidden"; + dom.style.borderRadius = "8px"; + dom.style.background = + "light-dark(var(--mantine-color-gray-2), var(--mantine-color-dark-6))"; + el.onload = () => { - dom.style.visibility = ""; dom.style.pointerEvents = ""; + dom.style.background = ""; }; return nodeView; diff --git a/packages/editor-ext/src/lib/excalidraw.ts b/packages/editor-ext/src/lib/excalidraw.ts index 51d78362..5edc7b73 100644 --- a/packages/editor-ext/src/lib/excalidraw.ts +++ b/packages/editor-ext/src/lib/excalidraw.ts @@ -318,12 +318,16 @@ export const Excalidraw = Node.create({ }); } - // Hide until image loads - dom.style.visibility = "hidden"; + // Show skeleton background while image loads from server dom.style.pointerEvents = "none"; + dom.style.overflow = "hidden"; + dom.style.borderRadius = "8px"; + dom.style.background = + "light-dark(var(--mantine-color-gray-2), var(--mantine-color-dark-6))"; + el.onload = () => { - dom.style.visibility = ""; dom.style.pointerEvents = ""; + dom.style.background = ""; }; return nodeView; diff --git a/packages/editor-ext/src/lib/video/video.ts b/packages/editor-ext/src/lib/video/video.ts index 9025377e..44fbea56 100644 --- a/packages/editor-ext/src/lib/video/video.ts +++ b/packages/editor-ext/src/lib/video/video.ts @@ -231,6 +231,13 @@ export const TiptapVideo = Node.create({ el.style.maxWidth = "100%"; el.style.borderRadius = "8px"; + if (typeof node.attrs.width === "number" && node.attrs.width > 0) { + el.style.width = `${node.attrs.width}px`; + if (typeof node.attrs.height === "number" && node.attrs.height > 0) { + el.style.height = `${node.attrs.height}px`; + } + } + let currentNode = node; const nodeView = new ResizableNodeView({ @@ -319,12 +326,16 @@ export const TiptapVideo = Node.create({ }); } - // Hide until video metadata loads - dom.style.visibility = "hidden"; + // Show skeleton background while video loads from server dom.style.pointerEvents = "none"; + dom.style.overflow = "hidden"; + dom.style.borderRadius = "8px"; + dom.style.background = + "light-dark(var(--mantine-color-gray-2), var(--mantine-color-dark-6))"; + el.onloadedmetadata = () => { - dom.style.visibility = ""; dom.style.pointerEvents = ""; + dom.style.background = ""; }; return nodeView;