fix(editor): table block readonly support (#10224)

close: BS-2597
This commit is contained in:
zzj3720
2025-02-17 10:19:00 +00:00
parent 29d8824479
commit e4f2223a2a
4 changed files with 32 additions and 18 deletions
@@ -68,8 +68,9 @@ export class TableCell extends SignalWatcher(
@property({ attribute: false })
accessor text: Text | undefined = undefined;
@property({ type: Boolean })
accessor readonly = false;
get readonly() {
return this.dataManager.readonly$.value;
}
@property({ attribute: false })
accessor dataManager!: TableDataManager;
@@ -644,6 +645,9 @@ export class TableCell extends SignalWatcher(
override connectedCallback() {
super.connectedCallback();
if (this.readonly) {
return;
}
const selectAll = (e: KeyboardEvent) => {
if (e.key === 'a' && (IS_MAC ? e.metaKey : e.ctrlKey)) {
e.stopPropagation();
@@ -666,6 +670,9 @@ export class TableCell extends SignalWatcher(
}
override firstUpdated() {
if (this.readonly) {
return;
}
this.richText$.value?.updateComplete
.then(() => {
this.disposables.add(