Ensure that we pass WebPageDump an XPCNativeWrapper
Fixes some CSS issues in snapshots
This commit is contained in:
parent
f1a3cb3577
commit
7d19e17bb9
|
@ -412,9 +412,10 @@ Zotero.Translate.ItemSaver.prototype = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var doc = undefined;
|
||||||
if(attachment.document) {
|
if(attachment.document) {
|
||||||
attachment.document = Zotero.Translate.DOMWrapper.unwrap(attachment.document);
|
doc = new XPCNativeWrapper(Zotero.Translate.DOMWrapper.unwrap(attachment.document));
|
||||||
if(!attachment.title) attachment.title = attachment.document.title;
|
if(!attachment.title) attachment.title = doc.title;
|
||||||
}
|
}
|
||||||
var title = attachment.title || null;
|
var title = attachment.title || null;
|
||||||
if(!title) {
|
if(!title) {
|
||||||
|
@ -426,9 +427,9 @@ Zotero.Translate.ItemSaver.prototype = {
|
||||||
// if snapshot is explicitly set to false, attach as link
|
// if snapshot is explicitly set to false, attach as link
|
||||||
attachment.linkMode = "linked_url";
|
attachment.linkMode = "linked_url";
|
||||||
let url, mimeType;
|
let url, mimeType;
|
||||||
if(attachment.document) {
|
if(doc) {
|
||||||
url = attachment.document.location.href;
|
url = doc.location.href;
|
||||||
mimeType = attachment.mimeType ? attachment.mimeType : attachment.document.contentType;
|
mimeType = attachment.mimeType ? attachment.mimeType : doc.contentType;
|
||||||
} else {
|
} else {
|
||||||
url = attachment.url
|
url = attachment.url
|
||||||
mimeType = attachment.mimeType ? attachment.mimeType : undefined;
|
mimeType = attachment.mimeType ? attachment.mimeType : undefined;
|
||||||
|
@ -464,10 +465,10 @@ Zotero.Translate.ItemSaver.prototype = {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
// if snapshot is not explicitly set to false, retrieve snapshot
|
// if snapshot is not explicitly set to false, retrieve snapshot
|
||||||
if(attachment.document) {
|
if(doc) {
|
||||||
try {
|
try {
|
||||||
attachment.linkMode = "imported_url";
|
attachment.linkMode = "imported_url";
|
||||||
Zotero.Attachments.importFromDocument(attachment.document,
|
Zotero.Attachments.importFromDocument(doc,
|
||||||
parentID, title, null, function(status, err) {
|
parentID, title, null, function(status, err) {
|
||||||
if(status) {
|
if(status) {
|
||||||
attachmentCallback(attachment, 100);
|
attachmentCallback(attachment, 100);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user