mirror of
https://github.com/jxpeng98/obsidian-to-NotionNext
synced 2026-07-29 16:35:57 +08:00
feat: cancel function works well
This commit is contained in:
@@ -70,7 +70,7 @@ export class EditModal extends SettingModal {
|
|||||||
this.dataTemp.tagButtonTemp = dbDetails.tagButton;
|
this.dataTemp.tagButtonTemp = dbDetails.tagButton;
|
||||||
this.dataTemp.customTitleButtonTemp = dbDetails.customTitleButton;
|
this.dataTemp.customTitleButtonTemp = dbDetails.customTitleButton;
|
||||||
this.dataTemp.customTitleNameTemp = dbDetails.customTitleName;
|
this.dataTemp.customTitleNameTemp = dbDetails.customTitleName;
|
||||||
this.dataTemp.customPropertiesTemp = dbDetails.customProperties;
|
this.dataTemp.customPropertiesTemp = dbDetails.customProperties.map(prop => ({ ...prop })); // Ensure deep copy
|
||||||
// this.dataTemp.customValues = dbDetails.customValues;
|
// this.dataTemp.customValues = dbDetails.customValues;
|
||||||
this.dataTemp.savedTemp = dbDetails.saved;
|
this.dataTemp.savedTemp = dbDetails.saved;
|
||||||
|
|
||||||
@@ -83,7 +83,7 @@ export class EditModal extends SettingModal {
|
|||||||
this.dataPrev.tagButtonPrev = dbDetails.tagButton;
|
this.dataPrev.tagButtonPrev = dbDetails.tagButton;
|
||||||
this.dataPrev.customTitleButtonPrev = dbDetails.customTitleButton;
|
this.dataPrev.customTitleButtonPrev = dbDetails.customTitleButton;
|
||||||
this.dataPrev.customTitleNamePrev = dbDetails.customTitleName;
|
this.dataPrev.customTitleNamePrev = dbDetails.customTitleName;
|
||||||
this.dataPrev.customPropertiesPrev = dbDetails.customProperties;
|
this.dataPrev.customPropertiesPrev = dbDetails.customProperties.map(prop => ({ ...prop })); // Ensure deep copy
|
||||||
// this.dataTemp.customValues = dbDetails.customValues;
|
// this.dataTemp.customValues = dbDetails.customValues;
|
||||||
this.dataPrev.savedPrev = dbDetails.saved;
|
this.dataPrev.savedPrev = dbDetails.saved;
|
||||||
}
|
}
|
||||||
@@ -132,8 +132,6 @@ export class EditModal extends SettingModal {
|
|||||||
.onClick(async () => {
|
.onClick(async () => {
|
||||||
this.dataTemp.savedTempInd = true;
|
this.dataTemp.savedTempInd = true;
|
||||||
this.dataTemp.savedTemp = true;
|
this.dataTemp.savedTemp = true;
|
||||||
this.dataPrev = { ...this.dataTemp };
|
|
||||||
this.dataPrev.customPropertiesPrev = this.dataTemp.customPropertiesTemp.slice();
|
|
||||||
this.close();
|
this.close();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -143,10 +141,8 @@ export class EditModal extends SettingModal {
|
|||||||
.setTooltip('Cancel')
|
.setTooltip('Cancel')
|
||||||
.setIcon('cross')
|
.setIcon('cross')
|
||||||
.onClick(() => {
|
.onClick(() => {
|
||||||
this.dataTemp = { ...this.dataPrev };
|
console.log(this.dataTemp);
|
||||||
this.dataTemp.customPropertiesTemp = this.dataPrev.customPropertiesPrev.slice();
|
console.log(this.dataPrev);
|
||||||
nextTabs.empty();
|
|
||||||
this.updateContentBasedOnSelection(this.dataTemp.databaseFormatTemp, nextTabs);
|
|
||||||
this.close();
|
this.close();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -154,12 +150,9 @@ export class EditModal extends SettingModal {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onOpen(): void {
|
onOpen(): void {
|
||||||
// Backup initial state when the modal is opened
|
|
||||||
this.dataPrev.customPropertiesPrev = this.dataTemp.customPropertiesTemp.slice();
|
|
||||||
this.display()
|
this.display()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
updateContentBasedOnSelection(value: string, nextTabs: HTMLElement): void {
|
updateContentBasedOnSelection(value: string, nextTabs: HTMLElement): void {
|
||||||
// Clear existing content
|
// Clear existing content
|
||||||
nextTabs.empty();
|
nextTabs.empty();
|
||||||
|
|||||||
Reference in New Issue
Block a user