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,
|
spellcheck: true,
|
||||||
compatibleFeatures: false,
|
compatibleFeatures: false,
|
||||||
unit: 'cm' // cm, pt, inch,
|
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: {
|
plugins: {
|
||||||
autostart: ['asc.{FFE1F462-1EA2-4391-990D-4CC84940B754}'],
|
autostart: ['asc.{FFE1F462-1EA2-4391-990D-4CC84940B754}'],
|
||||||
|
|
|
@ -136,7 +136,8 @@
|
||||||
var Common = {};
|
var Common = {};
|
||||||
|
|
||||||
define([
|
define([
|
||||||
'common/main/lib/component/BaseView'
|
'common/main/lib/component/BaseView',
|
||||||
|
'common/main/lib/component/CheckBox'
|
||||||
], function () {
|
], function () {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
|
|
@ -415,6 +415,11 @@ define([
|
||||||
docInfo.put_Token(data.doc.token);
|
docInfo.put_Token(data.doc.token);
|
||||||
docInfo.put_Permissions(_permissions);
|
docInfo.put_Permissions(_permissions);
|
||||||
docInfo.put_EncryptedInfo(this.editorConfig.encryptionKeys);
|
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);
|
// docInfo.put_Review(this.permissions.review);
|
||||||
|
|
||||||
var type = /^(?:(pdf|djvu|xps))$/.exec(data.doc.fileType);
|
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_onGetEditorPermissions', _.bind(this.onEditorPermissions, this));
|
||||||
this.api.asc_registerCallback('asc_onLicenseChanged', _.bind(this.onLicenseChanged, 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_setDocInfo(docInfo);
|
||||||
this.api.asc_getEditorPermissions(this.editorConfig.licenseUrl, this.editorConfig.customerId);
|
this.api.asc_getEditorPermissions(this.editorConfig.licenseUrl, this.editorConfig.customerId);
|
||||||
|
|
||||||
|
@ -2236,6 +2242,36 @@ define([
|
||||||
Common.Utils.warningDocumentIsLocked({disablefunc: _disable_ui});
|
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.',
|
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',
|
criticalErrorTitle: 'Error',
|
||||||
notcriticalErrorTitle: 'Warning',
|
notcriticalErrorTitle: 'Warning',
|
||||||
|
@ -2587,7 +2623,9 @@ define([
|
||||||
textApplyAll: 'Apply to all equations',
|
textApplyAll: 'Apply to all equations',
|
||||||
textLearnMore: 'Learn More',
|
textLearnMore: 'Learn More',
|
||||||
txtEnterDate: 'Enter a date.',
|
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 || {}))
|
})(), DE.Controllers.Main || {}))
|
||||||
});
|
});
|
Loading…
Reference in a new issue