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