refactor(editor): adjust ui of surface-ref inner toolbar (#11129)

Close [BS-2803](https://linear.app/affine-design/issue/BS-2803/inserted-frame-ui%E8%B0%83%E6%95%B4)
Close [BS-2815](https://linear.app/affine-design/issue/BS-2815/inserted-group-ui调整)

### What Changes
- Add an inner toolbar for hovered `surface-ref-block`
- Simplify viewport related codes of `surface-ref-block`
- Expose popover floating options from `affine-menu-button`

https://github.com/user-attachments/assets/916b0a22-6271-4a6f-b338-6630e0426967
This commit is contained in:
L-Sun
2025-03-25 03:48:12 +00:00
parent 314e5795eb
commit a2e3d318ba
8 changed files with 382 additions and 452 deletions

View File

@@ -4,6 +4,7 @@ import {
autoUpdate,
computePosition,
offset,
type Placement,
type Rect,
shift,
size,
@@ -39,6 +40,7 @@ export type ButtonPopperOptions = {
stateUpdated?: (state: { display: Display }) => void;
mainAxis?: number;
crossAxis?: number;
allowedPlacements?: Placement[];
rootBoundary?: Rect | (() => Rect | undefined);
ignoreShift?: boolean;
offsetHeight?: number;
@@ -64,6 +66,7 @@ export function createButtonPopper(options: ButtonPopperOptions) {
stateUpdated = () => {},
mainAxis,
crossAxis,
allowedPlacements = ['top', 'bottom'],
rootBoundary,
ignoreShift,
offsetHeight,
@@ -84,7 +87,7 @@ export function createButtonPopper(options: ButtonPopperOptions) {
crossAxis: crossAxis ?? 0,
}),
autoPlacement({
allowedPlacements: ['top', 'bottom'],
allowedPlacements,
...overflowOptions,
}),
shift(overflowOptions),