Merge pull request 'feature/de-record-macro' (#687) from feature/de-record-macro into release/v9.2.0

This commit is contained in:
Julia Radzhabova
2025-11-01 13:06:45 +00:00
12 changed files with 285 additions and 15 deletions

View File

@ -67,6 +67,10 @@ define([
if (api) {
this.api = api;
this.api.asc_registerCallback('asc_onZoomChange', _.bind(this.onZoomChange, this));
this.api.asc_registerCallback('asc_onMacroRecordingStart', _.bind(this.updateMacroState, this, true, false));
this.api.asc_registerCallback('asc_onMacroRecordingStop', _.bind(this.updateMacroState, this, false));
this.api.asc_registerCallback('asc_onMacroRecordingPause', _.bind(this.updateMacroState, this, true, true));
this.api.asc_registerCallback('asc_onMacroRecordingResume', _.bind(this.updateMacroState, this, true, false));
this.api.asc_registerCallback('asc_onCoAuthoringDisconnect', _.bind(this.onCoAuthoringDisconnect, this));
Common.NotificationCenter.on('api:disconnect', _.bind(this.onCoAuthoringDisconnect, this));
}
@ -88,6 +92,8 @@ define([
'rulers:change': _.bind(this.onChangeRulers, this),
'darkmode:change': _.bind(this.onChangeDarkMode, this),
'macros:click': _.bind(this.onClickMacros, this),
'macros:record': _.bind(this.onClickMacrosRec, this),
'macros:pause': _.bind(this.onClickMacrosPause, this),
'pointer:select': _.bind(this.onPointerType, this, 'select'),
'pointer:hand': _.bind(this.onPointerType, this, 'hand')
},
@ -176,7 +182,7 @@ define([
}
if (!config.isEdit || config.customization && config.customization.macros===false) {
me.view.$el.find('#slot-btn-macros').closest('.group').prev().addBack().remove();
me.view.$el.find('.macro').remove();
}
me.view.cmbsZoom.forEach(function (cmb) {
@ -349,6 +355,39 @@ define([
macrosWindow.show();
},
onClickMacrosRec: function() {
var recorder = this.api.getMacroRecorder();
recorder.isInProgress() ? recorder.stop() : recorder.start();
Common.NotificationCenter.trigger('edit:complete', this.view);
},
onClickMacrosPause: function() {
var recorder = this.api.getMacroRecorder();
if (recorder.isInProgress()) {
recorder.isPaused() ? recorder.resume() : recorder.pause();
}
Common.NotificationCenter.trigger('edit:complete', this.view);
},
updateMacroState: function(inProgress, paused) {
if (this.view) {
this.view.btnRecMacro.changeIcon({
next: inProgress ? 'btn-macros-stop' : 'btn-macros-record',
curr: inProgress ? 'btn-macros-record' : 'btn-macros-stop'
});
this.view.btnRecMacro.setCaption(inProgress ? this.view.textStopMacro : this.view.textRecMacro);
this.view.btnRecMacro.updateHint(inProgress ? this.view.tipStopMacro : this.view.tipRecMacro);
Common.Utils.lockControls(Common.enumLock.macrosStopped, !inProgress, {array: [this.view.btnPauseMacro]});
if (!inProgress) {
this.view.btnPauseMacro.setCaption(this.view.textPauseMacro);
this.view.btnPauseMacro.updateHint(this.view.tipPauseMacro);
} else {
this.view.btnPauseMacro.setCaption(paused ? this.view.textResumeMacro : this.view.textPauseMacro);
this.view.btnPauseMacro.updateHint(paused ? this.view.tipResumeMacro : this.view.tipPauseMacro);
}
}
},
onChangeDarkMode: function (isdarkmode) {
if (!this._darkModeTimer) {
var me = this;
@ -393,7 +432,7 @@ define([
this.api.asc_setViewerTargetType(type);
Common.NotificationCenter.trigger('edit:complete', this.view);
}
},
}
}, DE.Controllers.ViewTab || {}));
});

View File

@ -124,7 +124,8 @@ define([
changeModeLock: 'change-mode-lock',
noStyles: 'no-styles',
cantMergeShape: 'merge-shape-lock',
cantSave: 'cant-save'
cantSave: 'cant-save',
macrosStopped: 'macros-stopped'
};
for (var key in enumLock) {
if (enumLock.hasOwnProperty(key)) {

View File

@ -100,10 +100,18 @@ define([
'</div>' +
'<div class="elset"></div>' +
'</div>' +
'<div class="separator long"></div>' +
'<div class="group">' +
'<div class="separator long macro"></div>' +
'<div class="group macro">' +
'<span class="btn-slot text x-huge" id="slot-btn-macros"></span>' +
'</div>' +
'<div class="group small macro">' +
'<div class="elset">' +
'<span class="btn-slot text" id="slot-btn-macro-start" style="text-align: center;"></span>' +
'</div>' +
'<div class="elset">' +
'<span class="btn-slot text" id="slot-btn-macro-pause" style="text-align: center;"></span>' +
'</div>' +
'</div>' +
'</section>';
return {
@ -149,6 +157,13 @@ define([
me.btnMacros && me.btnMacros.on('click', function () {
me.fireEvent('macros:click');
});
me.btnRecMacro && me.btnRecMacro.on('click', function () {
me.fireEvent('macros:record');
});
me.btnPauseMacro && me.btnPauseMacro.on('click', function () {
me.fireEvent('macros:pause');
});
me.btnSelectTool && me.btnSelectTool.on('toggle', _.bind(function(btn, state) {
state && me.fireEvent('pointer:select');
}, me));
@ -289,6 +304,28 @@ define([
dataHintOffset: 'small'
});
this.lockedControls.push(this.btnMacros);
this.btnRecMacro = new Common.UI.Button({
cls: 'btn-toolbar',
iconCls: 'toolbar__icon btn-macros-record',
lock: [_set.viewMode, _set.previewReviewMode, _set.viewFormMode, _set.docLockView, _set.docLockForms, _set.docLockComments, _set.lostConnect, _set.disableOnStart],
caption: this.textRecMacro,
dataHint: '1',
dataHintDirection: 'left',
dataHintOffset: 'medium'
});
this.lockedControls.push(this.btnRecMacro);
this.btnPauseMacro = new Common.UI.Button({
cls: 'btn-toolbar',
iconCls: 'toolbar__icon btn-macros-pause',
lock: [_set.macrosStopped, _set.viewMode, _set.previewReviewMode, _set.viewFormMode, _set.docLockView, _set.docLockForms, _set.docLockComments, _set.lostConnect, _set.disableOnStart],
caption: this.textPauseMacro,
dataHint: '1',
dataHintDirection: 'left',
dataHintOffset: 'medium'
});
this.lockedControls.push(this.btnPauseMacro);
} else if (!this.appConfig.isRestrictedEdit) {
this.btnSelectTool = new Common.UI.Button({
cls: 'btn-toolbar x-huge icon-top',
@ -375,6 +412,8 @@ define([
this.chRightMenu.render($host.find('#slot-chk-rightmenu'));
this.btnSelectTool && this.btnSelectTool.render($host.find('#slot-btn-select-tool-view'));
this.btnHandTool && this.btnHandTool.render($host.find('#slot-btn-hand-tool-view'));
this.btnRecMacro && this.btnRecMacro.render($host.find('#slot-btn-macro-start'));
this.btnPauseMacro && this.btnPauseMacro.render($host.find('#slot-btn-macro-pause'));
if (this.toolbar && this.toolbar.$el) {
this.btnsFitToPage = Common.Utils.injectButtons(this.toolbar.$el.find('.slot-btn-ftp'), 'tlbtn-btn-ftp-', 'toolbar__icon btn-ic-zoomtopage', this.textFitToPage,
@ -390,6 +429,7 @@ define([
Common.Utils.lockControls(Common.enumLock.disableOnStart, true, {array: created});
Array.prototype.push.apply(this.lockedControls, created);
Common.UI.LayoutManager.addControls(created);
Common.Utils.lockControls(Common.enumLock.macrosStopped, true, {array: [this.btnPauseMacro]});
return this.$el;
},
@ -405,6 +445,8 @@ define([
btn.updateHint(me.tipFitToWidth);
});
this.btnMacros && this.btnMacros.updateHint(this.tipMacros);
this.btnRecMacro && this.btnRecMacro.updateHint(this.tipRecMacro);
this.btnPauseMacro && this.btnPauseMacro.updateHint(this.tipPauseMacro);
var value = Common.UI.LayoutManager.getInitValue('leftMenu');
value = (value!==undefined) ? !value : false;

View File

@ -4259,6 +4259,14 @@
"DE.Views.ViewTab.tipHeadings": "Headings",
"DE.Views.ViewTab.tipInterfaceTheme": "Interface theme",
"DE.Views.ViewTab.tipMacros": "Macros",
"DE.Views.ViewTab.textRecMacro": "Record macro",
"DE.Views.ViewTab.textPauseMacro": "Pause recording",
"DE.Views.ViewTab.textResumeMacro": "Resume recording",
"DE.Views.ViewTab.textStopMacro": "Stop recording",
"DE.Views.ViewTab.tipRecMacro": "Record macro",
"DE.Views.ViewTab.tipPauseMacro": "Pause recording",
"DE.Views.ViewTab.tipResumeMacro": "Resume recording",
"DE.Views.ViewTab.tipStopMacro": "Stop recording",
"DE.Views.WatermarkSettingsDialog.textAuto": "Auto",
"DE.Views.WatermarkSettingsDialog.textBold": "Bold",
"DE.Views.WatermarkSettingsDialog.textColor": "Text color",