From aa11c36a64153a9faf13da2746660ca77a14f42e Mon Sep 17 00:00:00 2001 From: Martynas Bagdonas Date: Mon, 19 Jul 2021 23:11:45 +0300 Subject: [PATCH] Little fixes to note editor: - Fix invalid selector - Filter itself sent postMessage messages --- chrome/content/zotero/xpcom/editorInstance.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/chrome/content/zotero/xpcom/editorInstance.js b/chrome/content/zotero/xpcom/editorInstance.js index ebda503aa4..4044022caf 100644 --- a/chrome/content/zotero/xpcom/editorInstance.js +++ b/chrome/content/zotero/xpcom/editorInstance.js @@ -522,7 +522,7 @@ class EditorInstance { } }); - let node = doc.querySelector(`img[data-attachment-key=${attachment.key}]`); + let node = doc.querySelector(`img[data-attachment-key="${attachment.key}"]`); if (node) { node.setAttribute('data-attachment-key', clonedAttachment.key); } @@ -535,7 +535,8 @@ class EditorInstance { } _messageHandler = async (e) => { - if (e.data.instanceID !== this.instanceID) { + if (e.source !== this._iframeWindow + || e.data.instanceID !== this.instanceID) { return; } let message = e.data.message;