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