fix(selection): iframe slow selection

This commit is contained in:
zhangchi
2022-07-23 23:20:52 +08:00
parent 48a5f52fb4
commit 101449dd37

View File

@@ -8,7 +8,15 @@ import { formatUrl } from './format-url';
import { SCENE_CONFIG } from '../../blocks/group/config'; import { SCENE_CONFIG } from '../../blocks/group/config';
import { services } from '@toeverything/datasource/db-service'; import { services } from '@toeverything/datasource/db-service';
import { debounce } from '@toeverything/utils'; 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 { export interface Props {
block: AsyncBlock; block: AsyncBlock;
editorElement?: () => JSX.Element; editorElement?: () => JSX.Element;
@@ -149,6 +157,7 @@ export const SourceView: FC<Props> = props => {
const { link, isSelected, block, editorElement } = props; const { link, isSelected, block, editorElement } = props;
const { scene } = useRecastBlockScene(); const { scene } = useRecastBlockScene();
const src = formatUrl(link); const src = formatUrl(link);
if (src?.startsWith('http')) { if (src?.startsWith('http')) {
return ( return (
<div <div
@@ -161,7 +170,9 @@ export const SourceView: FC<Props> = props => {
src={src} src={src}
frameBorder="0" frameBorder="0"
allowFullScreen allowFullScreen
sandbox="allow-scripts allow-popups allow-top-navigation-by-user-activation allow-forms allow-same-origin"
/> />
<MouseMaskContainer />
</SourceViewContainer> </SourceViewContainer>
</div> </div>
); );