mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 04:18:54 +00:00
fix iframe will take away the focus
This commit is contained in:
@@ -61,10 +61,15 @@ export const useLazyIframe = (
|
|||||||
iframe.src = link;
|
iframe.src = link;
|
||||||
iframe.onload = () => {
|
iframe.onload = () => {
|
||||||
setTimeout(() => {
|
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);
|
setIframeShow(true);
|
||||||
}, timers);
|
}, timers);
|
||||||
};
|
};
|
||||||
|
if (container?.current) {
|
||||||
container.current.appendChild(iframe);
|
container.current.appendChild(iframe);
|
||||||
|
}
|
||||||
return () => {
|
return () => {
|
||||||
iframe.remove();
|
iframe.remove();
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user