Little fixes to note editor:

- Fix invalid selector
- Filter itself sent postMessage messages
This commit is contained in:
Martynas Bagdonas 2021-07-19 23:11:45 +03:00
parent 6a6e4fa92c
commit aa11c36a64

View file

@ -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;