[DE mobile][DE embedded] Add parameters to api customization: macros, plugins

This commit is contained in:
Julia Radzhabova 2020-05-22 15:04:55 +03:00
parent 10d596be29
commit c9d810dc03
2 changed files with 22 additions and 0 deletions

View file

@ -100,6 +100,11 @@ DE.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);
var type = /^(?:(pdf|djvu|xps))$/.exec(docConfig.fileType);
if (type && typeof type[1] === 'string') {
permissions.edit = permissions.review = false;
@ -107,6 +112,7 @@ DE.ApplicationController = new(function(){
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);
@ -481,6 +487,11 @@ DE.ApplicationController = new(function(){
if (api) api.asc_DownloadAs(new Asc.asc_CDownloadOptions(Asc.c_oAscFileType.DOCX, true));
}
function onRunAutostartMacroses() {
if (!config.customization || (config.customization.macros!==false))
if (api) api.asc_runAutostartMacroses();
}
// Helpers
// -------------------------

View file

@ -255,6 +255,11 @@ define([
docInfo.put_Permissions(_permissions);
docInfo.put_EncryptedInfo(this.editorConfig.encryptionKeys);
var enable = !this.editorConfig.customization || (this.editorConfig.customization.macros!==false);
docInfo.asc_putIsEnabledMacroses(!!enable);
enable = !this.editorConfig.customization || (this.editorConfig.customization.plugins!==false);
docInfo.asc_putIsEnabledPlugins(!!enable);
var type = /^(?:(pdf|djvu|xps))$/.exec(data.doc.fileType);
if (type && typeof type[1] === 'string') {
this.permissions.edit = this.permissions.review = false;
@ -263,6 +268,7 @@ define([
this.api.asc_registerCallback('asc_onGetEditorPermissions', _.bind(this.onEditorPermissions, this));
this.api.asc_registerCallback('asc_onLicenseChanged', _.bind(this.onLicenseChanged, this));
this.api.asc_registerCallback('asc_onRunAutostartMacroses', _.bind(this.onRunAutostartMacroses, this));
this.api.asc_setDocInfo(docInfo);
this.api.asc_getEditorPermissions(this.editorConfig.licenseUrl, this.editorConfig.customerId);
@ -1369,6 +1375,11 @@ define([
return false;
},
onRunAutostartMacroses: function() {
if (!this.editorConfig.customization || (this.editorConfig.customization.macros!==false))
if (this.api) this.api.asc_runAutostartMacroses();
},
leavePageText: 'You have unsaved changes in this document. Click \'Stay on this Page\' to await the autosave of the document. Click \'Leave this Page\' to discard all the unsaved changes.',
criticalErrorTitle: 'Error',
notcriticalErrorTitle: 'Warning',