Fix renaming attachment from right-hand pane
This commit is contained in:
parent
9073239292
commit
1633a73c3e
1 changed files with 82 additions and 80 deletions
|
@ -385,6 +385,7 @@
|
|||
<method name="editTitle">
|
||||
<body>
|
||||
<![CDATA[
|
||||
return Zotero.spawn(function* () {
|
||||
var item = document.getBindingParent(this).item;
|
||||
var oldTitle = item.getField('title');
|
||||
|
||||
|
@ -440,7 +441,7 @@
|
|||
var oldExt = item.getFilename().match(/\.\w{1,10}$/);
|
||||
if (oldExt) newFilename += oldExt[0];
|
||||
}
|
||||
var renamed = item.renameAttachmentFile(newFilename);
|
||||
var renamed = yield item.renameAttachmentFile(newFilename);
|
||||
if (renamed == -1) {
|
||||
var confirmed = nsIPS.confirm(
|
||||
window,
|
||||
|
@ -454,7 +455,7 @@
|
|||
}
|
||||
|
||||
// Force overwrite, but make sure we check that this doesn't fail
|
||||
renamed = item.renameAttachmentFile(newFilename, true);
|
||||
renamed = yield item.renameAttachmentFile(newFilename, true);
|
||||
}
|
||||
|
||||
if (renamed == -2) {
|
||||
|
@ -479,8 +480,9 @@
|
|||
|
||||
if (newTitle.value != oldTitle) {
|
||||
item.setField('title', newTitle.value);
|
||||
item.save();
|
||||
yield item.saveTx();
|
||||
}
|
||||
}.bind(this));
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
|
Loading…
Add table
Reference in a new issue