Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

editor: fix image size resetting on opening new tab

Abdullah Atta6836d6551f69
diff --git a/packages/editor/src/extensions/image/component.tsx b/packages/editor/src/extensions/image/component.tsx
index d49498a15..59f5ad86d 100644
--- a/packages/editor/src/extensions/image/component.tsx
+++ b/packages/editor/src/extensions/image/component.tsx
@@ -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;