From 6f093dba4a08ab70d4ac10e11659cd966fec9112 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Fri, 22 May 2020 18:34:00 +0300 Subject: [PATCH] [PE embedded][SSE embedded] Add parameters to api customization: macros, plugins --- .../embed/js/ApplicationController.js | 12 ++++++++++++ .../embed/js/ApplicationController.js | 11 +++++++++++ 2 files changed, 23 insertions(+) diff --git a/apps/presentationeditor/embed/js/ApplicationController.js b/apps/presentationeditor/embed/js/ApplicationController.js index ffaf30b11..ca7a6b9ae 100644 --- a/apps/presentationeditor/embed/js/ApplicationController.js +++ b/apps/presentationeditor/embed/js/ApplicationController.js @@ -101,8 +101,14 @@ PE.ApplicationController = new(function(){ docInfo.put_Token(docConfig.token); docInfo.put_Permissions(_permissions); + var enable = !config.customization || (config.customization.macros!==false); + docInfo.asc_putIsEnabledMacroses(!!enable); + enable = !config.customization || (config.customization.plugins!==false); + docInfo.asc_putIsEnabledPlugins(!!enable); + if (api) { api.asc_registerCallback('asc_onGetEditorPermissions', onEditorPermissions); + api.asc_registerCallback('asc_onRunAutostartMacroses', onRunAutostartMacroses); api.asc_setDocInfo(docInfo); api.asc_getEditorPermissions(config.licenseUrl, config.customerId); api.asc_enableKeyEvents(true); @@ -580,6 +586,12 @@ PE.ApplicationController = new(function(){ } if (api) api.asc_DownloadAs(new Asc.asc_CDownloadOptions(Asc.c_oAscFileType.PPTX, true)); } + + function onRunAutostartMacroses() { + if (!config.customization || (config.customization.macros!==false)) + if (api) api.asc_runAutostartMacroses(); + } + // Helpers // ------------------------- diff --git a/apps/spreadsheeteditor/embed/js/ApplicationController.js b/apps/spreadsheeteditor/embed/js/ApplicationController.js index 722ed7a11..225f2b811 100644 --- a/apps/spreadsheeteditor/embed/js/ApplicationController.js +++ b/apps/spreadsheeteditor/embed/js/ApplicationController.js @@ -99,8 +99,14 @@ SSE.ApplicationController = new(function(){ docInfo.put_Token(docConfig.token); docInfo.put_Permissions(_permissions); + var enable = !config.customization || (config.customization.macros!==false); + docInfo.asc_putIsEnabledMacroses(!!enable); + enable = !config.customization || (config.customization.plugins!==false); + docInfo.asc_putIsEnabledPlugins(!!enable); + if (api) { api.asc_registerCallback('asc_onGetEditorPermissions', onEditorPermissions); + api.asc_registerCallback('asc_onRunAutostartMacroses', onRunAutostartMacroses); api.asc_setDocInfo(docInfo); api.asc_getEditorPermissions(config.licenseUrl, config.customerId); api.asc_enableKeyEvents(true); @@ -531,6 +537,11 @@ SSE.ApplicationController = new(function(){ } } + function onRunAutostartMacroses() { + if (!config.customization || (config.customization.macros!==false)) + if (api) api.asc_runAutostartMacroses(); + } + // Helpers // -------------------------