mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-13 21:05:19 +00:00
chore(editor): improve selection of doc in canvas (#11314)
Close [BS-2705](https://linear.app/affine-design/issue/BS-2705/[improvement]-通过-viability-control-选择-hide-in-edgeless) This PR disabled selecting operation of notes that are only shown in page mode.
This commit is contained in:
@@ -320,9 +320,10 @@ test.describe('TOC and edgeless selection', () => {
|
||||
expect(await getEdgelessSelectedIds(page)).toHaveLength(0);
|
||||
|
||||
await cards.nth(1).click();
|
||||
expect(await getEdgelessSelectedIds(page)).toHaveLength(1);
|
||||
await cards.nth(1).click();
|
||||
expect(await getEdgelessSelectedIds(page)).toHaveLength(0);
|
||||
expect(
|
||||
await getEdgelessSelectedIds(page),
|
||||
'should not select doc only note'
|
||||
).toHaveLength(0);
|
||||
|
||||
await cards.nth(2).click();
|
||||
expect(await getEdgelessSelectedIds(page)).toHaveLength(1);
|
||||
@@ -333,7 +334,7 @@ test.describe('TOC and edgeless selection', () => {
|
||||
await cards.nth(1).click({ modifiers: ['Shift'] });
|
||||
await cards.nth(2).click({ modifiers: ['Shift'] });
|
||||
|
||||
expect(await getEdgelessSelectedIds(page)).toHaveLength(3);
|
||||
expect(await getEdgelessSelectedIds(page)).toHaveLength(2);
|
||||
});
|
||||
|
||||
test('should select note cards when select note blocks in canvas', async ({
|
||||
|
||||
@@ -7,6 +7,9 @@ import {
|
||||
assertEdgelessTool,
|
||||
changeEdgelessNoteBackground,
|
||||
changeNoteDisplayMode,
|
||||
dragBetweenViewCoords,
|
||||
getSelectedBound,
|
||||
getSelectedBoundCount,
|
||||
locatorComponentToolbar,
|
||||
locatorEdgelessZoomToolButton,
|
||||
selectNoteInEdgeless,
|
||||
@@ -19,6 +22,7 @@ import {
|
||||
import {
|
||||
click,
|
||||
clickBlockById,
|
||||
clickView,
|
||||
dragBetweenCoords,
|
||||
dragBetweenIndices,
|
||||
enterPlaygroundRoom,
|
||||
@@ -31,6 +35,7 @@ import {
|
||||
pressBackspace,
|
||||
pressEnter,
|
||||
pressTab,
|
||||
selectAllByKeyboard,
|
||||
type,
|
||||
undoByKeyboard,
|
||||
waitForInlineEditorStateUpdated,
|
||||
@@ -541,3 +546,33 @@ test('select text cross blocks in edgeless note', async ({ page }) => {
|
||||
await pressBackspace(page);
|
||||
await assertRichTexts(page, ['ac']);
|
||||
});
|
||||
|
||||
test('should not select doc only note', async ({ page }) => {
|
||||
await enterPlaygroundRoom(page);
|
||||
await initEmptyEdgelessState(page);
|
||||
await switchEditorMode(page);
|
||||
await clickView(page, [0, 0]);
|
||||
|
||||
await selectAllByKeyboard(page);
|
||||
const noteBound = await getSelectedBound(page);
|
||||
|
||||
await triggerComponentToolbarAction(page, 'changeNoteDisplayMode');
|
||||
await waitNextFrame(page);
|
||||
await changeNoteDisplayMode(page, NoteDisplayMode.DocOnly);
|
||||
|
||||
await selectAllByKeyboard(page);
|
||||
expect(await getSelectedBoundCount(page)).toBe(0);
|
||||
|
||||
await clickView(page, [
|
||||
0.5 * (noteBound[0] + noteBound[2]),
|
||||
0.5 * (noteBound[1] + noteBound[3]),
|
||||
]);
|
||||
expect(await getSelectedBoundCount(page)).toBe(0);
|
||||
|
||||
await dragBetweenViewCoords(
|
||||
page,
|
||||
[noteBound[0] - 10, noteBound[1] - 10],
|
||||
[noteBound[0] + noteBound[2] + 10, noteBound[1] + noteBound[3] + 10]
|
||||
);
|
||||
expect(await getSelectedBoundCount(page)).toBe(0);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user