refactor(editor): image toolbar config extension (#11329)

Closes: [BS-2378](https://linear.app/affine-design/issue/BS-2378/image-toolbar-迁移)
This commit is contained in:
fundon
2025-04-01 10:04:28 +00:00
parent 032244ae61
commit 7af5e53838
26 changed files with 267 additions and 785 deletions

View File

@@ -1132,14 +1132,14 @@ test('should blur rich-text first on starting block selection', async ({
await expect(page.locator('*:focus')).toHaveCount(0);
});
test('should not show option menu of image on block selection', async ({
page,
}) => {
test('should show toolbar of image on block selection', async ({ page }) => {
await enterPlaygroundRoom(page);
await initImageState(page);
await activeEmbed(page);
await expect(page.locator('.affine-image-toolbar-container')).toHaveCount(1);
const toolbar = page.locator('affine-toolbar-widget editor-toolbar');
await expect(toolbar).toBeHidden();
await pressEnter(page);
@@ -1162,7 +1162,7 @@ test('should not show option menu of image on block selection', async ({
await page.waitForTimeout(50);
await expect(page.locator('.affine-image-toolbar-container')).toHaveCount(0);
await expect(toolbar).toBeVisible();
await expect(
page.locator('affine-block-selection').locator('visible=true')
).toHaveCount(1);

View File

@@ -1338,14 +1338,16 @@ test('should keep native range selection when scrolling forward with the scroll
assertClipItems(page, 'text/plain', '123456789');
});
test('should not show option menu of image on native selection', async ({
test('should not show toolbar of image on native selection', async ({
page,
}) => {
await enterPlaygroundRoom(page);
await initImageState(page);
await activeEmbed(page);
await expect(page.locator('.affine-image-toolbar-container')).toHaveCount(1);
const toolbar = page.locator('affine-toolbar-widget editor-toolbar');
await expect(toolbar).toBeVisible();
await pressEscape(page);
await pressEnter(page);
@@ -1381,7 +1383,7 @@ test('should not show option menu of image on native selection', async ({
await copyByKeyboard(page);
assertClipItems(page, 'text/plain', '123');
await expect(page.locator('.affine-image-toolbar-container')).toHaveCount(0);
await expect(toolbar).toBeHidden();
});
test('should select with shift-click', async ({ page }) => {