editor: fix image size resetting on opening new tab

This commit is contained in:
Abdullah Atta
2024-04-03 16:05:03 +05:00
parent 8e07ae8b26
commit 6836d6551f

View File

@@ -61,7 +61,10 @@ export function ImageComponent(
threshold: 0.2,
once: true
});
const size = clampSize(node.attrs, editor.view.dom.clientWidth, aspectRatio);
const size =
editor.view.dom.clientWidth === 0
? node.attrs
: clampSize(node.attrs, editor.view.dom.clientWidth, aspectRatio);
const float = isMobile ? false : node.attrs.float;