mirror of
https://github.com/zadam/trilium.git
synced 2025-11-02 19:36:12 +01:00
chore(client/ts): port inherited_attribute_list
This commit is contained in:
@@ -288,7 +288,7 @@ const ATTR_HELP: Record<string, Record<string, string>> = {
|
||||
};
|
||||
|
||||
interface AttributeDetailOpts {
|
||||
allAttributes: Attribute[];
|
||||
allAttributes?: Attribute[];
|
||||
attribute: Attribute;
|
||||
isOwned: boolean;
|
||||
x: number;
|
||||
@@ -338,7 +338,7 @@ export default class AttributeDetailWidget extends NoteContextAwareWidget {
|
||||
|
||||
private relatedNotesSpacedUpdate!: SpacedUpdate;
|
||||
private attribute!: Attribute;
|
||||
private allAttributes!: Attribute[];
|
||||
private allAttributes?: Attribute[];
|
||||
private attrType!: ReturnType<AttributeDetailWidget["getAttrType"]>;
|
||||
|
||||
async refresh() {
|
||||
@@ -434,7 +434,7 @@ export default class AttributeDetailWidget extends NoteContextAwareWidget {
|
||||
|
||||
this.attribute.value = pathChunks[pathChunks.length - 1]; // noteId
|
||||
|
||||
this.triggerCommand("updateAttributeList", { attributes: this.allAttributes });
|
||||
this.triggerCommand("updateAttributeList", { attributes: this.allAttributes ?? [] });
|
||||
this.updateRelatedNotes();
|
||||
});
|
||||
|
||||
@@ -454,7 +454,7 @@ export default class AttributeDetailWidget extends NoteContextAwareWidget {
|
||||
this.$deleteButton = this.$widget.find(".attr-delete-button");
|
||||
this.$deleteButton.on("click", async () => {
|
||||
await this.triggerCommand("updateAttributeList", {
|
||||
attributes: this.allAttributes.filter((attr) => attr !== this.attribute)
|
||||
attributes: (this.allAttributes || []).filter((attr) => attr !== this.attribute)
|
||||
});
|
||||
|
||||
await this.triggerCommand("saveAttributes");
|
||||
@@ -714,7 +714,7 @@ export default class AttributeDetailWidget extends NoteContextAwareWidget {
|
||||
this.attribute.value = String(this.$inputValue.val());
|
||||
}
|
||||
|
||||
this.triggerCommand("updateAttributeList", { attributes: this.allAttributes });
|
||||
this.triggerCommand("updateAttributeList", { attributes: this.allAttributes ?? [] });
|
||||
}
|
||||
|
||||
buildDefinitionValue() {
|
||||
|
||||
Reference in New Issue
Block a user