fix: drag mind map root node should layout in real time (#9252)

Fixes [BS-2062](https://linear.app/affine-design/issue/BS-2062/拖拽整个-mind-map-还是希望和之前一样,整个思维导图跟手)
This commit is contained in:
doouding
2024-12-23 10:33:56 +00:00
parent aacdb71ee2
commit b246a2d45f
7 changed files with 533 additions and 109 deletions
@@ -1154,8 +1154,8 @@ export async function triggerComponentToolbarAction(
await button.click();
break;
}
case 'changeShapeStrokeStyles':
case 'changeShapeStrokeColor': {
case 'changeShapeStrokeColor':
case 'changeShapeStrokeStyles': {
const button = locatorComponentToolbar(page)
.locator('edgeless-change-shape-button')
.getByRole('button', { name: 'Border style' });
@@ -1916,3 +1916,30 @@ export function toIdCountMap(ids: string[]) {
export function getFrameTitle(page: Page, frame: string) {
return page.locator(`affine-frame-title[data-id="${frame}"]`);
}
export async function selectElementInEdgeless(page: Page, elements: string[]) {
await page.evaluate(
({ elements }) => {
const edgelessBlock = document.querySelector('affine-edgeless-root');
if (!edgelessBlock) {
throw new Error('edgeless block not found');
}
edgelessBlock.gfx.selection.set({
elements,
});
},
{ elements }
);
}
export async function waitFontsLoaded(page: Page) {
await page.evaluate(() => {
const edgelessBlock = document.querySelector('affine-edgeless-root');
if (!edgelessBlock) {
throw new Error('edgeless block not found');
}
return edgelessBlock.fontLoader?.ready;
});
}