From a05d9b78176f3df69bc050c744a4c5c9b46d66e1 Mon Sep 17 00:00:00 2001 From: zzj3720 <17165520+zzj3720@users.noreply.github.com> Date: Fri, 21 Mar 2025 10:17:13 +0000 Subject: [PATCH] fix(editor): remove selection when click `New Record` button (#11073) fix: BS-2847 --- .../affine/data-view/src/view-presets/table/mobile/group.ts | 6 ++++-- .../affine/data-view/src/view-presets/table/pc/group.ts | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/blocksuite/affine/data-view/src/view-presets/table/mobile/group.ts b/blocksuite/affine/data-view/src/view-presets/table/mobile/group.ts index 344cb646c7..295d2f8119 100644 --- a/blocksuite/affine/data-view/src/view-presets/table/mobile/group.ts +++ b/blocksuite/affine/data-view/src/view-presets/table/mobile/group.ts @@ -52,8 +52,9 @@ export class MobileTableGroup extends SignalWatcher( private readonly clickAddRow = () => { this.view.rowAdd('end', this.group?.key); + const selectionController = this.viewEle.selectionController; + selectionController.selection = undefined; requestAnimationFrame(() => { - const selectionController = this.viewEle.selectionController; const index = this.view.properties$.value.findIndex( v => v.type$.value === 'title' ); @@ -70,8 +71,9 @@ export class MobileTableGroup extends SignalWatcher( private readonly clickAddRowInStart = () => { this.view.rowAdd('start', this.group?.key); + const selectionController = this.viewEle.selectionController; + selectionController.selection = undefined; requestAnimationFrame(() => { - const selectionController = this.viewEle.selectionController; const index = this.view.properties$.value.findIndex( v => v.type$.value === 'title' ); diff --git a/blocksuite/affine/data-view/src/view-presets/table/pc/group.ts b/blocksuite/affine/data-view/src/view-presets/table/pc/group.ts index 628d4acca6..4f72b653f3 100644 --- a/blocksuite/affine/data-view/src/view-presets/table/pc/group.ts +++ b/blocksuite/affine/data-view/src/view-presets/table/pc/group.ts @@ -69,8 +69,9 @@ export class TableGroup extends SignalWatcher( private readonly clickAddRow = () => { this.view.rowAdd('end', this.group?.key); + const selectionController = this.viewEle.selectionController; + selectionController.selection = undefined; requestAnimationFrame(() => { - const selectionController = this.viewEle.selectionController; const index = this.view.properties$.value.findIndex( v => v.type$.value === 'title' ); @@ -87,8 +88,9 @@ export class TableGroup extends SignalWatcher( private readonly clickAddRowInStart = () => { this.view.rowAdd('start', this.group?.key); + const selectionController = this.viewEle.selectionController; + selectionController.selection = undefined; requestAnimationFrame(() => { - const selectionController = this.viewEle.selectionController; const index = this.view.properties$.value.findIndex( v => v.type$.value === 'title' );