From 50ac58095620d4a16e1fdc6fbf93de9fd2b8ca30 Mon Sep 17 00:00:00 2001 From: Laurin Quast Date: Sun, 12 Apr 2020 14:37:07 +0200 Subject: [PATCH] feat: add method for manually retrieving the TextState In case you do something asynchronous inside a Command, e.g. starting an image upload it is necessary to get the state which could change between starting the asynchronous operation and finishing the asynchronous operation. --- src/commandOrchestrator.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/commandOrchestrator.ts b/src/commandOrchestrator.ts index b76aad7e..28f97ec1 100644 --- a/src/commandOrchestrator.ts +++ b/src/commandOrchestrator.ts @@ -24,6 +24,10 @@ export class TextAreaTextApi implements TextApi { this.textArea.selectionEnd = selection.end; return getStateFromTextArea(this.textArea); } + + getState(): TextState { + return getStateFromTextArea(this.textArea); + } } export function getStateFromTextArea(textArea: HTMLTextAreaElement): TextState {