Skip to content

Commit

Permalink
feat: public navigationManager to use in portal
Browse files Browse the repository at this point in the history
  • Loading branch information
ItalloDornelas committed Jun 17, 2024
1 parent 94f9389 commit b678bfc
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 3 deletions.
4 changes: 4 additions & 0 deletions src/editor/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,10 @@ export abstract class EditorAdapter {
return this._navigationFieldManager.hasEmptyRequiredFields();
}

navigationManagerFields(): IaraEditorNavigationFieldManager {
return this._navigationFieldManager;
}

private _initCommands(): void {
this._recognition.commands.add("iara copiar laudo", async () => {
if (this.hasEmptyRequiredFields()) {
Expand Down
6 changes: 5 additions & 1 deletion src/editor/navigationFields.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ export abstract class IaraEditorNavigationFieldManager {
abstract previousField(): void;
abstract goToField(title: string): void;
abstract hasEmptyRequiredFields(): boolean;

abstract insertField(
content?: string,
title?: string,
type?: "Field" | "Mandatory" | "Optional"
): void;
constructor(private _recognition: IaraSpeechRecognition) {
this._recognition.addEventListener("iaraSpeechMikeForwardButtonPress", () =>
this.nextField()
Expand Down
8 changes: 6 additions & 2 deletions src/syncfusion/navigationFields/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,12 @@ export class IaraSyncfusionNavigationFieldManager extends IaraEditorNavigationFi
this._documentEditor.selection.clear();
this._documentEditor.selection.moveNextPosition();
this._documentEditor.editor.insertText(content);
if (type === "Mandatory") this._documentEditor.editor.insertText(`*`);
if (type === "Optional") this._documentEditor.editor.insertText(`?`);
if (type === "Mandatory") {
if (!content.includes("*")) this._documentEditor.editor.insertText(`*`);
}
if (type === "Optional") {
if (!content.includes("?")) this._documentEditor.editor.insertText(`?`);
}
this.getBookmarks();
this.isFirstNextNavigation = true;
this.isFirstPreviousNavigation = true;
Expand Down
3 changes: 3 additions & 0 deletions src/tinymce/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,7 @@ export class IaraTinyMCEAdapter extends EditorAdapter implements EditorAdapter {
hasEmptyRequiredFields(): boolean {
throw new Error("Method not implemented.");
}
insertField() {
throw new Error("Method not implemented.");
}
}
3 changes: 3 additions & 0 deletions src/tinymce/navigationFields.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,7 @@ export class IaraTinyMceNavigationFieldManager extends IaraEditorNavigationField
hasEmptyRequiredFields(): boolean {
throw new Error("Method not implemented.");
}
insertField(): void {
throw new Error("Method not implemented.");
}
}

0 comments on commit b678bfc

Please sign in to comment.