Skip to content

Commit

Permalink
Fixed image import on iOS
Browse files Browse the repository at this point in the history
  • Loading branch information
michalrentka committed May 1, 2024
1 parent a09eb4a commit 142416b
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/index.ios.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class EditorInstance {
this._postMessage({ action: 'unsubscribe', id, type });
},
onImportImages: (images) => {
// this._postMessage({ action: 'importImages', images });
this._postMessage({ action: 'importImages', images });
},
onUpdate: () => {
let data = this._editorCore.getData();
Expand Down Expand Up @@ -207,11 +207,6 @@ document.addEventListener('click', () => {
// // this._editorCore.updateCitationItems(citationItems);
// // return;
// // }
// // case 'attachImportedImage': {
// // let { nodeID, attachmentKey } = message;
// // this._editorCore.attachImportedImage(nodeID, attachmentKey);
// // return;
// // }
// // case 'insertHTML': {
// // let { pos, html } = message;
// // this._editorCore.insertHTML(pos, html);
Expand All @@ -220,9 +215,17 @@ document.addEventListener('click', () => {
// }
// }

window.attachImportedImage = encodedMessage => {
let message = JSON.parse(decodeBase64(encodedMessage));
let { nodeID, attachmentKey } = message;
log("Attach imported node: " + nodeID + "; key: " + attachmentKey);
currentInstance._editorCore.attachImportedImage(nodeID, attachmentKey);
}

window.notifySubscription = encodedMessage => {
let message = JSON.parse(decodeBase64(encodedMessage));
let { id, data } = message;
log("Notify subscription: " + id);
currentInstance._editorCore.provider.notify(id, data);
}

Expand Down

0 comments on commit 142416b

Please sign in to comment.