Skip to content

Commit

Permalink
Feat/prt 2005 (#141)
Browse files Browse the repository at this point in the history
* feat: replace command to navigation fields

* Update index.ts

remove log

* fix: improve logic to return a field

* feat: improve to use string comparation
  • Loading branch information
ItalloDornelas authored Jun 21, 2024
1 parent 38fa9a0 commit 85d58c0
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 26 deletions.
68 changes: 43 additions & 25 deletions src/editor/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,26 +119,36 @@ export abstract class EditorAdapter {
}

private _initCommands(): void {
this._recognition.commands.add("iara copiar laudo", async () => {
this._getNavigationFieldDeleted();
if (this.hasEmptyRequiredFields()) {
this.onIaraCommand?.("required fields to copy");
return;
this._recognition.commands.add(
"iara copiar laudo",
async (detail, command) => {
if (detail.transcript === command) {
this._getNavigationFieldDeleted();
}
if (this.hasEmptyRequiredFields()) {
this.onIaraCommand?.("required fields to copy");
return;
}
this._recognition.stop();
await this.copyReport();
this.onIaraCommand?.("iara copiar laudo");
}
this._recognition.stop();
await this.copyReport();
this.onIaraCommand?.("iara copiar laudo");
});
this._recognition.commands.add("iara finalizar laudo", async () => {
this._getNavigationFieldDeleted();
if (this.hasEmptyRequiredFields()) {
this.onIaraCommand?.("required fields to finish");
return;
);
this._recognition.commands.add(
"iara finalizar laudo",
async (detail, command) => {
if (detail.transcript === command) {
this._getNavigationFieldDeleted();
}
if (this.hasEmptyRequiredFields()) {
this.onIaraCommand?.("required fields to finish");
return;
}
this._recognition.stop();
await this.finishReport();
this.onIaraCommand?.("iara finalizar laudo");
}
this._recognition.stop();
await this.finishReport();
this.onIaraCommand?.("iara finalizar laudo");
});
);
this._recognition.commands.add("iara negrito", () => {
this._styleManager.toggleBold();
});
Expand All @@ -154,22 +164,30 @@ export abstract class EditorAdapter {
this._recognition.commands.add("iara imprimir", () => {
this.print();
});
this._recognition.commands.add("iara próximo campo", () => {
this._getNavigationFieldDeleted();
this._recognition.commands.add("iara próximo campo", (detail, command) => {
if (detail.transcript === command) {
this._getNavigationFieldDeleted();
}
this._navigationFieldManager.nextField();
});
this._recognition.commands.add("iara campo anterior", () => {
this._getNavigationFieldDeleted();
this._recognition.commands.add("iara campo anterior", (detail, command) => {
if (detail.transcript === command) {
this._getNavigationFieldDeleted();
}
this._navigationFieldManager.previousField();
});
this._recognition.commands.add("next", () => {
this._getNavigationFieldDeleted();
this._recognition.commands.add("next", (detail, command) => {
if (detail.transcript === command) {
this._getNavigationFieldDeleted();
}
this._navigationFieldManager.nextField();
});
this._recognition.commands.add(
`buscar (\\p{Letter}+)`,
(detail, command, param, groups) => {
this._getNavigationFieldDeleted();
if (detail.transcript === command) {
this._getNavigationFieldDeleted();
}
try {
this._navigationFieldManager.goToField(groups ? groups[1] : "");
} catch (e) {
Expand Down
2 changes: 1 addition & 1 deletion src/syncfusion/navigationFields/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ export class IaraSyncfusionNavigationFieldManager extends IaraEditorNavigationFi
)[0];
}
this.sortByPosition();
if (this.bookmarks.length > 1)
if (this.bookmarks.length >= 1)
this.getPreviousAndNext(this.currentSelectionOffset);

if (setColor) this.setColor();
Expand Down

0 comments on commit 85d58c0

Please sign in to comment.