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