Skip to content

There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.

fix iframe will take away the focus

DiamondThree6f340adf243e
diff --git a/libs/components/editor-core/src/recast-block/view.ts b/libs/components/editor-core/src/recast-block/view.ts
index 4386c83918..89b32488ea 100644
--- a/libs/components/editor-core/src/recast-block/view.ts
+++ b/libs/components/editor-core/src/recast-block/view.ts
@@ -61,10 +61,15 @@ export const useLazyIframe = (
iframe.src = link;
iframe.onload = () => {
setTimeout(() => {
+ // Prevent iframe from scrolling parent container
+ // TODO W3C https://github.com/w3c/csswg-drafts/issues/7134
+ // https://forum.figma.com/t/prevent-figmas-embed-code-from-automatically-scrolling-to-it-on-page-load/26029/6
setIframeShow(true);
}, timers);
};
- container.current.appendChild(iframe);
+ if (container?.current) {
+ container.current.appendChild(iframe);
+ }
return () => {
iframe.remove();
};