diff --git a/client/src/views/modals/detail.js b/client/src/views/modals/detail.js index dc9e2c3ab3..4ebcdaae7d 100644 --- a/client/src/views/modals/detail.js +++ b/client/src/views/modals/detail.js @@ -94,6 +94,12 @@ define('views/modals/detail', ['views/modal', 'helpers/action-item-setup'], func 'Control+Backslash': function (e) { this.getRecordView().handleShortcutKeyControlBackslash(e); }, + 'Control+ArrowLeft': function (e) { + this.handleShortcutKeyControlArrowLeft(e); + }, + 'Control+ArrowRight': function (e) { + this.handleShortcutKeyControlArrowRight(e); + }, }, setup: function () { @@ -695,5 +701,43 @@ define('views/modals/detail', ['views/modal', 'helpers/action-item-setup'], func this.getRouter().navigate(url, {trigger: false}); }); }, + + /** + * @protected + * @param {JQueryKeyEventObject} e + */ + handleShortcutKeyControlArrowLeft: function (e) { + if (!this.model.collection) { + return; + } + + if (this.buttonList.findIndex(item => item.name === 'previous' && !item.disabled) === -1) { + return; + } + + e.preventDefault(); + e.stopPropagation(); + + this.actionPrevious(); + }, + + /** + * @protected + * @param {JQueryKeyEventObject} e + */ + handleShortcutKeyControlArrowRight: function (e) { + if (!this.model.collection) { + return; + } + + if (this.buttonList.findIndex(item => item.name === 'next' && !item.disabled) === -1) { + return; + } + + e.preventDefault(); + e.stopPropagation(); + + this.actionNext(); + }, }); }); diff --git a/client/src/views/record/detail.js b/client/src/views/record/detail.js index fdc12a7d41..8c2a492df3 100644 --- a/client/src/views/record/detail.js +++ b/client/src/views/record/detail.js @@ -440,6 +440,12 @@ function (Dep, ViewRecordHelper, ActionItemSetup) { 'Control+Backslash': function (e) { this.handleShortcutKeyControlBackslash(e); }, + 'Control+ArrowLeft': function (e) { + this.handleShortcutKeyControlArrowLeft(e); + }, + 'Control+ArrowRight': function (e) { + this.handleShortcutKeyControlArrowRight(e); + }, }, /** @@ -3604,5 +3610,63 @@ function (Dep, ViewRecordHelper, ActionItemSetup) { }, 50); } }, + + /** + * @protected + * @param {JQueryKeyEventObject} e + */ + handleShortcutKeyControlArrowLeft: function (e) { + if (this.inlineEditModeIsOn || this.buttonsDisabled) { + return; + } + + if (this.navigateButtonsDisabled) { + return; + } + + if (this.type !== this.TYPE_DETAIL || this.mode !== this.MODE_DETAIL) { + return; + } + + let $button = this.$el.find('button[data-action="previous"]'); + + if (!$button.length || $button.hasClass('disabled')) { + return; + } + + e.preventDefault(); + e.stopPropagation(); + + this.actionPrevious(); + }, + + /** + * @protected + * @param {JQueryKeyEventObject} e + */ + handleShortcutKeyControlArrowRight: function (e) { + if (this.inlineEditModeIsOn || this.buttonsDisabled) { + return; + } + + if (this.navigateButtonsDisabled) { + return; + } + + if (this.type !== this.TYPE_DETAIL || this.mode !== this.MODE_DETAIL) { + return; + } + + let $button = this.$el.find('button[data-action="next"]'); + + if (!$button.length || $button.hasClass('disabled')) { + return; + } + + e.preventDefault(); + e.stopPropagation(); + + this.actionNext(); + }, }); });