fix(editor): should not show inner toolbar of surface-ref in edgeless (#11453)

Closes: [BS-3015](https://linear.app/affine-design/issue/BS-3015/toolbar-有时会出现空状态且被显示) [BS-3023](https://linear.app/affine-design/issue/BS-3023/surface-ref-inner-toolbar-的标题圆角)
This commit is contained in:
fundon
2025-04-03 11:13:09 +00:00
parent a9ba54a92e
commit 565d7b2b1e
7 changed files with 74 additions and 26 deletions
@@ -70,9 +70,8 @@ export function autoUpdatePosition(
offset(({ rects }) => -rects.floating.height),
size({
apply: ({ elements }) => {
elements.floating.style.width = `${
elements.reference.getBoundingClientRect().width
}px`;
const { width } = elements.reference.getBoundingClientRect();
elements.floating.style.width = `${width}px`;
},
}),
],
@@ -126,12 +125,14 @@ export function autoUpdatePosition(
toolbar.style.transform = `translate3d(${x}px, ${y}px, 0)`;
if (toolbar.dataset.open) {
if (middlewareData.hide?.referenceHidden) {
delete toolbar.dataset.open;
if (middlewareData.hide) {
if (toolbar.dataset.open) {
if (middlewareData.hide.referenceHidden) {
delete toolbar.dataset.open;
}
} else {
toolbar.dataset.open = 'true';
}
} else {
toolbar.dataset.open = 'true';
}
};
@@ -239,6 +240,12 @@ export function renderToolbar(
a => a.placement === ActionPlacement.More
);
// Resets
if (primaryActionGroup.length === 0) {
context.reset();
return;
}
const innerToolbar = context.placement$.value === 'inner';
if (moreActionGroup.length) {
@@ -289,6 +296,9 @@ export function renderToolbar(
),
toolbar
);
if (toolbar.dataset.open) return;
toolbar.dataset.open = 'true';
}
function renderActions(