Scaffold: Prompt to save before resetting
Now that Scaffold remembers and automatically loads the last edited translator
(65048fd624
), it needs to be easier to create a
new translator without saving (and bumping the lastModified date on) the
translator you had open.
This commit is contained in:
parent
ef7916b320
commit
345bbcf50c
1 changed files with 17 additions and 4 deletions
|
@ -602,10 +602,23 @@ var Scaffold = new function () {
|
||||||
this.setFontSize(currentSize - 2);
|
this.setFontSize(currentSize - 2);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.newTranslator = async function (skipSave) {
|
this.newTranslator = async function (skipSavePrompt) {
|
||||||
if (!skipSave) {
|
if (!skipSavePrompt && _editors.code.getValue()) {
|
||||||
_logOutput('Saving translator and resetting...');
|
let ps = Services.prompt;
|
||||||
await this.save();
|
let buttonFlags = ps.BUTTON_POS_0 * ps.BUTTON_TITLE_IS_STRING
|
||||||
|
+ ps.BUTTON_POS_1 * ps.BUTTON_TITLE_IS_STRING;
|
||||||
|
let label = document.getElementById('textbox-label').value;
|
||||||
|
let index = ps.confirmEx(null,
|
||||||
|
"Scaffold",
|
||||||
|
`Do you want to save the changes you made to ${label}?`,
|
||||||
|
buttonFlags,
|
||||||
|
Zotero.getString('general.no'),
|
||||||
|
Zotero.getString('general.yes'),
|
||||||
|
null, null, {}
|
||||||
|
);
|
||||||
|
if (index == 1 && !await this.save()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.generateTranslatorID();
|
this.generateTranslatorID();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue