Allow attachmentLinkMode to be specified as a string ('linked_url')

This commit is contained in:
Dan Stillman 2015-05-05 14:07:48 -04:00
parent 93a6a4ffdb
commit b0f52a0f07

View File

@ -2699,6 +2699,14 @@ Zotero.defineProperty(Zotero.Item.prototype, 'attachmentLinkMode', {
throw (".attachmentLinkMode can only be set for attachment items");
}
// Allow 'imported_url', etc.
if (typeof val == 'string') {
let code = Zotero.Attachments["LINK_MODE_" + val.toUpperCase()];
if (code !== undefined) {
val = code;
}
}
switch (val) {
case Zotero.Attachments.LINK_MODE_IMPORTED_FILE:
case Zotero.Attachments.LINK_MODE_IMPORTED_URL: