Skip to content

Commit

Permalink
mudanças para manter o cursor na posicao original no middle click
Browse files Browse the repository at this point in the history
  • Loading branch information
BraunAugusto committed Jan 10, 2024
1 parent e125800 commit 5632556
Showing 1 changed file with 29 additions and 4 deletions.
33 changes: 29 additions & 4 deletions src/syncfusion/index.ts
Original file line number Diff line number Diff line change
@@ -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";
Expand All @@ -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");
Expand Down Expand Up @@ -62,8 +66,29 @@ 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 {
const wrapper = document.getElementById("iara-syncfusion-editor-container");
if (wrapper) wrapper.style.cursor = status ? "not-allowed" : "auto";
Expand Down Expand Up @@ -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
);

Expand Down

0 comments on commit 5632556

Please sign in to comment.