From d1f4cf50bbfd74ed139a2f782679be18822c475d Mon Sep 17 00:00:00 2001 From: Kristianmitk Date: Fri, 18 Jun 2021 16:26:58 +0200 Subject: [PATCH 1/2] add support for the delete key --- .../src/lib/fake-input/fake-input.component.ts | 12 +++++++++++- .../angular-keyboard/src/lib/keyboard-commands.ts | 1 + 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/projects/angular-keyboard/src/lib/fake-input/fake-input.component.ts b/projects/angular-keyboard/src/lib/fake-input/fake-input.component.ts index 649bc44..a0848e7 100755 --- a/projects/angular-keyboard/src/lib/fake-input/fake-input.component.ts +++ b/projects/angular-keyboard/src/lib/fake-input/fake-input.component.ts @@ -141,7 +141,8 @@ export class FakeInputComponent implements OnInit, OnDestroy { [KeyboardCommandButton.ARROW_UP]: () => this.moveCursorUp(), [KeyboardCommandButton.ARROW_DOWN]: () => this.moveCursorDown(), [KeyboardCommandButton.ESCAPE]: () => this.angularKeyboardService.inputFocused$.next(null), - [KeyboardCommandButton.ENTER]: () => this.insertChar('\n') + [KeyboardCommandButton.ENTER]: () => this.insertChar('\n'), + [KeyboardCommandButton.DELETE]: () => this.deleteRight() }; const action = handledEvents[next]; if (action instanceof Function) { @@ -156,6 +157,15 @@ export class FakeInputComponent implements OnInit, OnDestroy { } } + deleteRight() { + this.moveCursorRight(); + this.deleteCharLeftAndAdjustCursor(); + + if (this.suggestionMode === true) { + this.moveCursorRight(); + } + } + getText() { return this.chars .filter(char => char.charState !== CharState.REMOVED) diff --git a/projects/angular-keyboard/src/lib/keyboard-commands.ts b/projects/angular-keyboard/src/lib/keyboard-commands.ts index faa2a67..76269b4 100644 --- a/projects/angular-keyboard/src/lib/keyboard-commands.ts +++ b/projects/angular-keyboard/src/lib/keyboard-commands.ts @@ -5,6 +5,7 @@ export enum KeyboardCommandButton { A_B_C = 'ABC', SPECIAL_CHARS = 'SPECIAL_CHARS', BACKSPACE = 'Backspace', + DELETE = 'Delete', ENTER = 'Enter', ESCAPE = 'Escape', ARROW_LEFT = 'ArrowLeft', From 3288b9536ae9cf3df8b3f05b23dff265e79b2356 Mon Sep 17 00:00:00 2001 From: Kristianmitk Date: Fri, 18 Jun 2021 16:32:15 +0200 Subject: [PATCH 2/2] bump angular keyboard package version --- projects/angular-keyboard/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/angular-keyboard/package.json b/projects/angular-keyboard/package.json index 8dabb26..46577b7 100644 --- a/projects/angular-keyboard/package.json +++ b/projects/angular-keyboard/package.json @@ -1,4 +1,4 @@ { "name": "@taskbase/angular-keyboard", - "version": "0.0.9" + "version": "0.0.10" }