mirror of
https://github.com/docmost/docmost.git
synced 2026-05-07 06:23:06 +08:00
fix media
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
max-width: 100%;
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
animation: pulse 1.2s ease-in-out infinite;
|
animation: pulse 1.2s ease-in-out infinite;
|
||||||
|
|||||||
@@ -318,12 +318,16 @@ export const Drawio = Node.create<DrawioOptions>({
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hide until image loads
|
// Show skeleton background while image loads from server
|
||||||
dom.style.visibility = "hidden";
|
|
||||||
dom.style.pointerEvents = "none";
|
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 = () => {
|
el.onload = () => {
|
||||||
dom.style.visibility = "";
|
|
||||||
dom.style.pointerEvents = "";
|
dom.style.pointerEvents = "";
|
||||||
|
dom.style.background = "";
|
||||||
};
|
};
|
||||||
|
|
||||||
return nodeView;
|
return nodeView;
|
||||||
|
|||||||
@@ -318,12 +318,16 @@ export const Excalidraw = Node.create<ExcalidrawOptions>({
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hide until image loads
|
// Show skeleton background while image loads from server
|
||||||
dom.style.visibility = "hidden";
|
|
||||||
dom.style.pointerEvents = "none";
|
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 = () => {
|
el.onload = () => {
|
||||||
dom.style.visibility = "";
|
|
||||||
dom.style.pointerEvents = "";
|
dom.style.pointerEvents = "";
|
||||||
|
dom.style.background = "";
|
||||||
};
|
};
|
||||||
|
|
||||||
return nodeView;
|
return nodeView;
|
||||||
|
|||||||
@@ -231,6 +231,13 @@ export const TiptapVideo = Node.create<VideoOptions>({
|
|||||||
el.style.maxWidth = "100%";
|
el.style.maxWidth = "100%";
|
||||||
el.style.borderRadius = "8px";
|
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;
|
let currentNode = node;
|
||||||
|
|
||||||
const nodeView = new ResizableNodeView({
|
const nodeView = new ResizableNodeView({
|
||||||
@@ -319,12 +326,16 @@ export const TiptapVideo = Node.create<VideoOptions>({
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hide until video metadata loads
|
// Show skeleton background while video loads from server
|
||||||
dom.style.visibility = "hidden";
|
|
||||||
dom.style.pointerEvents = "none";
|
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 = () => {
|
el.onloadedmetadata = () => {
|
||||||
dom.style.visibility = "";
|
|
||||||
dom.style.pointerEvents = "";
|
dom.style.pointerEvents = "";
|
||||||
|
dom.style.background = "";
|
||||||
};
|
};
|
||||||
|
|
||||||
return nodeView;
|
return nodeView;
|
||||||
|
|||||||
Reference in New Issue
Block a user