Allow attachmentLinkMode to be specified as a string ('linked_url')
This commit is contained in:
parent
93a6a4ffdb
commit
b0f52a0f07
|
@ -2699,13 +2699,21 @@ Zotero.defineProperty(Zotero.Item.prototype, 'attachmentLinkMode', {
|
||||||
throw (".attachmentLinkMode can only be set for attachment items");
|
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) {
|
switch (val) {
|
||||||
case Zotero.Attachments.LINK_MODE_IMPORTED_FILE:
|
case Zotero.Attachments.LINK_MODE_IMPORTED_FILE:
|
||||||
case Zotero.Attachments.LINK_MODE_IMPORTED_URL:
|
case Zotero.Attachments.LINK_MODE_IMPORTED_URL:
|
||||||
case Zotero.Attachments.LINK_MODE_LINKED_FILE:
|
case Zotero.Attachments.LINK_MODE_LINKED_FILE:
|
||||||
case Zotero.Attachments.LINK_MODE_LINKED_URL:
|
case Zotero.Attachments.LINK_MODE_LINKED_URL:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
throw ("Invalid attachment link mode '" + val
|
throw ("Invalid attachment link mode '" + val
|
||||||
+ "' in Zotero.Item.attachmentLinkMode setter");
|
+ "' in Zotero.Item.attachmentLinkMode setter");
|
||||||
|
|
Loading…
Reference in New Issue
Block a user