[DE] Add settings for macros
This commit is contained in:
parent
84cbbf9813
commit
5766138138
|
@ -137,7 +137,7 @@
|
|||
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
|
||||
macrosMode: 'warn' // warn about automatic macros, 'enable', 'disable', 'warn'
|
||||
},
|
||||
plugins: {
|
||||
autostart: ['asc.{FFE1F462-1EA2-4391-990D-4CC84940B754}'],
|
||||
|
|
|
@ -384,6 +384,14 @@ define([
|
|||
$('#editor-container').append('<div class="doc-placeholder">' + '<div class="line"></div>'.repeat(20) + '</div>');
|
||||
}
|
||||
|
||||
var value = Common.localStorage.getItem("de-macros-mode");
|
||||
if (value === null) {
|
||||
value = this.editorConfig.customization ? this.editorConfig.customization.macrosMode : 'warn';
|
||||
value = (value == 'enable') ? 1 : (value == 'disable' ? 2 : 0);
|
||||
} else
|
||||
value = parseInt(value);
|
||||
Common.Utils.InternalSettings.set("de-macros-mode", value);
|
||||
|
||||
Common.Controllers.Desktop.init(this.appOptions);
|
||||
},
|
||||
|
||||
|
@ -2246,29 +2254,30 @@ define([
|
|||
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
|
||||
var value = Common.Utils.InternalSettings.get("de-macros-mode");
|
||||
if (value==1)
|
||||
this.api.asc_runAutostartMacroses();
|
||||
else if (value === 0) {
|
||||
Common.UI.warning({
|
||||
msg: this.textHasMacros + '<br>',
|
||||
buttons: ['yes', 'no'],
|
||||
primary: 'yes',
|
||||
dontshow: true,
|
||||
textDontShow: this.textRemember,
|
||||
callback: function(btn, dontshow){
|
||||
if (dontshow) {
|
||||
Common.Utils.InternalSettings.set("de-macros-mode", (btn == 'yes') ? 1 : 2);
|
||||
Common.localStorage.setItem("de-macros-mode", (btn == 'yes') ? 1 : 2);
|
||||
}
|
||||
if (btn == 'yes') {
|
||||
setTimeout(function() {
|
||||
me.api.asc_runAutostartMacroses();
|
||||
}, 1);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
@ -234,6 +234,12 @@ define([
|
|||
'<td class="left"><label><%= scope.strUnit %></label></td>',
|
||||
'<td class="right"><span id="fms-cmb-unit" /></td>',
|
||||
'</tr>','<tr class="divider edit"></tr>',
|
||||
'<tr class="macros">',
|
||||
'<td class="left"><label><%= scope.strMacrosSettings %></label></td>',
|
||||
'<td class="right">',
|
||||
'<div><div id="fms-cmb-macros" style="display: inline-block; margin-right: 15px;vertical-align: middle;"/>',
|
||||
'<label id="fms-lbl-macros" style="vertical-align: middle;"><%= scope.txtWarnMacrosDesc %></label></div></td>',
|
||||
'</tr>','<tr class="divider macros"></tr>',
|
||||
'<tr>',
|
||||
'<td class="left"></td>',
|
||||
'<td class="right"><button id="fms-btn-apply" class="btn normal dlg-btn primary"><%= scope.okButtonText %></button></td>',
|
||||
|
@ -388,6 +394,21 @@ define([
|
|||
]
|
||||
});
|
||||
|
||||
this.cmbMacros = new Common.UI.ComboBox({
|
||||
el : $markup.findById('#fms-cmb-macros'),
|
||||
style : 'width: 160px;',
|
||||
editable : false,
|
||||
cls : 'input-group-nr',
|
||||
data : [
|
||||
{ value: 2, displayValue: this.txtStopMacros, descValue: this.txtStopMacrosDesc },
|
||||
{ value: 0, displayValue: this.txtWarnMacros, descValue: this.txtWarnMacrosDesc },
|
||||
{ value: 1, displayValue: this.txtRunMacros, descValue: this.txtRunMacrosDesc }
|
||||
]
|
||||
}).on('selected', function(combo, record) {
|
||||
me.lblMacrosDesc.text(record.descValue);
|
||||
});
|
||||
this.lblMacrosDesc = $markup.findById('#fms-lbl-macros');
|
||||
|
||||
this.btnApply = new Common.UI.Button({
|
||||
el: $markup.findById('#fms-btn-apply')
|
||||
});
|
||||
|
@ -425,6 +446,8 @@ define([
|
|||
$('tr.coauth.changes', this.el)[mode.isEdit && !mode.isOffline && mode.canCoAuthoring ? 'show' : 'hide']();
|
||||
$('tr.comments', this.el)[mode.canCoAuthoring ? 'show' : 'hide']();
|
||||
/** coauthoring end **/
|
||||
|
||||
$('tr.macros', this.el)[(mode.customization && mode.customization.macros===false) ? 'hide' : 'show']();
|
||||
},
|
||||
|
||||
updateSettings: function() {
|
||||
|
@ -475,6 +498,10 @@ define([
|
|||
this.chSpell.setValue(Common.Utils.InternalSettings.get("de-settings-spellcheck"));
|
||||
this.chAlignGuides.setValue(Common.Utils.InternalSettings.get("de-settings-showsnaplines"));
|
||||
this.chCompatible.setValue(Common.Utils.InternalSettings.get("de-settings-compatible"));
|
||||
|
||||
item = this.cmbMacros.store.findWhere({value: Common.Utils.InternalSettings.get("de-macros-mode")});
|
||||
this.cmbMacros.setValue(item ? item.get('value') : 0);
|
||||
this.lblMacrosDesc.text(item ? item.get('descValue') : this.txtWarnMacrosDesc);
|
||||
},
|
||||
|
||||
applySettings: function() {
|
||||
|
@ -501,6 +528,10 @@ define([
|
|||
Common.localStorage.setItem("de-settings-compatible", this.chCompatible.isChecked() ? 1 : 0);
|
||||
Common.Utils.InternalSettings.set("de-settings-compatible", this.chCompatible.isChecked() ? 1 : 0);
|
||||
Common.Utils.InternalSettings.set("de-settings-showsnaplines", this.chAlignGuides.isChecked());
|
||||
|
||||
Common.localStorage.setItem("de-macros-mode", this.cmbMacros.getValue());
|
||||
Common.Utils.InternalSettings.set("de-macros-mode", Common.localStorage.getItem("de-macros-mode"));
|
||||
|
||||
Common.localStorage.save();
|
||||
|
||||
if (this.menu) {
|
||||
|
@ -575,7 +606,14 @@ define([
|
|||
strResolvedComment: 'Turn on display of the resolved comments',
|
||||
textCompatible: 'Compatibility',
|
||||
textOldVersions: 'Make the files compatible with older MS Word versions when saved as DOCX',
|
||||
txtCacheMode: 'Default cache mode'
|
||||
txtCacheMode: 'Default cache mode',
|
||||
strMacrosSettings: 'Macros Settings',
|
||||
txtWarnMacros: 'Show Notification',
|
||||
txtRunMacros: 'Enable All',
|
||||
txtStopMacros: 'Disable All',
|
||||
txtWarnMacrosDesc: 'Disable all macros with notification',
|
||||
txtRunMacrosDesc: 'Enable all macros without notification',
|
||||
txtStopMacrosDesc: 'Disable all macros without notification'
|
||||
}, DE.Views.FileMenuPanels.Settings || {}));
|
||||
|
||||
DE.Views.FileMenuPanels.RecentFiles = Common.UI.BaseView.extend({
|
||||
|
|
Loading…
Reference in a new issue