Browse Source

Merge pull request #12917 from ArtemDzhereleiko/AD/bug-fix/hot-key-event

Fixed default events and add hot keys for Mac
pull/12927/head
Igor Kulikov 2 years ago
committed by GitHub
parent
commit
1f9de54796
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 25
      ui-ngx/src/app/modules/home/components/dashboard-page/layout/dashboard-layout.component.ts

25
ui-ngx/src/app/modules/home/components/dashboard-page/layout/dashboard-layout.component.ts

@ -174,66 +174,71 @@ export class DashboardLayoutComponent extends PageComponent implements ILayoutCo
private initHotKeys(): void {
this.hotKeys.push(
new Hotkey('ctrl+c', (event: KeyboardEvent) => {
new Hotkey(['ctrl+c', 'meta+c'], (event: KeyboardEvent) => {
if (this.isEdit && !this.isEditingWidget && !this.widgetEditMode) {
const widget = this.dashboard.getSelectedWidget();
if (widget) {
event.preventDefault();
this.copyWidget(event, widget);
}
return false;
}
return false;
return true;
}, null,
this.translate.instant('action.copy'))
);
this.hotKeys.push(
new Hotkey('ctrl+r', (event: KeyboardEvent) => {
new Hotkey(['ctrl+r', 'meta+r'], (event: KeyboardEvent) => {
if (this.isEdit && !this.isEditingWidget && !this.widgetEditMode) {
const widget = this.dashboard.getSelectedWidget();
if (widget) {
event.preventDefault();
this.copyWidgetReference(event, widget);
}
return false;
}
return false;
return true;
}, null,
this.translate.instant('action.copy-reference'))
);
this.hotKeys.push(
new Hotkey('ctrl+v', (event: KeyboardEvent) => {
new Hotkey(['ctrl+v', 'meta+v'], (event: KeyboardEvent) => {
if (this.isEdit && !this.isEditingWidget && !this.widgetEditMode) {
if (this.itembuffer.hasWidget()) {
event.preventDefault();
this.pasteWidget(event);
}
return false;
}
return false;
return true;
}, null,
this.translate.instant('action.paste'))
);
this.hotKeys.push(
new Hotkey('ctrl+i', (event: KeyboardEvent) => {
new Hotkey(['ctrl+i', 'meta+i'], (event: KeyboardEvent) => {
if (this.isEdit && !this.isEditingWidget && !this.widgetEditMode) {
if (this.itembuffer.canPasteWidgetReference(this.dashboardCtx.getDashboard(),
this.dashboardCtx.state, this.layoutCtx.id, this.layoutCtx.breakpoint)) {
event.preventDefault();
this.pasteWidgetReference(event);
}
return false;
}
return false;
return true;
}, null,
this.translate.instant('action.paste-reference'))
);
this.hotKeys.push(
new Hotkey('ctrl+x', (event: KeyboardEvent) => {
new Hotkey(['ctrl+x', 'meta+x'], (event: KeyboardEvent) => {
if (this.isEdit && !this.isEditingWidget && !this.widgetEditMode) {
const widget = this.dashboard.getSelectedWidget();
if (widget) {
event.preventDefault();
this.layoutCtx.dashboardCtrl.removeWidget(event, this.layoutCtx, widget);
}
return false;
}
return false;
return true;
}, null,
this.translate.instant('action.delete'))
);

Loading…
Cancel
Save