refactor(editor): use selected signal in block component (#9849)

This commit is contained in:
fundon
2025-01-27 02:56:10 +00:00
parent a5c8356376
commit ffd54c6620
18 changed files with 90 additions and 158 deletions

View File

@@ -266,11 +266,9 @@ export class SelectionController implements ReactiveController {
}
selected$ = computed(() => this.getSelected());
getSelected(): TableSelectionData | undefined {
const selected = this.host.selected;
if (selected instanceof TableSelection) {
return selected.data;
}
return undefined;
const selection = this.host.selection.value.find(
selection => selection.blockId === this.host.model.id
);
return selection?.is(TableSelection) ? selection.data : undefined;
}
}