mirror of
https://github.com/zadam/trilium.git
synced 2025-10-30 19:19:03 +01:00
fix(views/table): changing column inheritability not working
This commit is contained in:
parent
beb1c15fa5
commit
ebff644d24
@ -82,17 +82,18 @@ export default class TableColumnEditing extends Component {
|
|||||||
const { name, value, isInheritable } = this.newAttribute;
|
const { name, value, isInheritable } = this.newAttribute;
|
||||||
|
|
||||||
this.api.blockRedraw();
|
this.api.blockRedraw();
|
||||||
|
const isRename = (this.existingAttributeToEdit && this.existingAttributeToEdit.name !== name);
|
||||||
try {
|
try {
|
||||||
if (this.existingAttributeToEdit && this.existingAttributeToEdit.name !== name) {
|
if (isRename) {
|
||||||
const oldName = this.existingAttributeToEdit.name.split(":")[1];
|
const oldName = this.existingAttributeToEdit!.name.split(":")[1];
|
||||||
const [ type, newName ] = name.split(":");
|
const [ type, newName ] = name.split(":");
|
||||||
await renameColumn(this.parentNote.noteId, type as "label" | "relation", oldName, newName);
|
await renameColumn(this.parentNote.noteId, type as "label" | "relation", oldName, newName);
|
||||||
}
|
}
|
||||||
|
|
||||||
attributes.setLabel(this.parentNote.noteId, name, value, isInheritable);
|
if (this.existingAttributeToEdit && (isRename || this.existingAttributeToEdit.isInheritable !== isInheritable)) {
|
||||||
if (this.existingAttributeToEdit) {
|
|
||||||
attributes.removeOwnedLabelByName(this.parentNote, this.existingAttributeToEdit.name);
|
attributes.removeOwnedLabelByName(this.parentNote, this.existingAttributeToEdit.name);
|
||||||
}
|
}
|
||||||
|
attributes.setLabel(this.parentNote.noteId, name, value, isInheritable);
|
||||||
} finally {
|
} finally {
|
||||||
this.api.restoreRedraw();
|
this.api.restoreRedraw();
|
||||||
}
|
}
|
||||||
@ -134,17 +135,17 @@ export default class TableColumnEditing extends Component {
|
|||||||
return this.parentNote.getLabel(attrName);
|
return this.parentNote.getLabel(attrName);
|
||||||
}
|
}
|
||||||
|
|
||||||
getAttributeFromField(field: string) {
|
getAttributeFromField(field: string): Attribute | undefined {
|
||||||
const fAttribute = this.getFAttributeFromField(field);
|
const fAttribute = this.getFAttributeFromField(field);
|
||||||
if (fAttribute) {
|
if (fAttribute) {
|
||||||
return {
|
return {
|
||||||
name: fAttribute.name,
|
name: fAttribute.name,
|
||||||
value: fAttribute.value,
|
value: fAttribute.value,
|
||||||
type: fAttribute.type
|
type: fAttribute.type,
|
||||||
|
isInheritable: fAttribute.isInheritable
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user