layout shortcuts

This commit is contained in:
Yuri Kuznetsov
2022-11-10 13:52:36 +02:00
parent 44c13c9223
commit dcb550d6a8
4 changed files with 39 additions and 7 deletions
+7 -7
View File
@@ -36,9 +36,7 @@ define('views/admin/layouts/base', ['view'], function (Dep) {
events: {
'click button[data-action="save"]': function () {
this.disableButtons();
this.notify('Saving...');
this.save(this.enableButtons.bind(this));
this.actionSave();
},
'click button[data-action="cancel"]': function () {
this.cancel();
@@ -72,6 +70,12 @@ define('views/admin/layouts/base', ['view'], function (Dep) {
dataAttributesDynamicLogicDefs: null,
actionSave: function () {
this.disableButtons();
this.notify('Saving...');
this.save(this.enableButtons.bind(this));
},
disableButtons: function () {
this.$el.find('.button-container button').attr('disabled', true);
},
@@ -144,10 +148,6 @@ define('views/admin/layouts/base', ['view'], function (Dep) {
this.dataAttributeList;
this.dataAttributeList = Espo.Utils.clone(this.dataAttributeList);
this.once('remove', () => {
this.setIsNotChanged();
});
},
unescape: function (string) {
+14
View File
@@ -98,6 +98,20 @@ define('views/admin/layouts/index', ['view'], function (Dep) {
$collapse.collapse('show');
}
},
'keydown.shortcuts': function (e) {
let key = Espo.Utils.getKeyFromKeyEvent(e);
if (!this.hasView('content')) {
return;
}
if (key === 'Control+Enter' || key === 'Control+KeyS') {
e.stopPropagation();
e.preventDefault();
this.getView('content').actionSave();
}
},
},
getLayoutScopeDataList: function () {
@@ -40,6 +40,15 @@ define('views/admin/layouts/modals/edit-attributes', ['views/modal', 'model'], f
className: 'dialog dialog-record',
shortcutKeys: {
'Control+Enter': function (e) {
this.actionSave();
e.preventDefault();
e.stopPropagation();
},
},
setup: function () {
this.buttonList = [
{
@@ -40,6 +40,15 @@ define('views/admin/layouts/modals/panel-attributes', ['views/modal', 'model'],
className: 'dialog dialog-record',
shortcutKeys: {
'Control+Enter': function (e) {
this.actionSave();
e.preventDefault();
e.stopPropagation();
},
},
setup: function () {
this.buttonList = [
{