feat(editor): limit embed edgeless iframe block width and height (#11192)

[BS-2841](https://linear.app/affine-design/issue/BS-2841/iframe-embed-block-edgeless-block-component-限制-resize-时的最大最小宽高)
This commit is contained in:
donteatfriedrice
2025-03-26 08:38:06 +00:00
parent 39fa8e87cf
commit b5945c7e7d
3 changed files with 90 additions and 11 deletions

View File

@@ -14,3 +14,8 @@ export const AI_CHAT_BLOCK_MIN_WIDTH = 260;
export const AI_CHAT_BLOCK_MIN_HEIGHT = 160;
export const AI_CHAT_BLOCK_MAX_WIDTH = 320;
export const AI_CHAT_BLOCK_MAX_HEIGHT = 300;
export const EMBED_IFRAME_BLOCK_MIN_WIDTH = 218;
export const EMBED_IFRAME_BLOCK_MIN_HEIGHT = 44;
export const EMBED_IFRAME_BLOCK_MAX_WIDTH = 3400;
export const EMBED_IFRAME_BLOCK_MAX_HEIGHT = 2200;

View File

@@ -88,6 +88,21 @@ export function isAIChatBlock(element: BlockModel | GfxModel | null) {
);
}
/**
* TODO: Remove this function after the edgeless refactor completed
* This function is used to check if the block is an EmbedIframeBlock for edgeless selected rect
* Should not be used in the future
* Related issue: https://linear.app/affine-design/issue/BS-2841/
* @deprecated
*/
export function isEmbedIframeBlock(element: BlockModel | GfxModel | null) {
return (
!!element &&
'flavour' in element &&
element.flavour === 'affine:embed-iframe'
);
}
export function isEmbeddedLinkBlock(element: BlockModel | GfxModel | null) {
return (
isEmbeddedBlock(element) &&