Skip to content

Commit

Permalink
Feature/prt 1774 (#50)
Browse files Browse the repository at this point in the history
* feat: add replaceCommand true

* feat: add callback to finishReport

* feat: add sdk method to copy

* feat: add recognition stop

* feat: add await getPlain func

* feat: add await to copy content
  • Loading branch information
ItalloDornelas authored Jan 9, 2024
1 parent 6f8833e commit e1aabeb
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/editor/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export abstract class EditorAdapter {

abstract blockEditorWhileSpeaking(status: boolean): void;
abstract clearReport(): void;
abstract copyReport(): void;
abstract copyReport(): Promise<void>;
abstract insertInference(inference: IaraSpeechRecognitionDetail): void;
abstract getEditorContent(): Promise<[string, string, string]>;

Expand All @@ -66,9 +66,9 @@ export abstract class EditorAdapter {
return this._recognition.beginReport({ richText: "", text: "" });
}

finishReport(clear = true): void {
async finishReport(clear = true): Promise<void> {
if (!this._shouldSaveReport) return;
this.copyReport();
await this.copyReport();
if (clear) this.clearReport();
this._recognition.finishReport();
this.onFinishedReport?.();
Expand Down
11 changes: 11 additions & 0 deletions src/syncfusion/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
import type { DocumentEditorContainer } from "@syncfusion/ej2-documenteditor";
import {
createSpinner,
showSpinner,
hideSpinner,
} from "@syncfusion/ej2-popups";
import { ListView, SelectedCollection } from "@syncfusion/ej2-lists";
import { Dialog } from "@syncfusion/ej2-popups";
import { EditorAdapter } from "../editor";
Expand Down Expand Up @@ -62,6 +67,10 @@ export class IaraSyncfusionAdapter
"destroyed",
this._onEditorDestroyed.bind(this)
);

createSpinner({
target: _editorContainer.editorContainer,
});
}

blockEditorWhileSpeaking(status: boolean): void {
Expand All @@ -72,9 +81,11 @@ export class IaraSyncfusionAdapter
async copyReport(): Promise<void> {
this._editorContainer.documentEditor.focusIn();
this._editorContainer.documentEditor.selection.selectAll();
showSpinner(this._editorContainer.editorContainer);
this._recognition.automation.copyText(
...(await this._contentManager.getContent())
);
hideSpinner(this._editorContainer.editorContainer);
this._editorContainer.documentEditor.selection.moveNextPosition();
}

Expand Down
2 changes: 1 addition & 1 deletion src/tinymce/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export class IaraTinyMCEAdapter extends EditorAdapter implements EditorAdapter {
this._editorContainer.undoManager.undo();
}

copyReport(): void {
copyReport(): Promise<void> {
throw new Error("Método não implementado.");
}

Expand Down

0 comments on commit e1aabeb

Please sign in to comment.