mirror of
https://github.com/zadam/trilium.git
synced 2025-10-26 07:46:30 +01:00
fix(views/table): events/commands not well sent
This commit is contained in:
@@ -25,7 +25,7 @@ export default class TableColumnEditing extends Component {
|
||||
this.parentNote = parentNote;
|
||||
}
|
||||
|
||||
addNewTableColumnEvent({ referenceColumn, direction }: EventData<"addNewTableColumn">) {
|
||||
addNewTableColumnCommand({ referenceColumn, direction }: EventData<"addNewTableColumn">) {
|
||||
const attr: Attribute = {
|
||||
type: "label",
|
||||
name: "label:myLabel",
|
||||
@@ -52,15 +52,11 @@ export default class TableColumnEditing extends Component {
|
||||
});
|
||||
}
|
||||
|
||||
async reloadAttributesEvent() {
|
||||
console.log("Reload attributes");
|
||||
}
|
||||
|
||||
async updateAttributeListEvent({ attributes }: CommandListenerData<"updateAttributeList">) {
|
||||
async updateAttributeListCommand({ attributes }: CommandListenerData<"updateAttributeList">) {
|
||||
this.newAttribute = attributes[0];
|
||||
}
|
||||
|
||||
async saveAttributesEvent() {
|
||||
async saveAttributesCommand() {
|
||||
if (!this.newAttribute) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -103,6 +103,7 @@ export default class TableView extends ViewMode<StateInfo> {
|
||||
private api?: Tabulator;
|
||||
private persistentData: StateInfo["tableData"];
|
||||
private colEditing?: TableColumnEditing;
|
||||
private rowEditing?: TableRowEditing;
|
||||
|
||||
constructor(args: ViewModeArgs) {
|
||||
super(args, "table");
|
||||
@@ -167,9 +168,7 @@ export default class TableView extends ViewMode<StateInfo> {
|
||||
this.api = new Tabulator(el, opts);
|
||||
|
||||
this.colEditing = new TableColumnEditing(this.args.$parent, this.args.parentNote, this.api);
|
||||
this.child(this.colEditing);
|
||||
|
||||
this.child(new TableRowEditing(this.api, this.args.parentNotePath!));
|
||||
this.rowEditing = new TableRowEditing(this.api, this.args.parentNotePath!);
|
||||
|
||||
if (movableRows) {
|
||||
configureReorderingRows(this.api);
|
||||
@@ -222,6 +221,23 @@ export default class TableView extends ViewMode<StateInfo> {
|
||||
this.colEditing?.resetNewAttributePosition();
|
||||
}
|
||||
|
||||
addNewRowCommand(e) {
|
||||
this.rowEditing?.addNewRowCommand(e);
|
||||
}
|
||||
|
||||
addNewTableColumnCommand(e) {
|
||||
this.colEditing?.addNewTableColumnCommand(e);
|
||||
}
|
||||
|
||||
updateAttributeListCommand(e) {
|
||||
this.colEditing?.updateAttributeListCommand(e);
|
||||
}
|
||||
|
||||
saveAttributesCommand() {
|
||||
this.colEditing?.saveAttributesCommand();
|
||||
}
|
||||
|
||||
|
||||
async #manageRowsUpdate() {
|
||||
if (!this.api) {
|
||||
return;
|
||||
|
||||
@@ -42,7 +42,7 @@ export default class TableRowEditing extends Component {
|
||||
});
|
||||
}
|
||||
|
||||
addNewRowEvent({ customOpts, parentNotePath: customNotePath }: CommandListenerData<"addNewRow">) {
|
||||
addNewRowCommand({ customOpts, parentNotePath: customNotePath }: CommandListenerData<"addNewRow">) {
|
||||
const parentNotePath = customNotePath ?? this.parentNotePath;
|
||||
if (parentNotePath) {
|
||||
const opts: CreateNoteOpts = {
|
||||
|
||||
Reference in New Issue
Block a user