Add parameters to api customization: macros (can run macros in document), plugins (can run plugins in document), showMacrosWarning (warn about macros in document).
This commit is contained in:
parent
b904bb19bc
commit
84cbbf9813
|
@ -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}'],
|
||||
|
|
|
@ -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';
|
||||
|
||||
|
|
|
@ -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 + '<br>',
|
||||
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.<br>Do you want to run macros?',
|
||||
textRemember: 'Remember my choice'
|
||||
}
|
||||
})(), DE.Controllers.Main || {}))
|
||||
});
|
Loading…
Reference in a new issue