mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-30 00:29:46 +08:00
chore(editor): adjust size of synced doc (#12163)
Close [BS-3418](https://linear.app/affine-design/issue/BS-3418/折叠的embed-doc调整宽度时,会出现一个最小高度,不需要这个) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Improved resizing and folding interactions for embedded synced documents in edgeless mode, including dynamic height calculation and enhanced drag-handle styling. - **Bug Fixes** - Adjusted minimum height for synced document embeds to allow more compact display. - Ensured consistent width settings across embed cards. - **Tests** - Added end-to-end tests covering folding, unfolding, and resizing behaviors for edgeless synced document embeds. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -5,8 +5,10 @@ import {
|
||||
ReloadIcon,
|
||||
} from '@blocksuite/affine-components/icons';
|
||||
import { ColorScheme } from '@blocksuite/affine-model';
|
||||
import type { BlockComponent } from '@blocksuite/std';
|
||||
import type { TemplateResult } from 'lit';
|
||||
|
||||
import { EmbedEdgelessSyncedDocBlockComponent } from './embed-edgeless-synced-doc-block.js';
|
||||
import {
|
||||
DarkSyncedDocDeletedBanner,
|
||||
DarkSyncedDocEmptyBanner,
|
||||
@@ -58,3 +60,22 @@ export function getSyncedDocIcons(
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This function will return the height of the synced doc block
|
||||
*/
|
||||
export function calcSyncedDocFullHeight(block: BlockComponent) {
|
||||
if (!(block instanceof EmbedEdgelessSyncedDocBlockComponent)) {
|
||||
return 0;
|
||||
}
|
||||
const headerHeight = block.headerWrapper?.getBoundingClientRect().height ?? 0;
|
||||
// When the content is not found, we use a default height to display empty information
|
||||
const contentHeight =
|
||||
block.contentElement?.getBoundingClientRect().height ?? 200;
|
||||
|
||||
const bottomPadding = 8;
|
||||
|
||||
return (
|
||||
(headerHeight + contentHeight + bottomPadding) / block.gfx.viewport.zoom
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user