mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-19 23:37:15 +08:00
fix(style) iframe
This commit is contained in:
@@ -61,15 +61,18 @@ const GroupContainer = styled('div')<{ isSelect?: boolean }>(
|
|||||||
({ isSelect, theme }) => ({
|
({ isSelect, theme }) => ({
|
||||||
background: theme.affine.palette.white,
|
background: theme.affine.palette.white,
|
||||||
border: '2px solid #ECF1FB',
|
border: '2px solid #ECF1FB',
|
||||||
boxShadow: isSelect
|
|
||||||
? '0px 0px 5px 5px rgba(98, 137, 255, 0.25), 0px 0px 5px 5px #E3EAFF !important'
|
|
||||||
: '#none',
|
|
||||||
padding: '15px 12px',
|
padding: '15px 12px',
|
||||||
borderRadius: '10px',
|
borderRadius: '10px',
|
||||||
'&:hover': {
|
...(isSelect
|
||||||
// borderColor: 'none',
|
? {
|
||||||
boxShadow: '0px 1px 10px rgb(152 172 189 / 60%)',
|
boxShadow:
|
||||||
},
|
'0px 0px 5px 5px rgba(98, 137, 255, 0.25), 0px 0px 5px 5px #E3EAFF',
|
||||||
|
}
|
||||||
|
: {
|
||||||
|
'&:hover': {
|
||||||
|
boxShadow: '0px 1px 10px rgb(152 172 189 / 60%)',
|
||||||
|
},
|
||||||
|
}),
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -6,18 +6,7 @@ import { AsyncBlock, useRecastBlockScene } from '@toeverything/framework/virgo';
|
|||||||
import { formatUrl } from './format-url';
|
import { formatUrl } from './format-url';
|
||||||
import { SCENE_CONFIG } from '../../blocks/group/config';
|
import { SCENE_CONFIG } from '../../blocks/group/config';
|
||||||
import { BlockPreview } from './BlockView';
|
import { BlockPreview } from './BlockView';
|
||||||
const MouseMaskContainer = styled('div')({
|
|
||||||
position: 'absolute',
|
|
||||||
zIndex: 1,
|
|
||||||
top: '0px',
|
|
||||||
left: '0px',
|
|
||||||
right: '0px',
|
|
||||||
bottom: '0px',
|
|
||||||
backgroundColor: 'transparent',
|
|
||||||
'&:hover': {
|
|
||||||
pointerEvents: 'none',
|
|
||||||
},
|
|
||||||
});
|
|
||||||
export interface Props {
|
export interface Props {
|
||||||
block: AsyncBlock;
|
block: AsyncBlock;
|
||||||
editorElement?: () => JSX.Element;
|
editorElement?: () => JSX.Element;
|
||||||
@@ -44,7 +33,29 @@ const _getLinkStyle = (scene: string) => {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
const getHost = (url: string) => new URL(url).host;
|
||||||
|
const LinkContainer = styled('div')<{
|
||||||
|
isSelected: boolean;
|
||||||
|
}>(({ theme, isSelected }) => {
|
||||||
|
return {
|
||||||
|
// overflow: 'hidden',
|
||||||
|
borderRadius: theme.affine.shape.borderRadius,
|
||||||
|
fontSize: '0',
|
||||||
|
background: isSelected ? 'rgba(152, 172, 189, 0.2)' : '#fafafa',
|
||||||
|
padding: '0 8px',
|
||||||
|
width: '100%',
|
||||||
|
height: '72px',
|
||||||
|
lineHeight: '32px',
|
||||||
|
border: '1px solid #ccc',
|
||||||
|
cursor: 'pointer',
|
||||||
|
p: {
|
||||||
|
overflow: 'hidden',
|
||||||
|
fontSize: theme.affine.typography.body1.fontSize,
|
||||||
|
height: '36px',
|
||||||
|
textOverflow: 'ellipsis',
|
||||||
|
},
|
||||||
|
};
|
||||||
|
});
|
||||||
const SourceViewContainer = styled('div')<{
|
const SourceViewContainer = styled('div')<{
|
||||||
isSelected: boolean;
|
isSelected: boolean;
|
||||||
scene: string;
|
scene: string;
|
||||||
@@ -68,24 +79,28 @@ 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);
|
||||||
|
const openTabOnBrowser = () => {
|
||||||
|
window.open(link, '_blank');
|
||||||
|
};
|
||||||
if (src?.startsWith('http')) {
|
if (src?.startsWith('http')) {
|
||||||
return (
|
return (
|
||||||
<div
|
<LinkContainer
|
||||||
|
isSelected={isSelected}
|
||||||
onMouseDown={e => e.preventDefault()}
|
onMouseDown={e => e.preventDefault()}
|
||||||
style={{ display: 'flex' }}
|
onClick={openTabOnBrowser}
|
||||||
>
|
>
|
||||||
<SourceViewContainer isSelected={isSelected} scene={scene}>
|
<p>{getHost(src)}</p>
|
||||||
|
<p>{src}</p>
|
||||||
|
{/* <SourceViewContainer isSelected={isSelected} scene={scene}>
|
||||||
<iframe
|
<iframe
|
||||||
title={link}
|
title={link}
|
||||||
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"
|
sandbox=""
|
||||||
/>
|
/>
|
||||||
<MouseMaskContainer />
|
</SourceViewContainer> */}
|
||||||
</SourceViewContainer>
|
</LinkContainer>
|
||||||
</div>
|
|
||||||
);
|
);
|
||||||
} else if (src?.startsWith('affine')) {
|
} else if (src?.startsWith('affine')) {
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -15,5 +15,4 @@ export const List = styled('div')(({ theme }) => ({
|
|||||||
}));
|
}));
|
||||||
export const LinkContainer = styled('div')(() => ({
|
export const LinkContainer = styled('div')(() => ({
|
||||||
position: 'relative',
|
position: 'relative',
|
||||||
overflowBlock: 'hidden',
|
|
||||||
}));
|
}));
|
||||||
|
|||||||
@@ -51,20 +51,17 @@ const UploadBox = styled('div')<{ isSelected: boolean }>(
|
|||||||
({ theme, isSelected }) => {
|
({ theme, isSelected }) => {
|
||||||
return {
|
return {
|
||||||
width: '100%',
|
width: '100%',
|
||||||
background: '#f7f7f7',
|
|
||||||
padding: '15px 10px',
|
padding: '15px 10px',
|
||||||
fontSize: theme.affine.typography.body1.fontSize,
|
fontSize: theme.affine.typography.body1.fontSize,
|
||||||
borderRadius: '4px',
|
borderRadius: '4px',
|
||||||
cursor: 'pointer',
|
cursor: 'pointer',
|
||||||
border: isSelected
|
background: isSelected ? 'rgba(152, 172, 189, 0.2)' : '#fafafa',
|
||||||
? `1px solid ${theme.affine.palette.primary}`
|
border: '1px solid #e0e0e0',
|
||||||
: '1px solid #e0e0e0',
|
|
||||||
'.delete': {
|
'.delete': {
|
||||||
display: 'none',
|
display: 'none',
|
||||||
float: 'right',
|
float: 'right',
|
||||||
},
|
},
|
||||||
'&:hover': {
|
'&:hover': {
|
||||||
background: '#eee',
|
|
||||||
'.delete': {
|
'.delete': {
|
||||||
display: 'inline-block',
|
display: 'inline-block',
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user