Merge pull request #12917 from ArtemDzhereleiko/AD/bug-fix/hot-key-event
Fixed default events and add hot keys for Mac
This commit is contained in:
		
						commit
						1f9de54796
					
				@ -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 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 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 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 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 true;
 | 
			
		||||
        }, null,
 | 
			
		||||
        this.translate.instant('action.delete'))
 | 
			
		||||
    );
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user