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.

feat(editor): add max height to edgeless embed doc (#12030)

L-Sund6f79a0c715d
diff --git a/blocksuite/affine/blocks/root/src/edgeless/components/rects/edgeless-selected-rect.ts b/blocksuite/affine/blocks/root/src/edgeless/components/rects/edgeless-selected-rect.ts
index 993218fbff..e9256a0be5 100644
--- a/blocksuite/affine/blocks/root/src/edgeless/components/rects/edgeless-selected-rect.ts
+++ b/blocksuite/affine/blocks/root/src/edgeless/components/rects/edgeless-selected-rect.ts
@@ -1125,6 +1125,18 @@ export class EdgelessSelectedRectWidget extends WidgetComponent<
bound: Bound,
direction: HandleDirection
) {
+ const block = this.std.view.getBlock(element.id);
+ if (!block) return;
+ const headerHeight =
+ block
+ .querySelector('.affine-embed-synced-doc-edgeless-header-wrapper')
+ ?.getBoundingClientRect().height ?? 0;
+ const contentHeight =
+ block.querySelector('affine-preview-root')?.getBoundingClientRect()
+ .height ?? 0;
+
+ const maxHeight = (headerHeight + contentHeight) / this.zoom;
+
const curBound = Bound.deserialize(element.xywh);
let scale = element.props.scale ?? 1;
@@ -1141,11 +1153,11 @@ export class EdgelessSelectedRectWidget extends WidgetComponent<
bound.w = width * scale;
height = bound.h / scale;
- height = clamp(height, SYNCED_MIN_HEIGHT, Infinity);
+ height = clamp(height, SYNCED_MIN_HEIGHT, maxHeight);
bound.h = height * scale;
this._isWidthLimit = width === SYNCED_MIN_WIDTH;
- this._isHeightLimit = height === SYNCED_MIN_HEIGHT;
+ this._isHeightLimit = height === SYNCED_MIN_HEIGHT || height === maxHeight;
this.gfx.updateElement(element.id, {
scale,