Skip to content

There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.

fix(editor): remove selection when click `New Record` button (#11073)

zzj3720a05d9b78176f
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'
);