mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-27 10:52:40 +08:00
feat(editor): add max height to edgeless embed doc (#12030)
Close [BS-3250](https://linear.app/affine-design/issue/BS-3250/embed-doc在白板的高度需要适应内容)
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user