Skip to content

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

editor: fix extra padding around image

Abdullah Attad68c3269d3a1
diff --git a/packages/editor/src/extensions/image/component.tsx b/packages/editor/src/extensions/image/component.tsx
index 748930ba9..63e6d3b07 100644
--- a/packages/editor/src/extensions/image/component.tsx
+++ b/packages/editor/src/extensions/image/component.tsx
@@ -61,10 +61,12 @@ export function ImageComponent(
threshold: 0.2,
once: true
});
+
+ const dom = editor.view.dom.parentElement || editor.view.dom;
const size =
editor.view.dom.clientWidth === 0
? node.attrs
- : clampSize(node.attrs, editor.view.dom.clientWidth, aspectRatio);
+ : clampSize(node.attrs, dom.clientWidth, aspectRatio);
const float = isMobile ? false : node.attrs.float;