Skip to content

Commit

Permalink
Release/0.2.1 (#126)
Browse files Browse the repository at this point in the history
* feat: add begin, finish and change report

* feat/1349: block editor while speaking (#9)

* feat: block editor while speaking

* fix: VAD supports and function name changed

---------

Co-authored-by: André Canuto <andrecanuto@MacBook-Pro-de-Andre.local>

* feat: handle trailing spaces and capitalization (#10)

* feat: add methods to get previous and next words

* feat: handle capitalization and more space cases

* Feat: PRT-1761 - Salvamento Automático do laudo no adapters (#11)

* feat: add _onContentChange to observe changes

* feat: saving content in adpater

* feat: change name to spanSavingReport

* fix: remove NodeJS.Timeout typing

* feat:1769 - Insert template in editor (#13)

* rebase

* rebase

* fixes to dev

* feat: header of converter optimized

* adjusts of request

---------

Co-authored-by: André Canuto <andrecanuto@MacBook-Pro-de-Andre.local>

* Feat/prt 1774 - Iara comands copy and finalize (#15)

* rebase

* feat:1774 - Iara comands copy and finalize

* adjusts of request

* fix: finish report function

---------

Co-authored-by: André Canuto <andrecanuto@MacBook-Pro-de-Andre.local>

* Feat/prt 1768 get editor content (#17)

* resolve conflicts

* resolve conflicts

* resolve conflicts

* resolve conflicts

* resolve conflicts

---------

Co-authored-by: André Canuto <andrecanuto@MacBook-Pro-de-Andre.local>

* feat: add change font family and size methods

* rebase

* feat-1792 - font change function

* feat-1792 - font change size and family

* fix pr

* fix pr

* fix var unused

---------

Co-authored-by: André Canuto <andrecanuto@MacBook-Pro-de-Andre.local>

* Feat/prt 1773 - formatter commands (#20)

* rebase

* feat-1773: formmat text command

* feat:PRT-1773 - formatter commands

* fix pr conversation

* fix pr conversation

---------

Co-authored-by: André Canuto <andrecanuto@MacBook-Pro-de-Andre.local>

* implement get content at editor (#23)

Co-authored-by: André Canuto <andrecanuto@MacBook-Pro-de-Andre.local>

* feat: get html content from editor correction (#24)

Co-authored-by: André Canuto <andrecanuto@MacBook-Pro-de-Andre.local>

* feat: add color in span

* Feature/prt 1775 - Editor formatter and calculate volume (#25)

* feat: fixes for estimate volume

* fix:volume estimate

* fix pr conversation

* fix pr conversation

* fix conflicts

* fix pr conversation

* fix pr for formatter editor

* feat-177: editor formatter and calculate volume

* feat: get html content from editor correction (#24)

Co-authored-by: André Canuto <andrecanuto@MacBook-Pro-de-Andre.local>

* fix: name of _inferenceFormatter

---------

Co-authored-by: André Canuto <andrecanuto@MacBook-Pro-de-Andre.local>

* feat: add onDestroy (#26)

* feat: add onDestroy

* fix: change name method

* Feature/prt 1750 (#27)

* build(deps-dev): bump word-wrap from 1.2.3 to 1.2.4 (#5)

Bumps [word-wrap](https://github.com/jonschlinkert/word-wrap) from 1.2.3 to 1.2.4.
- [Release notes](https://github.com/jonschlinkert/word-wrap/releases)
- [Commits](jonschlinkert/word-wrap@1.2.3...1.2.4)

---
updated-dependencies:
- dependency-name: word-wrap
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* feat: add new toolbar

* feat: add new configs toolbar

* fix: remove unusual component

* fix: remove unusual functions

* fix: remove unusual

* feat: add verify to see toolbar config

* fix: add document to selection

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* fix: fix broken references to documentEditor

* feat: improve syncfusion adapter content management (#28)

* feat: improve content management and major refactorings

* fix: fix insertTemplate method

* fix: fix build errors

* feat: add verify to templates (#30)

* fix: add method onEditorDestroy (#29)

* fix: add method onEditorDestroy

* feat: update name method

* feat: get editor RTF content (#32)

* feat: call QA api for RTF conversion

* feat: replace the QA toRtf url with prod one

* Feature/prt 1772 1 (#31)

* feat: add shortcuts

* feat: add shortcuts manager

* feat: order by template first

* merge dev

* feat: add init method shortcutsManeger

* feat: improve modal

* fix: add correct type

* Bugfix/prt 1819 (#33)

* fix: resolve mouse position

* fix: inference when documento dont exists

* fix: remove listener when destroy editor

* fix: remove iara text when calling a template (#34)

* Feature/prt 1772 1 (#35)

* feat: add shortcuts

* feat: add shortcuts manager

* feat: order by template first

* merge dev

* feat: add init method shortcutsManeger

* feat: improve modal

* fix: add correct type

* feat: change type in update template in listView

* feat: update syncfusion pack

* Feature/prt 1772 1 (#38)

* feat: add shortcuts

* feat: add shortcuts manager

* feat: order by template first

* merge dev

* feat: add init method shortcutsManeger

* feat: improve modal

* fix: add correct type

* feat: change type in update template in listView

* feat: update syncfusion pack

* feat: sort order and add plural

* Feature/prt 1774 (#36)

* feat: add replaceCommand true

* feat: add callback to finishReport

* feat: remove enableLocalPaste (#37)

* Feature/prt 1772 1 (#40)

* feat: add shortcuts

* feat: add shortcuts manager

* feat: order by template first

* merge dev

* feat: add init method shortcutsManeger

* feat: improve modal

* fix: add correct type

* feat: change type in update template in listView

* feat: update syncfusion pack

* feat: sort order and add plural

* feat: get name of templates/phrases in metadata

* feat: verify inference is final (#39)

* feat: improve debounce logic to save (#41)

* Feature/prt 1761 1 (#43)

* feat: improve debounce logic to save

* feat: add rich and text to get id

* Feature/prt 1774 (#42)

* feat: add replaceCommand true

* feat: add callback to finishReport

* feat: add sdk method to copy

* feat: add a custom toolbar locale (#44)

* feat: add a custom toolbar locale

* feat: add locale package

* fix: improve name variable and add pack

* fix: fix syncfusion locale pkg version

* mudanças para lançar configs de fonte e tamanho do portal para o editor (#45)

* Feature/prt 1774 (#46)

* feat: add replaceCommand true

* feat: add callback to finishReport

* feat: add sdk method to copy

* feat: add recognition stop

* fix: fix styling commands not being correctly applied (#47)

* refactor: rename editorContainer references

* [WIP] feat: revert selection format after checking for boundaries

* fix: fix selection style resetting

* fix: remove unused import to SelectionCharacterFormat

* fix: get moveNextPosition from editor

* feat: verify is Template (#48)

* feat: verify is Template

* fix: remove log

* Feature/prt 1761 1 (#49)

* feat: improve debounce logic to save

* feat: add rich and text to get id

* fix: add id undefined when begin

* fix: remove log

* fix: remove close tag error (#51)

* feat: add logic to save when editor created (#52)

* Feature/prt 1774 (#50)

* feat: add replaceCommand true

* feat: add callback to finishReport

* feat: add sdk method to copy

* feat: add recognition stop

* feat: add await getPlain func

* feat: add await to copy content

* fix: split template richTranscript into prefix and template (#53)

* Feature/prt 1774 (#54)

* feat: add replaceCommand true

* feat: add callback to finishReport

* feat: add sdk method to copy

* feat: add recognition stop

* feat: add await getPlain func

* feat: add await to copy content

* feat: change onFinishedReport to onIaraCommand to know the command is use

* Feat/prt 1833 adapters (#55)

* melhorias aplicadas na tarefa PRT-1833

* Revert "melhorias aplicadas na tarefa PRT-1833"

This reverts commit fa414ae.

* mudanças para manter o cursor na posicao original no middle click

* correcao na funcao

* alteracoes

* alteração de final de linha para LF

* fix: handle case and special chars in iara texto regex

* feat: add logic to save when editor created (#57)

* Feat/prt 1830 (#58)

* feat: allow inserting template from other formats

* feat: allow fetching sfdt content with editor content

* feat: prevent saving race condition

---------

Co-authored-by: Daniel Souza <dsouza1995@gmail.com>

* fix: prevent resetting selection on scroll click while recording (#59)

* Feat/prt 1848 (#60)

* melhorias aplicadas na tarefa PRT-1833

* Revert "melhorias aplicadas na tarefa PRT-1833"

This reverts commit fa414ae.

* corrigindo letra minuscula apos o ponto

* Feat/prt 1844 (#63)

* feat: add ribbon component

* feat: add configs ribbon styles

* feat: remove toolbar element

* feat: add ribbon in toolbar content

* feat: update package

* Feat/prt 1864 adapter (#61)

* melhorias aplicadas na tarefa PRT-1833

* Revert "melhorias aplicadas na tarefa PRT-1833"

This reverts commit fa414ae.

* alterações conforme as sugestoes do Daniel, funcionou perfeitamente.

* fix: prevent content dirty race condition error (#62)

* debug: add save report logs

* fix: prevent content dirty race condition error

* refactor: remove debug logs on report save

* implementado uppercase no adapters (#65)

* adicionando config ao ribbon

* adaptaçoes para mudança dinamica de cor de fonte

* Feat/prt 1825 (#67)

* adicionando config ao ribbon

* adaptaçoes para mudança dinamica de cor de fonte

* fix: pass logic to method and adjust the height (#66)

* remoca do darkmode do services

* devolvendo a logica anterior

* Feat/prt 1864 2 (#69)

* trabalhando no espaço antes do ponto

* conversao do capitalize para versao anterior, aparentemente corrigindo o problema com o vad

* limpeza do codigo apos os testes

* retornando o codigo ao formato original apos limpeza

---------

Co-authored-by: Daniel Souza <dsouza1995@gmail.com>

* fix: fix import syntax error

* fix: set font color according to theme

* feat: add nbsp or zwnj (#71)

* feat: add space after

* synfusion setando fontes e tamanhos a partir do config do portal (#70)

* synfusion setando fontes e tamanhos a partir do config do portal

* fix: change line feed

---------

Co-authored-by: Daniel Souza <dsouza1995@gmail.com>

* Fix/prt 1872 (#72)

* feat: add nbsp or zwnj

* fix: add nbspOrZwnj to capitalize

* fix: fix @ shortcut for mac and phrase insertion

* fix: prevent selection being lost by listening to scroll mouseup (#74)

* fix: prevent selection being lost by listening to scroll mouseup

* fix: remove unused variables

* fix: improve selection logic for word after and before (#76)

* Feat/prd 1832 (#73)

* ajustando o toPDF e merge com a dev

* lançando o botao de export com o cuidado de trocar a cor da fonte no dark mode

* limpeza do codigo para entrega

* melhorias e correções - nome do documento.pdf e no modo light ocorria de a fonte cair para branco apos o export, sem o cuidado do isdarkmode

* ajuste para documento sem titulo e conflito vercel

* ajuste vercel

* alteração no nome padrao do PDF para data-hora-minuto

* fix: remove xml tag at start of html (#75)

* Feat/prt 1878 (#77)

* inserido o menu de espaçamento, falta manter o valor selecionado

* resolvido o problema de setar o valor do espaçamento no select

* removendo opcoes de spacing do bloco do switch

* atualizacao com a dev

* corrigindo conflitos

* inseridas alterações de CSS no caso de darkmode para alterar cursor e msg de salvando/salvo (#78)

* Fix/prt 1882 (#79)

* fix: improve code

* feat: report config style

* feat: add font style status (#80)

* feat: stop using undo on insertInference (#82)

* refactor: refactor export to PDF method

* fix: prevent adding unnecessary trailing spaces (#83)

* devolução do botao export to pdf (#84)

* devolução do botao export to pdf

* correção para o darkmode

* correção da correção

* Feat/prt 1886 (#81)

* adição de novos botoes

* finalizacao das implementacoes

* testes finais e limpeza de codigo

* aplicando solicitacoes do code review

* corrigindo erro vercel

---------

Co-authored-by: Daniel Souza <dsouza1995@gmail.com>

* fix: fix broken toolbar config call

* feat: add classic mode to ribbon (#86)

* tema escuro carregando sem flash (#85)

* tema escuro carregando sem flash

* correção vercel

* feat: add popup to insert number of columns (#87)

* feat: add translate and heitgh of menu ribbon (#88)

* fix: fix several inference insertion errors (#91)

* fix: don't format empty inferences

* fix: ignore spaces when capitalizing

* fix: trim spaces in the end of inference text

* fix: fix add traling spaces corner cases

* fix: set default font when loading template

* fix: don't add space after newline in text

* fix: handle punctiation leading spaces

* fix: fix table insertion with dark theme

* feat: add navigation fields (#90)

* feat: add title to navigation field (#92)

* feat: add title to navigation field

* feat: add comments to make the code easier to understand

* fix: throw error on content conversion error

* Atualizacao do CSS o Sync para ultima versao (#93)

* fix: fix inference insertion with paragraphs (#94)

* fix: handle malformed htmls with unclosed br tag

* feat: add replace paragraph by index method

* fix: replace all open br tags for syncfusion

* fix: use regex for br tags replace

* feat: hack tinymce pasting by disguising as gdocs (#97)

* fix: fix examples and default configuration values

* fix: fix adapters import from html

* fix: fix adapters import from demo html

* Feat/prt 1758 (#99)

* feat: navigation fields

* feat: improve navigation

* feat: improve logic to use navigation with fields

* feat: resolve error build

* feat: resolve build  warning

* Bugfix/prt 1933 (#103)

* feat: set editor default font after report clear

* feat: use syncfusion services for content import

* feat: improve html and RTF content caching and prefetching

* feat: fetch RTF content before html or plain

* fix: fix SFDT content insertion

* Prt 1919 (#98)

* introduzindo o zoomfactor no adapter

* melhorias no zoomFactor

* Solução para o problema do fit to page e fit to width e limpeza de codigo

* fix: fix build errors

* feat: allow providing documentEditor as editorInstance

* fix: fix navigation using toolbar

* feat: merge dev (#104)

* feat: add navigation fields buttons

* debug: add logs to ease PRT-1940 and PRT-1942 debug

* feat: add moveToDocumentEnd method

* feat: add documentEditor getter to adapter

* Feat/prt 1862 (#105)

* feat: create menu context

* feat: add context menu with navigation

* feat: improve logic to insert field

* refactor: remove unnecessary log

---------

Co-authored-by: Daniel Souza <dsouza1995@gmail.com>

* fix: fix cache not being used and report history errors (#107)

* [WIP] fix: fix content caching error

* fix: fix content caching error and report autosave

* feat: stop waiting for finishReport callback

* refactor: remove unused import

* fix: disable setZoomFactor interval

* feat: change colors bookmarks (#108)

* feat: add title format API and improve insertText

* feat: add trackChanges button and editor spinner API

* feat: accept all changes on copyReport

* feat: add iaraRecognizes

* feat: add more title sections

* feat: improve navigation fields (#109)

* feat: add accept all and reject all buttons to review tab

* feat: add has empty required fields (#110)

* feat: improve navigation fields id (#111)

* feat: improve navigation by fields (#112)

* feat: remove space (#113)

* feat: remove the function that prevents space separation (#114)

* feat: remove the function that prevents space separation

* feat: remove comments

* feat: return badly removed code

* fix: handle report saving errors

* fix: handle errors when copying report

* feat: remove white space in goToField (#116)

* fix: fix section titles naming

* fix: yet another section title capitalization fix

* feat: change syncfusion services URL

* feat: major improvements to autosave by using our dedicated service

* feat: use new syncfusion service URL

* feat: improve logic to add a new bookmark (#118)

* feat: improve logic to add a new bookmark

* feat: remove logs

* feat: add support to speechmike field navigation (#119)

* fix: remove unnecessary import to IaraSpeechRecognition

* feat: make syncfusion services use the API proxy

* fix: set the correct content-type for import method

* feat: remove content empty (#121)

* feat: remove content empty

* feat: improve logic

* fix: space add when set a template (#123)

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Itallo <dornelaszxd@gmail.com>
Co-authored-by: André Canuto <andrecanutoc@gmail.com>
Co-authored-by: André Canuto <andrecanuto@MacBook-Pro-de-Andre.local>
Co-authored-by: Itallo Dornelas <72089253+ItalloDornelas@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Braun <151561345+BraunAugusto@users.noreply.github.com>
Co-authored-by: Augusto Braun <augusto@iarahealth.com>
  • Loading branch information
8 people authored May 20, 2024
1 parent 1e6f719 commit 3208542
Show file tree
Hide file tree
Showing 18 changed files with 1,913 additions and 536 deletions.
4 changes: 2 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ <h3>Dados de acesso:</h3>
enableToolbar: true,
height: "800px",
serviceUrl:
"https://ej2services.syncfusion.com/production/web-services/api/documenteditor/",
"https://api.iarahealth.com/speech/syncfusion/api/documenteditor/",
});
editorContainer.appendTo("#editor-container");

Expand All @@ -222,7 +222,7 @@ <h3>Dados de acesso:</h3>
recognition.interimResults = true;

const syncfusionAdapter = new IaraSyncfusionAdapter(
editorContainer,
editorContainer.documentEditor,
recognition
);

Expand Down
819 changes: 548 additions & 271 deletions package-lock.json

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@
"vitest": "^0.29.8"
},
"peerDependencies": {
"@syncfusion/ej2-documenteditor": ">=23.2",
"@syncfusion/ej2-locale": ">=23.1",
"@syncfusion/ej2-ribbon": ">=24.1",
"@syncfusion/ej2-documenteditor": ">=24.2",
"@syncfusion/ej2-locale": ">=24.2",
"@syncfusion/ej2-ribbon": ">=24.2",
"tinymce": ">=6.5"
},
"peerDependenciesMeta": {
Expand Down
3 changes: 0 additions & 3 deletions src/editor/formatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,6 @@ export class IaraEditorInferenceFormatter {
return a.replace(new RegExp(`(por|x) ${oldText}`, "gui"), `x ${newText}`);
}, text);

//convert the 'por' before or after a number and return the formatted expression without a space ex:1x1
text = text.replace(/(\d+(?:,\d+)?) (por|x) (?=\d+(?:,\d+)?)/giu, "$1x");

return text;
}

Expand Down
65 changes: 46 additions & 19 deletions src/editor/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { DocumentEditorContainer } from "@syncfusion/ej2-documenteditor";
import { Editor as TinymceEditor } from "tinymce";
import { IaraSpeechRecognition, IaraSpeechRecognitionDetail } from "../speech";
import { IaraEditorInferenceFormatter } from "./formatter";
import { IaraEditorStyleManager } from "./style";

import { IaraEditorNavigationFieldManager } from "./navigationFields";

export interface IaraEditorConfig {
darkMode: boolean;
font?: {
Expand All @@ -13,24 +13,27 @@ export interface IaraEditorConfig {
size: number;
};
saveReport: boolean;
zoomFactor: string;
}

export abstract class EditorAdapter {
public onIaraCommand?: (command: string) => void;

public iaraRecognizes = true;
protected abstract _styleManager: IaraEditorStyleManager;
protected abstract _navigationFieldManager: IaraEditorNavigationFieldManager;
protected static DefaultConfig: IaraEditorConfig = {
darkMode: false,
saveReport: true,
zoomFactor: "100%",
};

protected _inferenceFormatter: IaraEditorInferenceFormatter;

private _listeners = [
{
key: "iaraSpeechRecognitionResult",
callback: (event?: CustomEvent<IaraSpeechRecognitionDetail>) => {
if (event?.detail) this.insertInference(event.detail);
if (event?.detail && this.iaraRecognizes)
this.insertInference(event.detail);
},
},
{
Expand Down Expand Up @@ -61,7 +64,6 @@ export abstract class EditorAdapter {
];

constructor(
protected _editorContainer: DocumentEditorContainer | TinymceEditor,
protected _recognition: IaraSpeechRecognition,
protected _config: IaraEditorConfig = EditorAdapter.DefaultConfig
) {
Expand All @@ -70,42 +72,46 @@ export abstract class EditorAdapter {
this._initListeners();
this._recognition.internal.settings.replaceCommandActivationStringBeforeCallback =
true;
if (this._config.saveReport && !this._recognition.report["_key"]) {
if (this._recognition.ready) this.beginReport();
else {
this._recognition.addEventListener("iaraSpeechRecognitionReady", () => {
this.beginReport();
});
}
}
}

abstract blockEditorWhileSpeaking(status: boolean): void;
abstract clearReport(): void;
abstract copyReport(): Promise<void>;
abstract copyReport(): Promise<string[]>;
abstract insertInference(inference: IaraSpeechRecognitionDetail): void;
abstract getEditorContent(): Promise<[string, string, string, string?]>;
abstract print(): void;

beginReport(): string | void {
async beginReport(): Promise<string | void> {
if (!this._config.saveReport) return;
return this._recognition.beginReport({ richText: "", text: "" });
return this._recognition.report.begin("", "");
}

async finishReport(): Promise<void> {
if (!this._config.saveReport) return;
await this.copyReport();
const content = await this.copyReport();
this.clearReport();
this._recognition.finishReport();
await this._recognition.report.finish(content[0], content[1]);
}

hasEmptyRequiredFields(): boolean {
return this._navigationFieldManager.hasEmptyRequiredFields();
}

private _initCommands(): void {
this._recognition.commands.add("iara copiar laudo", async () => {
if (this.hasEmptyRequiredFields()) {
this.onIaraCommand?.("required fields to copy");
return;
}
this._recognition.stop();
await this.copyReport();
this.onIaraCommand?.("iara copiar laudo");
});
this._recognition.commands.add("iara finalizar laudo", async () => {
if (this.hasEmptyRequiredFields()) {
this.onIaraCommand?.("required fields to finish");
return;
}
this._recognition.stop();
await this.finishReport();
this.onIaraCommand?.("iara finalizar laudo");
Expand All @@ -125,6 +131,27 @@ export abstract class EditorAdapter {
this._recognition.commands.add("iara imprimir", () => {
this.print();
});
this._recognition.commands.add("iara próximo campo", () => {
this._navigationFieldManager.nextField();
});
this._recognition.commands.add("iara campo anterior", () => {
this._navigationFieldManager.previousField();
});
this._recognition.commands.add("next", () => {
this._navigationFieldManager.nextField();
});
this._recognition.commands.add(
`buscar (\\p{Letter}+)`,
(detail, command, param, groups) => {
try {
this._navigationFieldManager.goToField(groups ? groups[1] : "");
} catch (e) {
this.onIaraCommand?.("buscar");
} finally {
console.info(detail, command, param);
}
}
);
}

private _initListeners(): void {
Expand Down
17 changes: 17 additions & 0 deletions src/editor/navigationFields.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import type { IaraSpeechRecognition } from "../speech";

export abstract class IaraEditorNavigationFieldManager {
abstract nextField(): void;
abstract previousField(): void;
abstract goToField(title: string): void;
abstract hasEmptyRequiredFields(): boolean;

constructor(private _recognition: IaraSpeechRecognition) {
this._recognition.addEventListener("iaraSpeechMikeForwardButtonPress", () =>
this.nextField()
);
this._recognition.addEventListener("iaraSpeechMikeRewindButtonPress", () =>
this.previousField()
);
}
}
Loading

0 comments on commit 3208542

Please sign in to comment.