mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-22 20:41:50 +08:00
fix(editor): edgeless note duplicated from embed-doc should be above other elements (#12028)
Close [BS-3357](https://linear.app/affine-design/issue/BS-3357/duplicate-note-注意设置z轴的数据) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Duplicating an edgeless note now ensures the new note appears above other elements in the stacking order. - **Tests** - Added a test to verify that duplicated edgeless notes are rendered above existing elements. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -375,6 +375,7 @@ const builtinSurfaceToolbarConfig = {
|
|||||||
DEFAULT_NOTE_WIDTH,
|
DEFAULT_NOTE_WIDTH,
|
||||||
DEFAULT_NOTE_HEIGHT
|
DEFAULT_NOTE_HEIGHT
|
||||||
).serialize(),
|
).serialize(),
|
||||||
|
index: gfx.layer.generateIndex(),
|
||||||
displayMode: NoteDisplayMode.EdgelessOnly,
|
displayMode: NoteDisplayMode.EdgelessOnly,
|
||||||
} satisfies Partial<NoteProps>,
|
} satisfies Partial<NoteProps>,
|
||||||
ctx.store.root
|
ctx.store.root
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ import { expect, type Page } from '@playwright/test';
|
|||||||
import { clickView } from '../utils/actions/click.js';
|
import { clickView } from '../utils/actions/click.js';
|
||||||
import {
|
import {
|
||||||
createNote,
|
createNote,
|
||||||
|
createShapeElement,
|
||||||
|
getAllSortedIds,
|
||||||
getIds,
|
getIds,
|
||||||
getSelectedBound,
|
getSelectedBound,
|
||||||
getSelectedIds,
|
getSelectedIds,
|
||||||
@@ -201,5 +203,21 @@ test.describe('Embed synced doc in edgeless mode', () => {
|
|||||||
const noteBound = await getSelectedBound(page);
|
const noteBound = await getSelectedBound(page);
|
||||||
expect(isIntersected(embedDocBound, noteBound)).toBe(false);
|
expect(isIntersected(embedDocBound, noteBound)).toBe(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('edgeless note duplicated from embed-synced-doc should be above other elements', async ({
|
||||||
|
page,
|
||||||
|
}) => {
|
||||||
|
await createShapeElement(page, [0, 0], [100, 100]);
|
||||||
|
await page.locator('affine-embed-edgeless-synced-doc-block').click();
|
||||||
|
const toolbar = locateToolbar(page);
|
||||||
|
await toolbar.getByLabel('Duplicate as note').click();
|
||||||
|
|
||||||
|
const edgelessNotes = page.locator('affine-edgeless-note');
|
||||||
|
await expect(edgelessNotes).toHaveCount(2);
|
||||||
|
const duplicatedNoteId = (await getSelectedIds(page))[0];
|
||||||
|
const sortedIds = await getAllSortedIds(page);
|
||||||
|
//
|
||||||
|
expect(sortedIds[sortedIds.length - 1]).toBe(duplicatedNoteId);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user