diff options
author | Sergey Linnik <sergey.linnik@onlyoffice.com> | 2019-07-29 15:39:21 +0300 |
---|---|---|
committer | Sergey Linnik <sergey.linnik@onlyoffice.com> | 2019-08-23 15:48:24 +0300 |
commit | 4419951017d0d056c0382f1507b92ababbc44b19 (patch) | |
tree | 5ad5a9b18332abb19fbb0d68dd130a50de5e2302 /js | |
parent | 9703a3afd7b631fedfc995b9b134c38e66710555 (diff) |
mail merge
Diffstat (limited to 'js')
-rw-r--r-- | js/editor.js | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/js/editor.js b/js/editor.js index 5d6a1f7..b676094 100644 --- a/js/editor.js +++ b/js/editor.js @@ -108,6 +108,7 @@ if (OC.currentUser) { config.events.onRequestSaveAs = OCA.Onlyoffice.onRequestSaveAs; config.events.onRequestInsertImage = OCA.Onlyoffice.onRequestInsertImage; + config.events.onRequestMailMergeRecipients = OCA.Onlyoffice.onRequestMailMergeRecipients; } OCA.Onlyoffice.docEditor = new DocsAPI.DocEditor("iframeEditor", config); @@ -181,6 +182,33 @@ OC.dialogs.filepicker(t(OCA.Onlyoffice.AppName, "Insert image"), insertImage, false, imageMimes); }; + OCA.Onlyoffice.onRequestMailMergeRecipients = function() { + + var setRecipient = function(filePath) { + $.get(OC.generateUrl("apps/" + OCA.Onlyoffice.AppName + "/ajax/url?filePath={filePath}", + { + filePath: filePath + }), + function onSuccess(response) { + if (response.error) { + OC.Notification.show(response.error, { + type: "error", + timeout: 3 + }); + return; + } + + OCA.Onlyoffice.docEditor.setMailMergeRecipients(response); + }); + }; + + var recipientMimes = [ + "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" + ]; + + OC.dialogs.filepicker(t(OCA.Onlyoffice.AppName, "Select recipients"), setRecipient, false, recipientMimes); + }; + $(document).ready(OCA.Onlyoffice.InitEditor); })(jQuery, OCA); |