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(selection): iframe slow selection

zhangchi101449dd3768
diff --git a/libs/components/editor-blocks/src/components/source-view/SourceView.tsx b/libs/components/editor-blocks/src/components/source-view/SourceView.tsx
index c044c117a0..47d06564f6 100644
--- a/libs/components/editor-blocks/src/components/source-view/SourceView.tsx
+++ b/libs/components/editor-blocks/src/components/source-view/SourceView.tsx
@@ -8,7 +8,15 @@ import { formatUrl } from './format-url';
import { SCENE_CONFIG } from '../../blocks/group/config';
import { services } from '@toeverything/datasource/db-service';
import { debounce } from '@toeverything/utils';
-
+const MouseMaskContainer = styled('div')({
+ position: 'absolute',
+ zIndex: 1,
+ top: '0px',
+ left: '0px',
+ right: '0px',
+ bottom: '0px',
+ backgroundColor: 'transparent',
+});
export interface Props {
block: AsyncBlock;
editorElement?: () => JSX.Element;
@@ -149,6 +157,7 @@ export const SourceView: FC<Props> = props => {
const { link, isSelected, block, editorElement } = props;
const { scene } = useRecastBlockScene();
const src = formatUrl(link);
+
if (src?.startsWith('http')) {
return (
<div
@@ -161,7 +170,9 @@ export const SourceView: FC<Props> = props => {
src={src}
frameBorder="0"
allowFullScreen
+ sandbox="allow-scripts allow-popups allow-top-navigation-by-user-activation allow-forms allow-same-origin"
/>
+ <MouseMaskContainer />
</SourceViewContainer>
</div>
);