mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-23 13:02:21 +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:
+14
-2
@@ -1125,6 +1125,18 @@ export class EdgelessSelectedRectWidget extends WidgetComponent<
|
|||||||
bound: Bound,
|
bound: Bound,
|
||||||
direction: HandleDirection
|
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);
|
const curBound = Bound.deserialize(element.xywh);
|
||||||
|
|
||||||
let scale = element.props.scale ?? 1;
|
let scale = element.props.scale ?? 1;
|
||||||
@@ -1141,11 +1153,11 @@ export class EdgelessSelectedRectWidget extends WidgetComponent<
|
|||||||
bound.w = width * scale;
|
bound.w = width * scale;
|
||||||
|
|
||||||
height = bound.h / scale;
|
height = bound.h / scale;
|
||||||
height = clamp(height, SYNCED_MIN_HEIGHT, Infinity);
|
height = clamp(height, SYNCED_MIN_HEIGHT, maxHeight);
|
||||||
bound.h = height * scale;
|
bound.h = height * scale;
|
||||||
|
|
||||||
this._isWidthLimit = width === SYNCED_MIN_WIDTH;
|
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, {
|
this.gfx.updateElement(element.id, {
|
||||||
scale,
|
scale,
|
||||||
|
|||||||
Reference in New Issue
Block a user