From 3f4030ff80e1d027c416af23024e3e1b071163f3 Mon Sep 17 00:00:00 2001 From: Martynas Bagdonas Date: Fri, 1 Apr 2022 16:38:19 +0700 Subject: [PATCH] Allow copying image annotations to external text fields Fixes #2447 --- chrome/content/zotero/xpcom/reader.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/chrome/content/zotero/xpcom/reader.js b/chrome/content/zotero/xpcom/reader.js index e442f53d37..380b079737 100644 --- a/chrome/content/zotero/xpcom/reader.js +++ b/chrome/content/zotero/xpcom/reader.js @@ -295,6 +295,14 @@ class ReaderInstance { Zotero.logError(event.error); }); this._iframeWindow.wrappedJSObject.zoteroSetDataTransferAnnotations = (dataTransfer, annotations) => { + // A small hack to force serializeAnnotations to include image annotation + // even if image isn't saved and imageAttachmentKey isn't available + for (let annotation of annotations) { + if (annotation.image && !annotation.imageAttachmentKey) { + annotation.imageAttachmentKey = 'none'; + delete annotation.image; + } + } let res = Zotero.EditorInstanceUtilities.serializeAnnotations(annotations); let tmpNote = new Zotero.Item('note'); tmpNote.libraryID = Zotero.Libraries.userLibraryID;