diff --git a/apps/api/documents/api.js b/apps/api/documents/api.js
index 0f8d84ec8..21fe1e65d 100644
--- a/apps/api/documents/api.js
+++ b/apps/api/documents/api.js
@@ -134,7 +134,10 @@
spellcheck: true,
compatibleFeatures: false,
unit: 'cm' // cm, pt, inch,
- mentionShare : true // customize tooltip for mention
+ mentionShare : true // customize tooltip for mention,
+ macros: true // can run macros in document
+ plugins: true // can run plugins in document
+ showMacrosWarning: true // warn about automatic macros
},
plugins: {
autostart: ['asc.{FFE1F462-1EA2-4391-990D-4CC84940B754}'],
diff --git a/apps/common/main/lib/component/Window.js b/apps/common/main/lib/component/Window.js
index 0d2a153c8..c3a142c65 100644
--- a/apps/common/main/lib/component/Window.js
+++ b/apps/common/main/lib/component/Window.js
@@ -136,7 +136,8 @@
var Common = {};
define([
- 'common/main/lib/component/BaseView'
+ 'common/main/lib/component/BaseView',
+ 'common/main/lib/component/CheckBox'
], function () {
'use strict';
diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js
index 4a093b4c0..25ef20ec5 100644
--- a/apps/documenteditor/main/app/controller/Main.js
+++ b/apps/documenteditor/main/app/controller/Main.js
@@ -415,6 +415,11 @@ define([
docInfo.put_Token(data.doc.token);
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);
// docInfo.put_Review(this.permissions.review);
var type = /^(?:(pdf|djvu|xps))$/.exec(data.doc.fileType);
@@ -425,6 +430,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);
@@ -2236,6 +2242,36 @@ define([
Common.Utils.warningDocumentIsLocked({disablefunc: _disable_ui});
},
+ onRunAutostartMacroses: function() {
+ var me = this,
+ enable = !this.editorConfig.customization || (this.editorConfig.customization.macros!==false);
+ if (enable) {
+ if (!this.editorConfig.customization || (this.editorConfig.customization.showMacrosWarning!==false)) {
+ var value = Common.localStorage.getItem("de-macros-start");
+ if (value===null) {
+ Common.UI.warning({
+ msg: this.textHasMacros + '
',
+ buttons: ['yes', 'no'],
+ primary: 'yes',
+ dontshow: true,
+ textDontShow: this.textRemember,
+ callback: function(btn, dontshow){
+ if (dontshow)
+ Common.localStorage.setItem("de-macros-start", (btn == 'yes') ? 1 : 0);
+ if (btn == 'yes') {
+ setTimeout(function() {
+ me.api.asc_runAutostartMacroses();
+ }, 1);
+ }
+ }
+ });
+ } else if (parseInt(value)==1)
+ this.api.asc_runAutostartMacroses();
+ } else
+ this.api.asc_runAutostartMacroses();
+ }
+ },
+
leavePageText: 'You have unsaved changes in this document. Click \'Stay on this Page\' then \'Save\' to save them. Click \'Leave this Page\' to discard all the unsaved changes.',
criticalErrorTitle: 'Error',
notcriticalErrorTitle: 'Warning',
@@ -2587,7 +2623,9 @@ define([
textApplyAll: 'Apply to all equations',
textLearnMore: 'Learn More',
txtEnterDate: 'Enter a date.',
- txtTypeEquation: 'Type equation here.'
+ txtTypeEquation: 'Type equation here.',
+ textHasMacros: 'The file contains automatic macros.
Do you want to run macros?',
+ textRemember: 'Remember my choice'
}
})(), DE.Controllers.Main || {}))
});
\ No newline at end of file