From fa414ae707cd3103a49b5a08649f528ffeedab8c Mon Sep 17 00:00:00 2001 From: Augusto Braun Date: Wed, 10 Jan 2024 15:22:05 -0300 Subject: [PATCH 1/3] melhorias aplicadas na tarefa PRT-1833 --- src/syncfusion/index.ts | 33 +++++++++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/src/syncfusion/index.ts b/src/syncfusion/index.ts index 186bcbf..c279024 100644 --- a/src/syncfusion/index.ts +++ b/src/syncfusion/index.ts @@ -1,10 +1,10 @@ -import type { DocumentEditorContainer } from "@syncfusion/ej2-documenteditor"; +import type { DocumentEditorContainer, SelectionChangeEventArgs } from "@syncfusion/ej2-documenteditor"; import { ListView, SelectedCollection } from "@syncfusion/ej2-lists"; import { Dialog } from "@syncfusion/ej2-popups"; import { EditorAdapter } from "../editor"; import { IaraSpeechRecognition, IaraSpeechRecognitionDetail } from "../speech"; import { IaraSFDT, IaraSyncfusionEditorContentManager } from "./content"; -import { IaraSyncfusionSelectionManager as IaraSyncfusionInferenceSelectionManager } from "./selection"; +import { IaraSyncfusionSelectionManager } from "./selection"; import { IaraSyncfusionShortcutsManager } from "./shortcuts"; import { IaraSyncfusionStyleManager } from "./style"; import { IaraSyncfusionToolbarManager } from "./toolbar"; @@ -16,10 +16,14 @@ export class IaraSyncfusionAdapter private _contentManager: IaraSyncfusionEditorContentManager; private _debouncedSaveReport: () => void; private _initialUndoStackSize = 0; - private _selectionManager?: IaraSyncfusionInferenceSelectionManager; + private _selectionManager?: IaraSyncfusionSelectionManager; private _shortcutsManager: IaraSyncfusionShortcutsManager; private _toolbarManager: IaraSyncfusionToolbarManager; + private _resetSelection: boolean = false; + + private _cursorSelection?: IaraSyncfusionSelectionManager; + protected _styleManager: IaraSyncfusionStyleManager; public savingReportSpan = document.createElement("span"); @@ -62,6 +66,27 @@ export class IaraSyncfusionAdapter "destroyed", this._onEditorDestroyed.bind(this) ); + + this._editorContainer.documentEditor.addEventListener("selectionChange", (event: SelectionChangeEventArgs) => { + if (this._resetSelection) + { + this._resetSelection = false; + this._cursorSelection?.resetSelection(); + this._cursorSelection = undefined; + } + }); + + this._editorContainer.element.addEventListener("mousedown", (event) => { + if (event.button === 1) + { + this._resetSelection = true; + this._cursorSelection = new IaraSyncfusionSelectionManager(this._editorContainer.documentEditor); + event.preventDefault(); + this._recognition.toggleRecording(); + } + }); + + } blockEditorWhileSpeaking(status: boolean): void { @@ -115,7 +140,7 @@ export class IaraSyncfusionAdapter if (inference.richTranscriptModifiers?.length && !inference.isFinal) return; if (inference.isFirst) { - this._selectionManager = new IaraSyncfusionInferenceSelectionManager( + this._selectionManager = new IaraSyncfusionSelectionManager( this._editorContainer.documentEditor ); From e12580059665ee59534cd863c94ab398a95bf9e2 Mon Sep 17 00:00:00 2001 From: Augusto Braun Date: Wed, 10 Jan 2024 15:23:07 -0300 Subject: [PATCH 2/3] Revert "melhorias aplicadas na tarefa PRT-1833" This reverts commit fa414ae707cd3103a49b5a08649f528ffeedab8c. --- src/syncfusion/index.ts | 33 ++++----------------------------- 1 file changed, 4 insertions(+), 29 deletions(-) diff --git a/src/syncfusion/index.ts b/src/syncfusion/index.ts index c279024..186bcbf 100644 --- a/src/syncfusion/index.ts +++ b/src/syncfusion/index.ts @@ -1,10 +1,10 @@ -import type { DocumentEditorContainer, SelectionChangeEventArgs } from "@syncfusion/ej2-documenteditor"; +import type { DocumentEditorContainer } from "@syncfusion/ej2-documenteditor"; import { ListView, SelectedCollection } from "@syncfusion/ej2-lists"; import { Dialog } from "@syncfusion/ej2-popups"; import { EditorAdapter } from "../editor"; import { IaraSpeechRecognition, IaraSpeechRecognitionDetail } from "../speech"; import { IaraSFDT, IaraSyncfusionEditorContentManager } from "./content"; -import { IaraSyncfusionSelectionManager } from "./selection"; +import { IaraSyncfusionSelectionManager as IaraSyncfusionInferenceSelectionManager } from "./selection"; import { IaraSyncfusionShortcutsManager } from "./shortcuts"; import { IaraSyncfusionStyleManager } from "./style"; import { IaraSyncfusionToolbarManager } from "./toolbar"; @@ -16,14 +16,10 @@ export class IaraSyncfusionAdapter private _contentManager: IaraSyncfusionEditorContentManager; private _debouncedSaveReport: () => void; private _initialUndoStackSize = 0; - private _selectionManager?: IaraSyncfusionSelectionManager; + private _selectionManager?: IaraSyncfusionInferenceSelectionManager; private _shortcutsManager: IaraSyncfusionShortcutsManager; private _toolbarManager: IaraSyncfusionToolbarManager; - private _resetSelection: boolean = false; - - private _cursorSelection?: IaraSyncfusionSelectionManager; - protected _styleManager: IaraSyncfusionStyleManager; public savingReportSpan = document.createElement("span"); @@ -66,27 +62,6 @@ export class IaraSyncfusionAdapter "destroyed", this._onEditorDestroyed.bind(this) ); - - this._editorContainer.documentEditor.addEventListener("selectionChange", (event: SelectionChangeEventArgs) => { - if (this._resetSelection) - { - this._resetSelection = false; - this._cursorSelection?.resetSelection(); - this._cursorSelection = undefined; - } - }); - - this._editorContainer.element.addEventListener("mousedown", (event) => { - if (event.button === 1) - { - this._resetSelection = true; - this._cursorSelection = new IaraSyncfusionSelectionManager(this._editorContainer.documentEditor); - event.preventDefault(); - this._recognition.toggleRecording(); - } - }); - - } blockEditorWhileSpeaking(status: boolean): void { @@ -140,7 +115,7 @@ export class IaraSyncfusionAdapter if (inference.richTranscriptModifiers?.length && !inference.isFinal) return; if (inference.isFirst) { - this._selectionManager = new IaraSyncfusionSelectionManager( + this._selectionManager = new IaraSyncfusionInferenceSelectionManager( this._editorContainer.documentEditor ); From a27e403b55fe6135306d47967a64944618681b12 Mon Sep 17 00:00:00 2001 From: Augusto Braun Date: Fri, 19 Jan 2024 15:22:12 -0300 Subject: [PATCH 3/3] =?UTF-8?q?altera=C3=A7=C3=B5es=20conforme=20as=20suge?= =?UTF-8?q?stoes=20do=20Daniel,=20funcionou=20perfeitamente.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/editor/formatter.ts | 2 +- src/syncfusion/index.ts | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/editor/formatter.ts b/src/editor/formatter.ts index 1bbd307..17ea394 100644 --- a/src/editor/formatter.ts +++ b/src/editor/formatter.ts @@ -125,8 +125,8 @@ export class IaraEditorInferenceFormatter { "(\\d+(?:,\\d+)?)(\\spor\\s|x)(\\d+(?:,\\d+)?)(\\spor\\s|x)(\\d+(?:,\\d+)?) (cm|mm)(?!\\s\\(|³)" ); - text = this._addTrailingSpaces(text, _wordAfter, _wordBefore); text = this._capitalize(text, _wordBefore); + text = this._addTrailingSpaces(text, _wordAfter, _wordBefore); return text; } diff --git a/src/syncfusion/index.ts b/src/syncfusion/index.ts index 6ddcd6d..df704b4 100644 --- a/src/syncfusion/index.ts +++ b/src/syncfusion/index.ts @@ -151,6 +151,8 @@ export class IaraSyncfusionAdapter } insertInference(inference: IaraSpeechRecognitionDetail): void { + if (inference.transcript == "") return; + if (inference.richTranscriptModifiers?.length && !inference.isFinal) return; if (inference.isFirst) {