fix: user Renderer2 instead of deprecated Renderer (#844)
This commit is contained in:
committed by
László Monda
parent
ca74b0a76b
commit
18808eae9c
@@ -4,7 +4,6 @@ import {
|
|||||||
Component,
|
Component,
|
||||||
ElementRef,
|
ElementRef,
|
||||||
Input,
|
Input,
|
||||||
Renderer,
|
|
||||||
ViewChild
|
ViewChild
|
||||||
} from '@angular/core';
|
} from '@angular/core';
|
||||||
import { TextMacroAction } from 'uhk-common';
|
import { TextMacroAction } from 'uhk-common';
|
||||||
@@ -23,14 +22,14 @@ export class MacroTextTabComponent extends MacroBaseComponent implements OnInit,
|
|||||||
@Input() macroAction: TextMacroAction;
|
@Input() macroAction: TextMacroAction;
|
||||||
@ViewChild('macroTextInput') input: ElementRef;
|
@ViewChild('macroTextInput') input: ElementRef;
|
||||||
|
|
||||||
constructor(private renderer: Renderer) { super(); }
|
constructor() { super(); }
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.init();
|
this.init();
|
||||||
}
|
}
|
||||||
|
|
||||||
ngAfterViewInit() {
|
ngAfterViewInit() {
|
||||||
this.renderer.invokeElementMethod(this.input.nativeElement, 'focus');
|
this.input.nativeElement.focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
onTextChange() {
|
onTextChange() {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import {
|
import {
|
||||||
Component, ElementRef, EventEmitter, HostListener, Input, OnChanges, OnDestroy, OnInit, Output, Renderer,
|
Component, ElementRef, EventEmitter, HostListener, Input, OnChanges, OnDestroy, OnInit, Output,
|
||||||
SimpleChange, ChangeDetectionStrategy
|
SimpleChange, ChangeDetectionStrategy
|
||||||
} from '@angular/core';
|
} from '@angular/core';
|
||||||
import { animate, group, state, style, transition, trigger } from '@angular/animations';
|
import { animate, group, state, style, transition, trigger } from '@angular/animations';
|
||||||
@@ -110,8 +110,7 @@ export class SvgKeyboardKeyComponent implements OnInit, OnChanges, OnDestroy {
|
|||||||
private mapper: MapperService,
|
private mapper: MapperService,
|
||||||
private store: Store<AppState>,
|
private store: Store<AppState>,
|
||||||
private element: ElementRef,
|
private element: ElementRef,
|
||||||
private captureService: CaptureService,
|
private captureService: CaptureService
|
||||||
private renderer: Renderer
|
|
||||||
) {
|
) {
|
||||||
this.subscription = store.let(getMacros())
|
this.subscription = store.let(getMacros())
|
||||||
.subscribe((macros: Macro[]) => this.macros = macros);
|
.subscribe((macros: Macro[]) => this.macros = macros);
|
||||||
@@ -137,7 +136,7 @@ export class SvgKeyboardKeyComponent implements OnInit, OnChanges, OnDestroy {
|
|||||||
onMouseDown(e: MouseEvent) {
|
onMouseDown(e: MouseEvent) {
|
||||||
if ((e.which === 2 || e.button === 2) && this.capturingEnabled) {
|
if ((e.which === 2 || e.button === 2) && this.capturingEnabled) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
this.renderer.invokeElementMethod(this.element.nativeElement, 'focus');
|
this.element.nativeElement.focus();
|
||||||
|
|
||||||
if (this.recording) {
|
if (this.recording) {
|
||||||
this.reset();
|
this.reset();
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import {
|
|||||||
OnChanges,
|
OnChanges,
|
||||||
OnInit,
|
OnInit,
|
||||||
Output,
|
Output,
|
||||||
Renderer,
|
|
||||||
SimpleChanges,
|
SimpleChanges,
|
||||||
ViewChild
|
ViewChild
|
||||||
} from '@angular/core';
|
} from '@angular/core';
|
||||||
@@ -100,8 +99,7 @@ export class SvgKeyboardWrapComponent implements OnInit, OnChanges {
|
|||||||
constructor(
|
constructor(
|
||||||
private store: Store<AppState>,
|
private store: Store<AppState>,
|
||||||
private mapper: MapperService,
|
private mapper: MapperService,
|
||||||
private element: ElementRef,
|
private element: ElementRef
|
||||||
private renderer: Renderer
|
|
||||||
) {
|
) {
|
||||||
this.keyEditConfig = {
|
this.keyEditConfig = {
|
||||||
moduleId: undefined,
|
moduleId: undefined,
|
||||||
@@ -216,7 +214,7 @@ export class SvgKeyboardWrapComponent implements OnInit, OnChanges {
|
|||||||
this.keyPosition = this.keyElement.getBoundingClientRect();
|
this.keyPosition = this.keyElement.getBoundingClientRect();
|
||||||
this.popoverInitKeyAction = keyAction;
|
this.popoverInitKeyAction = keyAction;
|
||||||
this.popoverShown = true;
|
this.popoverShown = true;
|
||||||
this.renderer.invokeElementMethod(this.popover.nativeElement, 'focus');
|
this.popover.nativeElement.focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
showTooltip(keyAction: KeyAction, event: MouseEvent): void {
|
showTooltip(keyAction: KeyAction, event: MouseEvent): void {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Directive, ElementRef, HostListener, Renderer } from '@angular/core';
|
import { Directive, ElementRef, HostListener, Renderer2 } from '@angular/core';
|
||||||
|
|
||||||
@Directive({
|
@Directive({
|
||||||
selector: '[cancelable]'
|
selector: '[cancelable]'
|
||||||
@@ -7,15 +7,15 @@ export class CancelableDirective {
|
|||||||
|
|
||||||
private originalValue: string;
|
private originalValue: string;
|
||||||
|
|
||||||
constructor(private elementRef: ElementRef, private renderer: Renderer) { }
|
constructor(private elementRef: ElementRef, private renderer: Renderer2) { }
|
||||||
|
|
||||||
@HostListener('focus') onFocus(): void {
|
@HostListener('focus') onFocus(): void {
|
||||||
this.originalValue = this.elementRef.nativeElement.value;
|
this.originalValue = this.elementRef.nativeElement.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@HostListener('keyup.escape') onEscape(): void {
|
@HostListener('keyup.escape') onEscape(): void {
|
||||||
this.renderer.setElementProperty(this.elementRef.nativeElement, 'value', this.originalValue);
|
this.renderer.setProperty(this.elementRef.nativeElement, 'value', this.originalValue);
|
||||||
this.renderer.invokeElementMethod(this.elementRef.nativeElement, 'blur');
|
this.elementRef.nativeElement.blur();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user