shortcut next/prev
This commit is contained in:
@@ -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();
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
@@ -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();
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user