Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: public navigationManager to use in portal #136

Merged
merged 1 commit into from
Jun 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.");
}
}