',
+ '
'
+ );
+ console.log("copyReport", content[0], htmlContent, content[2]);
+ this._recognition.automation.copyText(
+ content[0],
+ htmlContent,
+ content[2]
+ );
+ this.hideSpinner();
+ this._documentEditor.selection.moveNextPosition();
+
+ return content.slice(0, 3);
+ } catch (error) {
+ this.hideSpinner();
+ this._documentEditor.selection.moveToDocumentStart();
+ throw error;
+ }
}
clearReport(): void {
- this._editorContainer.documentEditor.selection.selectAll();
- this._editorContainer.documentEditor.editor.delete();
+ this._documentEditor.enableTrackChanges = false;
+ this._documentEditor.selection.selectAll();
+ this._documentEditor.editor.delete();
+ this._styleManager.setEditorDefaultFont();
}
getEditorContent(): Promise<[string, string, string, string]> {
return this._contentManager.getContent();
}
+ private _formatSectionTitle(titleQueries: string[]): void {
+ let matchedQuery = "";
+ while (!matchedQuery && titleQueries.length) {
+ const query = titleQueries.shift();
+ if (!query) continue;
+
+ this._documentEditor.search.findAll(query);
+ if (this._documentEditor.search.searchResults.length) {
+ matchedQuery = query;
+ this._documentEditor.selection.characterFormat.bold = true;
+ }
+ }
+
+ this._documentEditor.search.searchResults.clear();
+ }
+
+ formatSectionTitles(): void {
+ this._formatSectionTitle(["Técnica:", "Técnica de Exame:"]);
+ this._formatSectionTitle(["Contraste:"]);
+ this._formatSectionTitle([
+ "Histórico Clínico:",
+ "Indicação Clínica:",
+ "Informações Clínicas:",
+ ]);
+ this._formatSectionTitle(["Exames Anteriores:"]);
+ this._formatSectionTitle([
+ "Análise:",
+ "Interpretação:",
+ "Os seguintes aspectos foram observados:",
+ "Relatório:",
+ ]);
+ this._formatSectionTitle(["Objetivo:"]);
+ this._formatSectionTitle([
+ "Conclusão:",
+ "Hipótese Diagnóstica:",
+ "Impressão Diagnóstica:",
+ "Impressão:",
+ "Resumo:",
+ "Observação:",
+ "Observações:",
+ "Opinião:",
+ ]);
+ this._formatSectionTitle([
+ "Achados:",
+ "Achados Adicionais:",
+ "Comparação:",
+ "Demais Achados:",
+ "Método:",
+ "Protocolo:",
+ ]);
+ }
+
+ formatTitle(): void {
+ this._documentEditor.selection.moveToDocumentEnd();
+ const lastParagraph = parseInt(
+ this._documentEditor.selection.endOffset.split(";")[1]
+ );
+ this._documentEditor.selection.moveToDocumentStart();
+
+ let titleLine = "";
+ let currentParagraph = 0;
+ while (!titleLine && currentParagraph <= lastParagraph) {
+ this._documentEditor.selection.selectLine();
+ titleLine = this._documentEditor.selection.text.trim();
+ currentParagraph++;
+ }
+ if (titleLine) {
+ this._documentEditor.selection.characterFormat.bold = true;
+ this._documentEditor.selection.characterFormat.allCaps = true;
+ this._documentEditor.selection.paragraphFormat.textAlignment = "Center";
+ }
+ }
+
+ hideSpinner(): void {
+ hideSpinner(this._documentEditor.editor.documentHelper.viewerContainer);
+ }
+
insertParagraph(): void {
- this._editorContainer.documentEditor.editor.insertText("\n");
+ this._documentEditor.editor.insertText("\n");
}
async insertTemplate(
content: string,
replaceAllContent = false
): Promise {
- const sfdt = await IaraSFDT.fromContent(
- content,
- this._recognition.internal.iaraAPIMandatoryHeaders as HeadersInit
- );
- if (replaceAllContent)
- this._editorContainer.documentEditor.open(sfdt.value);
- else this._editorContainer.documentEditor.editor.paste(sfdt.value);
+ console.log("insertTemplate0", content, replaceAllContent);
+ const sfdt = await this.contentManager.fromContent(content);
+ if (replaceAllContent) this._documentEditor.open(sfdt.value);
+ else {
+ this._documentEditor.editor.paste(sfdt.value);
+ this._documentEditor.editor.onBackSpace();
+ }
+ console.log("insertTemplate1", sfdt.value);
- this._editorContainer.documentEditor.selection.moveToDocumentStart();
+ this._documentEditor.selection.moveToDocumentStart();
+ console.log(
+ "insertTemplate2",
+ this._documentEditor.selection.characterFormat.fontFamily,
+ this._documentEditor.selection.characterFormat.fontSize
+ );
// Set the default editor format after inserting the template
- this._editorContainer.documentEditor.setDefaultCharacterFormat({
- fontFamily:
- this._editorContainer.documentEditor.selection.characterFormat
- .fontFamily,
- fontSize:
- this._editorContainer.documentEditor.selection.characterFormat.fontSize,
+ this._documentEditor.setDefaultCharacterFormat({
+ fontFamily: this._documentEditor.selection.characterFormat.fontFamily,
+ fontSize: this._documentEditor.selection.characterFormat.fontSize,
});
- this._editorContainer.documentEditor.selection.moveToDocumentEnd();
+ this._navigationFieldManager.getBookmarks();
+ this._documentEditor.selection.moveToDocumentEnd();
}
insertText(text: string): void {
- this._editorContainer.documentEditor.editor.insertText(text);
+ const [firstLine, ...lines]: string[] = text.split("\n");
+ this._documentEditor.editor.insertText(firstLine);
+ lines.forEach(line => {
+ this.insertParagraph();
+ line = line.trimStart();
+ if (line) this._documentEditor.editor.insertText(line);
+ });
}
insertInference(inference: IaraSpeechRecognitionDetail): void {
@@ -175,7 +307,7 @@ export class IaraSyncfusionAdapter
if (inference.isFirst) {
this._handleFirstInference();
} else if (this._selectionManager) {
- this._editorContainer.documentEditor.selection.select(
+ this._documentEditor.selection.select(
this._selectionManager.initialSelectionData.startOffset,
this._inferenceEndOffset
);
@@ -196,24 +328,20 @@ export class IaraSyncfusionAdapter
this._selectionManager.isAtStartOfLine
);
- if (text.length) {
- const [firstLine, ...lines]: string[] = text.split("\n");
- this.insertText(firstLine);
- lines.forEach(line => {
- this.insertParagraph();
- line = line.trimStart();
- if (line) this.insertText(line);
- });
- } else this._editorContainer.documentEditor.editor.delete();
+ if (text.length) this.insertText(text);
+ else this._documentEditor.editor.delete();
- this._inferenceEndOffset =
- this._editorContainer.documentEditor.selection.endOffset;
+ this._inferenceEndOffset = this._documentEditor.selection.endOffset;
if (inference.isFinal) this._selectionManager = undefined;
}
+ moveToDocumentEnd() {
+ this._documentEditor.selection.moveToDocumentEnd();
+ }
+
undo(): void {
- this._editorContainer.documentEditor.editorHistory.undo();
+ this._documentEditor.editorHistory.undo();
}
private _debounce(func: () => unknown) {
@@ -231,25 +359,37 @@ export class IaraSyncfusionAdapter
this._contentDate = contentDate;
const element = document.querySelector(".e-de-status-bar");
+
+ const content: string[] = await this._contentManager.getContent();
+ const emptyContent = content[0].trim().length === 0;
+
+ if (emptyContent) {
+ return;
+ }
+
if (element) {
+ this.savingReportSpan.style.width = "120px";
this.savingReportSpan.style.margin = "10px";
this.savingReportSpan.style.fontSize = "12px";
- this.savingReportSpan.style.display = "flex";
- this.savingReportSpan.style.justifyContent = "end";
this.savingReportSpan.style.color = "black";
- this.savingReportSpan.innerText = "Salvando...";
+ this.savingReportSpan.innerHTML =
+ 'Salvando...';
element.insertBefore(this.savingReportSpan, element.firstChild);
}
- const content: string[] = await Promise.all([
- this._contentManager.getPlainTextContent(),
- this._contentManager.getHtmlContent(),
- ]);
-
- if (contentDate !== this._contentDate) return;
+ try {
+ if (contentDate !== this._contentDate) return;
- await this._updateReport(content[0], content[1]);
- this.savingReportSpan.innerText = "Salvo";
+ if (!this._recognition.report["_key"]) {
+ await this.beginReport();
+ }
+ await this._updateReport(content[0], content[1]);
+ this.savingReportSpan.innerHTML =
+ 'Salvo';
+ } catch {
+ this.savingReportSpan.innerHTML =
+ 'Erro ao salvar';
+ }
}
onTemplateSelectedAtShortCut(
@@ -275,7 +415,7 @@ export class IaraSyncfusionAdapter
print(): void {
if (this._config.darkMode) this._styleManager.setEditorFontColor("#000");
- this._editorContainer.documentEditor.print();
+ this._documentEditor.print();
if (this._config.darkMode) this._styleManager.setEditorFontColor("#fff");
}
@@ -284,26 +424,32 @@ export class IaraSyncfusionAdapter
paragraphIndex: number,
content: string
) {
- this._editorContainer.documentEditor.selection.select(
+ this._documentEditor.selection.select(
`${sectionIndex};${paragraphIndex};0`,
`${sectionIndex};${paragraphIndex};0`
);
- this._editorContainer.documentEditor.selection.extendToParagraphEnd();
+ this._documentEditor.selection.extendToParagraphEnd();
this.insertText(content);
}
+ showSpinner(): void {
+ showSpinner(this._documentEditor.editor.documentHelper.viewerContainer);
+ }
+
private _setScrollClickHandler() {
- this._editorContainer.element.addEventListener("mousedown", event => {
- if (event.button === 1) {
- this._cursorSelection = new IaraSyncfusionSelectionManager(
- this._editorContainer.documentEditor,
- false
- );
- }
- });
+ this._documentEditor
+ .getRootElement()
+ .addEventListener("mousedown", event => {
+ if (event.button === 1) {
+ this._cursorSelection = new IaraSyncfusionSelectionManager(
+ this._documentEditor,
+ false
+ );
+ }
+ });
- this._editorContainer.element.addEventListener("mouseup", event => {
+ this._documentEditor.getRootElement().addEventListener("mouseup", event => {
if (event.button === 1) {
this._cursorSelection?.resetSelection();
this._cursorSelection = undefined;
@@ -314,18 +460,18 @@ export class IaraSyncfusionAdapter
}
private _handleFirstInference(): void {
- if (this._editorContainer.documentEditor.selection.text.length) {
- this._editorContainer.documentEditor.editor.delete();
+ if (this._documentEditor.selection.text.length) {
+ this._documentEditor.editor.delete();
}
this._selectionManager = new IaraSyncfusionSelectionManager(
- this._editorContainer.documentEditor
+ this._documentEditor
);
if (this._selectionManager.wordBeforeSelection.endsWith(" ")) {
- this._editorContainer.documentEditor.selection.extendBackward();
- this._editorContainer.documentEditor.editor.delete();
+ this._documentEditor.selection.extendBackward();
+ this._documentEditor.editor.delete();
this._selectionManager = new IaraSyncfusionSelectionManager(
- this._editorContainer.documentEditor
+ this._documentEditor
);
}
}
diff --git a/src/syncfusion/navigationFields/bookmark.ts b/src/syncfusion/navigationFields/bookmark.ts
new file mode 100644
index 0000000..8f47a3e
--- /dev/null
+++ b/src/syncfusion/navigationFields/bookmark.ts
@@ -0,0 +1,9 @@
+export interface IaraBookmark {
+ name: string;
+ content: string;
+ title: string;
+ offset: {
+ start: string;
+ end: string;
+ };
+}
diff --git a/src/syncfusion/navigationFields/index.ts b/src/syncfusion/navigationFields/index.ts
new file mode 100644
index 0000000..ae6dbde
--- /dev/null
+++ b/src/syncfusion/navigationFields/index.ts
@@ -0,0 +1,652 @@
+import {
+ BookmarkElementBox,
+ Dictionary,
+ DocumentEditor,
+ TextPosition,
+} from "@syncfusion/ej2-documenteditor";
+import { IaraSyncfusionConfig } from "..";
+import { IaraEditorNavigationFieldManager } from "../../editor/navigationFields";
+import { IaraSpeechRecognition } from "../../speech";
+import { IaraBookmark } from "./bookmark";
+
+export class IaraSyncfusionNavigationFieldManager extends IaraEditorNavigationFieldManager {
+ previousBookmark: IaraBookmark = {
+ name: "",
+ content: "",
+ title: "",
+ offset: {
+ start: "",
+ end: "",
+ },
+ };
+ nextBookmark: IaraBookmark = {
+ name: "",
+ content: "",
+ title: "",
+ offset: {
+ start: "",
+ end: "",
+ },
+ };
+ currentSelectionOffset: {
+ start: string;
+ end: string;
+ } = {
+ start: "",
+ end: "",
+ };
+ insertedBookmark: IaraBookmark = {
+ name: "",
+ content: "",
+ title: "",
+ offset: {
+ start: "",
+ end: "",
+ },
+ };
+ isFirstNextNavigation = false;
+ isFirstPreviousNavigation = false;
+ private _bookmarks: IaraBookmark[] = [];
+
+ private _previousBookmarksTitles: string[] = [];
+
+ constructor(
+ private _documentEditor: DocumentEditor,
+ private _config: IaraSyncfusionConfig,
+ _recognition: IaraSpeechRecognition
+ ) {
+ super(_recognition);
+ const navigationBtn = (
+ document.getElementById("navigation_fields")
+ );
+
+ if (!navigationBtn) return;
+
+ navigationBtn.addEventListener("click", () => {
+ const insertBtn = document.getElementById("add_field");
+ const nextFieldBtn = document.getElementById("next_field");
+ const previousFieldBtn = (
+ document.getElementById("previous_field")
+ );
+ const insertMandatoryFieldBtn = (
+ document.getElementById("add_mandatory_field")
+ );
+ const insertOptionalFieldBtn = (
+ document.getElementById("add_optional_field")
+ );
+
+ const selectedText = this._documentEditor.selection.text
+ ? this._documentEditor.selection.text.trim()
+ : undefined;
+
+ insertBtn.addEventListener("click", () => {
+ this.insertField(selectedText);
+ });
+ insertMandatoryFieldBtn.addEventListener("click", () => {
+ this.insertMandatoryField(selectedText);
+ });
+ insertOptionalFieldBtn.addEventListener("click", () => {
+ this.insertOptionalField(selectedText);
+ });
+ nextFieldBtn.addEventListener("click", () => {
+ this.nextField();
+ });
+ previousFieldBtn.addEventListener("click", () => {
+ this.previousField();
+ });
+ });
+ }
+
+ insertField(content = "Escreva uma dica de texto"): void {
+ const bookmarksCount = Date.now();
+ this._documentEditor.editor.insertText(" ");
+ this._documentEditor.selection.movePreviousPosition();
+ this._documentEditor.editor.insertBookmark(`Field-${bookmarksCount}`);
+ const title = "Nome do campo";
+ this._documentEditor.editor.insertText("[]");
+ this._documentEditor.selection.movePreviousPosition();
+ this._documentEditor.editor.insertText("<>");
+ this._documentEditor.selection.movePreviousPosition();
+ this._documentEditor.editor.insertText(title);
+ this._documentEditor.selection.clear();
+ this._documentEditor.selection.moveNextPosition();
+ this._documentEditor.editor.insertText(content);
+ this.getBookmarks();
+ this.isFirstNextNavigation = true;
+ this.isFirstPreviousNavigation = true;
+ this.getOffsetsAndSelect(`Field-${bookmarksCount}`, true);
+ this.selectTitle(title, `Field-${bookmarksCount}`);
+ }
+
+ insertMandatoryField(content = "Escreva uma dica de texto"): void {
+ const bookmarksCount = Date.now();
+ this._documentEditor.editor.insertText(" ");
+ this._documentEditor.selection.movePreviousPosition();
+ this._documentEditor.editor.insertBookmark(`Mandatory-${bookmarksCount}`);
+ const title = "Nome do campo";
+ this._documentEditor.editor.insertText("[]");
+ this._documentEditor.selection.movePreviousPosition();
+ this._documentEditor.editor.insertText("<>");
+ this._documentEditor.selection.movePreviousPosition();
+ this._documentEditor.editor.insertText(title);
+ this._documentEditor.selection.clear();
+ this._documentEditor.selection.moveNextPosition();
+ this._documentEditor.editor.insertText(`${content}*`);
+ this.getBookmarks();
+ this.isFirstNextNavigation = true;
+ this.isFirstPreviousNavigation = true;
+ this.getOffsetsAndSelect(`Mandatory-${bookmarksCount}`, true);
+ this.selectTitle(title, `Mandatory-${bookmarksCount}`);
+ }
+
+ insertOptionalField(content = "Escreva uma dica de texto"): void {
+ const bookmarksCount = Date.now();
+ this._documentEditor.editor.insertText(" ");
+ this._documentEditor.selection.movePreviousPosition();
+ this._documentEditor.editor.insertBookmark(`Optional-${bookmarksCount}`);
+ const title = "Nome do campo";
+ this._documentEditor.editor.insertText("[]");
+ this._documentEditor.selection.movePreviousPosition();
+ this._documentEditor.editor.insertText("<>");
+ this._documentEditor.selection.movePreviousPosition();
+ this._documentEditor.editor.insertText(title);
+ this._documentEditor.selection.clear();
+ this._documentEditor.selection.moveNextPosition();
+ this._documentEditor.editor.insertText(`${content}?`);
+ this.getBookmarks();
+ this.isFirstNextNavigation = true;
+ this.isFirstPreviousNavigation = true;
+ this.getOffsetsAndSelect(`Optional-${bookmarksCount}`, true);
+ this.selectTitle(title, `Optional-${bookmarksCount}`);
+ }
+
+ getBookmarks(setColor = true): void {
+ const editorBookmarks = this._documentEditor.getBookmarks();
+ this.updateBookmark(editorBookmarks);
+ this.removeEmptyField(editorBookmarks);
+ if (this.isFirstNextNavigation || this.isFirstPreviousNavigation) {
+ this.insertedBookmark = this._bookmarks.filter(
+ bookmark =>
+ bookmark.name === editorBookmarks[editorBookmarks.length - 1]
+ )[0];
+ }
+ this.sortByPosition();
+ if (this._bookmarks.length > 1)
+ this.getPreviousAndNext(this.currentSelectionOffset);
+
+ if (setColor) this.setColor();
+
+ this._documentEditor.selection.clear();
+ }
+
+ goToField(title: string): void | string {
+ this._previousBookmarksTitles = [...this._previousBookmarksTitles, title];
+ const bookmarks = this._bookmarks.filter(
+ bookmark =>
+ bookmark.title.toLowerCase() === title.toLowerCase() &&
+ bookmark.title !== "Nome do campo" &&
+ bookmark.title !== ""
+ );
+ if (bookmarks.length === 1) {
+ this.getOffsetsAndSelect(bookmarks[0].name);
+ this._previousBookmarksTitles = [];
+ } else if (bookmarks.length > 1) {
+ this.getOffsetsAndSelect(
+ bookmarks[this._previousBookmarksTitles.length - 1].name
+ );
+ } else throw new Error("Method not implemented.");
+ }
+
+ nextField(isShortcutNavigation?: boolean): void {
+ this.currentSelectionOffset = {
+ start: this._documentEditor.selection.startOffset,
+ end: this._documentEditor.selection.endOffset,
+ };
+ this.getBookmarks(false);
+
+ if (isShortcutNavigation && this.isFirstNextNavigation)
+ this.selectContent(
+ this.insertedBookmark.title,
+ this.insertedBookmark.content,
+ this.insertedBookmark.name
+ );
+ else {
+ this.getOffsetsAndSelect(this.nextBookmark.name);
+ }
+ this.isFirstNextNavigation = false;
+ this.currentSelectionOffset = {
+ start: this.nextBookmark.offset.start,
+ end: this.nextBookmark.offset.end,
+ };
+ }
+
+ previousField(isShortcutNavigation?: boolean): void {
+ this.currentSelectionOffset = {
+ start: this._documentEditor.selection.startOffset,
+ end: this._documentEditor.selection.endOffset,
+ };
+
+ this.getBookmarks(false);
+
+ if (isShortcutNavigation && this.isFirstPreviousNavigation)
+ this.selectTitle(this.insertedBookmark.title, this.insertedBookmark.name);
+ else {
+ this.getOffsetsAndSelect(this.previousBookmark.name);
+ }
+ this.isFirstPreviousNavigation = false;
+ this.currentSelectionOffset = {
+ start: this.previousBookmark.offset.start,
+ end: this.previousBookmark.offset.end,
+ };
+ }
+
+ selectContent(title: string, content: string, bookmarkName: string): void {
+ this.getOffsetsAndSelect(bookmarkName, true);
+ this._documentEditor.selection.select(
+ this._documentEditor.selection.startOffset,
+ this._documentEditor.selection.startOffset
+ );
+ const startOffset = this._documentEditor.selection.startOffset.split(";");
+
+ //title lenght and add 3 positions to pass startOffset to content
+ startOffset[2] = String(
+ Number(this._documentEditor.selection.startOffset.split(";")[2]) +
+ (title.length + 3)
+ );
+ const start = startOffset.join(";");
+
+ const endOffset = this._documentEditor.selection.endOffset.split(";");
+ //add content lenght to endOffset to pass endOffset to content
+ endOffset[2] = String(Number(start.split(";")[2]) + content.length);
+ const end = endOffset.join(";");
+
+ this._documentEditor.selection.select(start, end);
+ }
+
+ selectTitle(
+ title: string,
+ bookmarkName: string,
+ selectAllTitle?: boolean
+ ): void {
+ this.getOffsetsAndSelect(bookmarkName, true);
+ this._documentEditor.selection.select(
+ this._documentEditor.selection.startOffset,
+ this._documentEditor.selection.startOffset
+ );
+ const startOffset = this._documentEditor.selection.startOffset.split(";");
+ //add 2 positions so as not to select [ or <
+ startOffset[2] = String(
+ selectAllTitle
+ ? Number(this._documentEditor.selection.startOffset.split(";")[2]) + 1
+ : Number(this._documentEditor.selection.startOffset.split(";")[2]) + 2
+ );
+ const start = startOffset.join(";");
+
+ const endOffset = this._documentEditor.selection.endOffset.split(";");
+ //remove the content size plus 2 positions so as not to select > or ]
+ endOffset[2] = String(
+ selectAllTitle
+ ? Number(this._documentEditor.selection.endOffset.split(";")[2]) +
+ (title.length + 3)
+ : Number(this._documentEditor.selection.endOffset.split(";")[2]) +
+ (title.length + 2)
+ );
+ const end = endOffset.join(";");
+ this._documentEditor.selection.select(start, end);
+ }
+
+ sortByPosition(): void {
+ this._bookmarks.sort(
+ (
+ currentOffset: { offset: { start: string; end: string } },
+ nextOffset: { offset: { start: string; end: string } }
+ ) => {
+ const current = currentOffset.offset.start.split(";").map(Number);
+ const next = nextOffset.offset.start.split(";").map(Number);
+ return (
+ current[0] - next[0] || current[1] - next[1] || current[2] - next[2]
+ );
+ }
+ );
+ }
+
+ getTitleAndContent(bookmarkContent: string): {
+ title: string;
+ content: string;
+ } {
+ let title = "";
+ let content = "";
+ if (bookmarkContent.includes("[")) {
+ const insideContent = bookmarkContent.replace(
+ /\[(.*)\]/,
+ (_match, group1) => group1
+ );
+ title = insideContent.split(">")[0].substring(1);
+ content = insideContent.split(">")[1];
+ } else {
+ content = bookmarkContent;
+ }
+ return {
+ title,
+ content,
+ };
+ }
+
+ popAndUpdate(bookmarkName: string, content: string, title: string): void {
+ const index = this._bookmarks.findIndex(item => item.name === bookmarkName);
+ if (
+ bookmarkName.includes("Field") ||
+ bookmarkName.includes("Mandatory") ||
+ bookmarkName.includes("Optional")
+ ) {
+ if (index !== -1) {
+ this._bookmarks = this._bookmarks.map(item => {
+ if (item.name === bookmarkName) {
+ return {
+ name: bookmarkName,
+ content,
+ title,
+ offset: {
+ start: this._documentEditor.selection.startOffset,
+ end: this._documentEditor.selection.endOffset,
+ },
+ };
+ }
+ return item;
+ });
+ } else {
+ this._bookmarks = [
+ ...this._bookmarks,
+ {
+ name: bookmarkName,
+ content,
+ title,
+ offset: {
+ start: this._documentEditor.selection.startOffset,
+ end: this._documentEditor.selection.endOffset,
+ },
+ },
+ ];
+ }
+ }
+ }
+
+ setColor() {
+ this._bookmarks.map(bookmark => {
+ this._documentEditor.selection.select(
+ bookmark.offset.start,
+ bookmark.offset.end
+ );
+ if (bookmark.name.includes("Mandatory")) {
+ this._config.darkMode
+ ? // eslint-disable-next-line @typescript-eslint/ban-ts-comment
+ //@ts-ignore
+ (this._documentEditor.selection.characterFormat.highlightColor =
+ "#6C4E35")
+ : // eslint-disable-next-line @typescript-eslint/ban-ts-comment
+ //@ts-ignore
+ (this._documentEditor.selection.characterFormat.highlightColor =
+ "#FFD5BB");
+ this.selectTitle(bookmark.title, bookmark.name, true);
+ this._config.darkMode
+ ? // eslint-disable-next-line @typescript-eslint/ban-ts-comment
+ //@ts-ignore
+ (this._documentEditor.selection.characterFormat.highlightColor =
+ "#C07240")
+ : // eslint-disable-next-line @typescript-eslint/ban-ts-comment
+ //@ts-ignore
+ (this._documentEditor.selection.characterFormat.highlightColor =
+ "#FFEBD8");
+ this.selectContent(bookmark.title, bookmark.content, bookmark.name);
+ this._config.darkMode
+ ? // eslint-disable-next-line @typescript-eslint/ban-ts-comment
+ //@ts-ignore
+ (this._documentEditor.selection.characterFormat.highlightColor =
+ "#6C4E35")
+ : // eslint-disable-next-line @typescript-eslint/ban-ts-comment
+ //@ts-ignore
+ (this._documentEditor.selection.characterFormat.highlightColor =
+ "#FFD5BB");
+ }
+ if (bookmark.name.includes("Field")) {
+ this._config.darkMode
+ ? // eslint-disable-next-line @typescript-eslint/ban-ts-comment
+ //@ts-ignore
+ (this._documentEditor.selection.characterFormat.highlightColor =
+ "#565656")
+ : // eslint-disable-next-line @typescript-eslint/ban-ts-comment
+ //@ts-ignore
+ (this._documentEditor.selection.characterFormat.highlightColor =
+ "#DDDDDD");
+ this.selectTitle(bookmark.title, bookmark.name, true);
+ this._config.darkMode
+ ? // eslint-disable-next-line @typescript-eslint/ban-ts-comment
+ //@ts-ignore
+ (this._documentEditor.selection.characterFormat.highlightColor =
+ "#3F3F3F")
+ : // eslint-disable-next-line @typescript-eslint/ban-ts-comment
+ //@ts-ignore
+ (this._documentEditor.selection.characterFormat.highlightColor =
+ "#AEAEAE");
+ this.selectContent(bookmark.title, bookmark.content, bookmark.name);
+ this._config.darkMode
+ ? // eslint-disable-next-line @typescript-eslint/ban-ts-comment
+ //@ts-ignore
+ (this._documentEditor.selection.characterFormat.highlightColor =
+ "#565656")
+ : // eslint-disable-next-line @typescript-eslint/ban-ts-comment
+ //@ts-ignore
+ (this._documentEditor.selection.characterFormat.highlightColor =
+ "#DDDDDD");
+ }
+ if (bookmark.name.includes("Optional")) {
+ this._config.darkMode
+ ? // eslint-disable-next-line @typescript-eslint/ban-ts-comment
+ //@ts-ignore
+ (this._documentEditor.selection.characterFormat.highlightColor =
+ "#4C83AC")
+ : // eslint-disable-next-line @typescript-eslint/ban-ts-comment
+ //@ts-ignore
+ (this._documentEditor.selection.characterFormat.highlightColor =
+ "#CEEFFE");
+ this.selectTitle(bookmark.title, bookmark.name, true);
+ this._config.darkMode
+ ? // eslint-disable-next-line @typescript-eslint/ban-ts-comment
+ //@ts-ignore
+ (this._documentEditor.selection.characterFormat.highlightColor =
+ "#356688")
+ : // eslint-disable-next-line @typescript-eslint/ban-ts-comment
+ //@ts-ignore
+ (this._documentEditor.selection.characterFormat.highlightColor =
+ "#BAE1FE");
+ this.selectContent(bookmark.title, bookmark.content, bookmark.name);
+ this._config.darkMode
+ ? // eslint-disable-next-line @typescript-eslint/ban-ts-comment
+ //@ts-ignore
+ (this._documentEditor.selection.characterFormat.highlightColor =
+ "#4C83AC")
+ : // eslint-disable-next-line @typescript-eslint/ban-ts-comment
+ //@ts-ignore
+ (this._documentEditor.selection.characterFormat.highlightColor =
+ "#CEEFFE");
+ }
+ });
+ }
+
+ updateBookmark(editorBookmarks: string[]): void {
+ editorBookmarks.map(bookmark => {
+ this.getOffsetsAndSelect(bookmark);
+ const bookmarkContent = this._documentEditor.selection.text;
+ const { title, content } = this.getTitleAndContent(bookmarkContent);
+ this.popAndUpdate(bookmark, content, title);
+ });
+ }
+
+ removeEmptyField(editorBookmarks: string[]): void {
+ this._bookmarks = this._bookmarks.filter(item =>
+ editorBookmarks.includes(item.name)
+ );
+ this._bookmarks = this._bookmarks.filter(bookmark => bookmark.title);
+ }
+
+ getPreviousAndNext(currentOffset: { start: string; end: string }): void {
+ const index = this._bookmarks.findIndex(
+ bookmark => this.findCurrentIndex(currentOffset, bookmark.offset) < 0
+ );
+
+ const previousIndex = index <= 0 ? this._bookmarks.length - 1 : index - 1;
+
+ let previousField =
+ index <= 0
+ ? this._bookmarks[previousIndex]
+ : this._bookmarks[previousIndex];
+
+ const nextField =
+ index === -1 ? this._bookmarks[0] : this._bookmarks[index];
+
+ previousField = this.checkIsSelectedAndUpdatePrevious(previousIndex);
+
+ this.previousBookmark = previousField;
+ this.nextBookmark = nextField;
+ }
+
+ findCurrentIndex(
+ bookmark: { start: string; end: string },
+ currentOffset: { start: string; end: string }
+ ): number {
+ const bookmarkOffsetStart = bookmark.start.split(";").map(Number);
+ const currentOffsetStart = currentOffset.start.split(";").map(Number);
+ const bookmarkOffsetEnd = bookmark.end.split(";").map(Number);
+ const currentOffsetEnd = currentOffset.end.split(";").map(Number);
+ for (let i = 0; i < bookmarkOffsetStart.length; i++) {
+ if (bookmarkOffsetStart[i] !== currentOffsetStart[i]) {
+ return bookmarkOffsetStart[i] - currentOffsetStart[i];
+ }
+ }
+ for (let i = 0; i < bookmarkOffsetEnd.length; i++) {
+ if (bookmarkOffsetEnd[i] !== currentOffsetEnd[i]) {
+ return bookmarkOffsetEnd[i] - currentOffsetEnd[i];
+ }
+ }
+ return 0;
+ }
+
+ checkIsSelectedAndUpdatePrevious(previousIndex: number): IaraBookmark {
+ let selected = this._bookmarks[previousIndex];
+
+ const compareCurrentOffsetWithPreviousOffset =
+ this.currentSelectionOffset.start &&
+ this.currentSelectionOffset.start ===
+ this.previousBookmark.offset.start &&
+ this.previousBookmark.offset.end === this.currentSelectionOffset.end;
+
+ const compareCurrentOffsetWithNextOffset =
+ this.currentSelectionOffset.start &&
+ this.currentSelectionOffset.start === this.nextBookmark.offset.start &&
+ this.currentSelectionOffset.end === this.nextBookmark.offset.end;
+
+ const compareCurrentOffsetWithSelecteOffset =
+ this.previousBookmark.offset.start &&
+ this.previousBookmark.content !== selected.content;
+
+ if (
+ compareCurrentOffsetWithPreviousOffset ||
+ compareCurrentOffsetWithNextOffset ||
+ compareCurrentOffsetWithSelecteOffset
+ ) {
+ selected = this._bookmarks[previousIndex - 1];
+ return previousIndex <= 0
+ ? this._bookmarks[this._bookmarks.length - 1]
+ : this._bookmarks[previousIndex - 1];
+ }
+ return this._bookmarks[previousIndex];
+ }
+
+ getOffsetsAndSelect(name: string, excludeBookmarkStartEnd?: boolean): void {
+ const bookmarks: Dictionary =
+ this._documentEditor.documentHelper.bookmarks;
+
+ if (bookmarks.containsKey(name)) {
+ //bookmark start element
+ const bookmrkElmnt: BookmarkElementBox = bookmarks.get(name);
+
+ let offset: number = bookmrkElmnt.line.getOffset(bookmrkElmnt, 0);
+
+ if (excludeBookmarkStartEnd) {
+ offset++;
+ }
+
+ const startPosition: TextPosition = new TextPosition(
+ this._documentEditor
+ );
+ startPosition.setPositionParagraph(bookmrkElmnt.line, offset);
+
+ //bookmark end element
+ let bookmrkEnd: BookmarkElementBox = bookmrkElmnt.reference;
+ if (
+ bookmrkElmnt.reference &&
+ bookmrkElmnt.reference.line.paragraph.bodyWidget == null
+ ) {
+ bookmrkEnd = bookmrkElmnt;
+ }
+
+ let endoffset: number = bookmrkEnd.line.getOffset(bookmrkEnd, 1);
+
+ if (excludeBookmarkStartEnd) {
+ endoffset--;
+ }
+ const endPosition: TextPosition = new TextPosition(this._documentEditor);
+ endPosition.setPositionParagraph(bookmrkEnd.line, endoffset);
+ //selects the bookmark range
+ this._documentEditor.documentHelper.selection.selectRange(
+ startPosition,
+ endPosition
+ );
+ }
+ }
+
+ clearReportToCopyContent(): void {
+ this.getBookmarks(false);
+ this._bookmarks.filter(field => {
+ this.getOffsetsAndSelect(field.name);
+ if (field.name.includes("Field")) {
+ if (field.content && field.content !== "Escreva uma dica de texto") {
+ this._documentEditor.editor.insertText(field.content);
+ this._documentEditor.editor.deleteBookmark(field.name);
+ } else {
+ this._documentEditor.editor.delete();
+ this._documentEditor.editor.onBackSpace();
+ this._documentEditor.editor.deleteBookmark(field.name);
+ }
+ }
+ if (field.name.includes("Optional")) {
+ if (field.title) {
+ this._documentEditor.editor.delete();
+ this._documentEditor.editor.onBackSpace();
+ this._documentEditor.editor.deleteBookmark(field.name);
+ }
+ }
+ });
+ }
+
+ requiredFields(): boolean {
+ this.getBookmarks(false);
+ const mandatoriesFields = this._bookmarks.filter(
+ bookmark => bookmark.name.includes("Mandatory") && bookmark.title
+ );
+ if (mandatoriesFields.length) {
+ if (mandatoriesFields[0].title) {
+ this.getOffsetsAndSelect(mandatoriesFields[0].name);
+ }
+ return true;
+ }
+ return false;
+ }
+
+ hasEmptyRequiredFields(): boolean {
+ if (!this.requiredFields()) {
+ this.clearReportToCopyContent();
+ }
+ return this.requiredFields();
+ }
+}
diff --git a/src/syncfusion/shortcuts/index.ts b/src/syncfusion/shortcuts/index.ts
index cc67b49..5598c3c 100644
--- a/src/syncfusion/shortcuts/index.ts
+++ b/src/syncfusion/shortcuts/index.ts
@@ -6,6 +6,7 @@ import { ListView } from "@syncfusion/ej2-lists";
import { Dialog } from "@syncfusion/ej2-popups";
import { IaraSpeechRecognition } from "../../speech";
import { IaraSyncfusionTemplateSearch } from "./templateSearch";
+import { IaraSyncfusionNavigationFieldManager } from "../navigationFields";
export class IaraSyncfusionShortcutsManager {
constructor(
@@ -14,43 +15,61 @@ export class IaraSyncfusionShortcutsManager {
private onTemplateSelected: (
listViewInstance: ListView,
dialogObj: Dialog
- ) => void
+ ) => void,
+ private _navigationFieldManager: IaraSyncfusionNavigationFieldManager
) {
this._editor.keyDown = this.onKeyDown.bind(this);
}
onKeyDown(args: DocumentEditorKeyDownEventArgs): void {
- if (args.event.key === "@") {
- const templates = [
- ...Object.values(this._recognition.richTranscriptTemplates.templates),
- ];
+ switch (args.event.key) {
+ case "@":
+ this.shortcutByAt();
+ break;
+ case "Tab":
+ args.isHandled = true;
+ this.shortcutByTabAndShiftTab(args);
+ break;
+ default:
+ break;
+ }
+ }
- const updateFormatTemplates = templates.map(template => {
- const metadata = template.metadata as {
- category: string;
- name: string;
- };
- return {
- name: metadata.name,
- category: metadata.category ? metadata.category : "",
- content: template.replaceText,
- };
- });
+ shortcutByAt(): void {
+ const templates = [
+ ...Object.values(this._recognition.richTranscriptTemplates.templates),
+ ];
- const sortOrder = updateFormatTemplates.sort(
- (oldTemplate, newTemplate) => {
- // Compare based on the 'type' key
- if (oldTemplate.category === newTemplate.category) {
- // If types are the same, order by the 'value' key
- return oldTemplate["name"].localeCompare(newTemplate["name"]);
- } else {
- // Order 'template' items first
- return oldTemplate.category === "Template" ? -1 : 1;
- }
- }
- );
+ const updateFormatTemplates = templates.map(template => {
+ const metadata = template.metadata as {
+ category: string;
+ name: string;
+ };
+ return {
+ name: metadata.name,
+ category: metadata.category ? metadata.category : "",
+ content: template.replaceText,
+ };
+ });
+
+ const sortOrder = updateFormatTemplates.sort((oldTemplate, newTemplate) => {
+ // Compare based on the 'type' key
+ if (oldTemplate.category === newTemplate.category) {
+ // If types are the same, order by the 'value' key
+ return oldTemplate["name"].localeCompare(newTemplate["name"]);
+ } else {
+ // Order 'template' items first
+ return oldTemplate.category === "Template" ? -1 : 1;
+ }
+ });
+ new IaraSyncfusionTemplateSearch(sortOrder, this.onTemplateSelected);
+ }
- new IaraSyncfusionTemplateSearch(sortOrder, this.onTemplateSelected);
+ shortcutByTabAndShiftTab(args: DocumentEditorKeyDownEventArgs): void {
+ if (args.event.shiftKey && args.event.key == "Tab") {
+ this._navigationFieldManager.previousField(true);
+ } else if (args.event.key == "Tab") {
+ this._navigationFieldManager.nextField(true);
}
}
}
diff --git a/src/syncfusion/style.ts b/src/syncfusion/style.ts
index 9783808..0ae6e1b 100644
--- a/src/syncfusion/style.ts
+++ b/src/syncfusion/style.ts
@@ -3,6 +3,8 @@ import { IaraSyncfusionConfig } from ".";
import { IaraEditorStyleManager } from "../editor/style";
export class IaraSyncfusionStyleManager extends IaraEditorStyleManager {
+ public zoomInterval: ReturnType | null = null;
+
constructor(
private _editor: DocumentEditor,
private _config: IaraSyncfusionConfig
@@ -10,12 +12,19 @@ export class IaraSyncfusionStyleManager extends IaraEditorStyleManager {
super();
this.setTheme(this._config.darkMode ? "dark" : "light");
+ this.setEditorDefaultFont();
+ }
+ setEditorDefaultFont(): void {
this._editor.setDefaultCharacterFormat({
fontFamily: this._config.font?.family,
fontSize: this._config.font?.size,
fontColor: this._config.darkMode ? "#fff" : "#000",
});
+
+ // this.zoomInterval = setInterval(() => {
+ // this.setZoomFactor(this._config.zoomFactor ?? "100%");
+ // }, 100);
}
setEditorFontColor(color: string): void {
@@ -38,6 +47,19 @@ export class IaraSyncfusionStyleManager extends IaraEditorStyleManager {
this._editor.setDefaultCharacterFormat({ fontColor: "#fff" });
}
+ public setZoomFactor(zoomFactor: string) {
+ if (zoomFactor.match("Fit one page")) {
+ this._editor.fitPage("FitOnePage");
+ } else if (zoomFactor.match("Fit page width")) {
+ this._editor.fitPage("FitPageWidth");
+ } else {
+ const zoomFactorFixed = parseInt(zoomFactor, 0) / 100;
+ this._editor.zoomFactor = Number(zoomFactorFixed);
+ }
+
+ if (this.zoomInterval) clearInterval(this.zoomInterval);
+ }
+
static loadThemeCss(theme: "light" | "dark") {
if (theme === "dark") {
const FILE = "https://cdn.syncfusion.com/ej2/24.2.9/material3-dark.css";
diff --git a/src/syncfusion/toolbar/config.ts b/src/syncfusion/toolbar/config.ts
index 9ea163b..75fa03e 100644
--- a/src/syncfusion/toolbar/config.ts
+++ b/src/syncfusion/toolbar/config.ts
@@ -9,8 +9,8 @@ import {
RibbonFileMenu,
} from "@syncfusion/ej2-ribbon";
import { IaraSyncfusionConfig } from "..";
-import { tabsConfig } from "./ribbonTabs";
import { IaraSFDT } from "../content";
+import { tabsConfig } from "./ribbonTabs";
export interface RibbonFontMethods {
changeFontFamily: (
@@ -243,6 +243,14 @@ const toolbarButtonClick = (
editor.documentEditor.documentEditorSettings.showHiddenMarks =
!editor.documentEditor.documentEditorSettings.showHiddenMarks;
break;
+ case "ToggleTrackChanges":
+ editor.documentEditor.enableTrackChanges =
+ !editor.documentEditor.enableTrackChanges;
+ changeActiveState(
+ editor.documentEditor.enableTrackChanges,
+ "trackChangesBtn"
+ );
+ break;
default:
break;
}
diff --git a/src/syncfusion/toolbar/index.ts b/src/syncfusion/toolbar/index.ts
index 8ecdb26..66b957e 100644
--- a/src/syncfusion/toolbar/index.ts
+++ b/src/syncfusion/toolbar/index.ts
@@ -2,6 +2,8 @@ import type { DocumentEditorContainer } from "@syncfusion/ej2-documenteditor";
import * as EJ2_LOCALE from "@syncfusion/ej2-locale/src/pt-BR.json";
import { toolBarSettings } from "./config";
import { IaraSyncfusionConfig } from "..";
+import { createElement } from "@syncfusion/ej2-base";
+import { TabItemModel, SelectingEventArgs } from "@syncfusion/ej2-navigations";
export class IaraSyncfusionToolbarManager {
constructor(
@@ -12,6 +14,7 @@ export class IaraSyncfusionToolbarManager {
public init(): void {
this._addRibbonToolbar();
this._removePropertiesPane();
+ this._setupTrackChangesTab();
}
private _removePropertiesPane(): void {
@@ -102,4 +105,40 @@ export class IaraSyncfusionToolbarManager {
this._editorContainer.resize();
}
}
+
+ private _setupTrackChangesTab() {
+ const acceptAllHeader: HTMLElement = createElement("div", {
+ innerHTML: "Aceitar tudo",
+ });
+ const rejectAllHeader: HTMLElement = createElement("div", {
+ innerHTML: "Rejeitar tudo",
+ });
+
+ const totalItems = document.querySelectorAll(
+ "#iara-syncfusion-editor-container_editorReview_Tab_tab_header_items .e-toolbar-item"
+ ).length;
+ const items: TabItemModel[] = [
+ { header: { text: acceptAllHeader } },
+ { header: { text: rejectAllHeader } },
+ ] as TabItemModel[];
+ this._editorContainer.documentEditor.trackChangesPane[
+ "commentReviewPane"
+ ].reviewTab.addTab(items, totalItems);
+
+ this._editorContainer.documentEditor.trackChangesPane[
+ "commentReviewPane"
+ ].reviewTab.addEventListener("selecting", (event: SelectingEventArgs) => {
+ const selectedTabText = (
+ event.selectingItem.getElementsByClassName("e-tab-text")[0]
+ .childNodes[0] as HTMLElement
+ ).innerText;
+ if (selectedTabText == "ACEITAR TUDO") {
+ event.cancel = true;
+ this._editorContainer.documentEditor.revisions.acceptAll();
+ } else if (selectedTabText == "REJEITAR TUDO") {
+ event.cancel = true;
+ this._editorContainer.documentEditor.revisions.rejectAll();
+ }
+ });
+ }
}
diff --git a/src/syncfusion/toolbar/ribbonTabs.ts b/src/syncfusion/toolbar/ribbonTabs.ts
index 602f9d2..6053ade 100644
--- a/src/syncfusion/toolbar/ribbonTabs.ts
+++ b/src/syncfusion/toolbar/ribbonTabs.ts
@@ -540,9 +540,55 @@ export const tabsConfig = (
},
],
},
+ {
+ id: "navigation_fields_content",
+ header: "Marcadores",
+ groupIconCss: "e-icons e-align-center",
+ collections: [
+ {
+ items: [
+ {
+ displayOptions: DisplayMode.Classic,
+ type: "DropDown",
+ id: "navigation_fields",
+ dropDownSettings: {
+ iconCss: "e-icons e-bookmark",
+ content: "Campos de navegação",
+ items: [
+ {
+ id: "add_field",
+ iconCss: "e-icons e-plus",
+ text: "Adicionar campo",
+ },
+ {
+ id: "add_mandatory_field",
+ iconCss: "e-icons e-lock",
+ text: "Adicionar campo obrigatório",
+ },
+ {
+ id: "add_optional_field",
+ iconCss: "e-icons e-circle-info",
+ text: "Adicionar campo opcional",
+ },
+ {
+ id: "next_field",
+ iconCss: "e-icons e-arrow-right",
+ text: "Próximo campo",
+ },
+ {
+ id: "previous_field",
+ iconCss: "e-icons e-arrow-left",
+ text: "Campo anterior",
+ },
+ ],
+ },
+ },
+ ],
+ },
+ ],
+ },
{
id: "export_group",
- orientation: "Row",
header: editorContainerLocale.grid["Export"],
groupIconCss: "e-icons e-align-center",
collections: [
@@ -565,6 +611,31 @@ export const tabsConfig = (
},
],
},
+ {
+ id: "track_changes",
+ header: "Revisão",
+ collections: [
+ {
+ items: [
+ {
+ id: "trackChangesBtn",
+ type: "Button",
+ buttonSettings: {
+ iconCss: "e-icons e-changes-track",
+ content: "Rastrear mudanças",
+ clicked: function () {
+ toolbarButtonClick("ToggleTrackChanges", editor, config);
+ },
+ },
+ ribbonTooltipSettings: {
+ title:
+ editorContainerLocale.documenteditor["Tracked changes"],
+ },
+ },
+ ],
+ },
+ ],
+ },
],
},
];
diff --git a/src/tinymce/index.ts b/src/tinymce/index.ts
index 99e4d37..e36a7e3 100644
--- a/src/tinymce/index.ts
+++ b/src/tinymce/index.ts
@@ -1,26 +1,34 @@
import { Editor } from "tinymce";
import { EditorAdapter, IaraEditorConfig } from "../editor";
import { IaraEditorInferenceFormatter } from "../editor/formatter";
-import { IaraSpeechRecognition, IaraSpeechRecognitionDetail } from "../speech";
+import type {
+ IaraSpeechRecognition,
+ IaraSpeechRecognitionDetail,
+} from "../speech";
import { IaraTinyMceStyleManager } from "./style";
+import { IaraTinyMceNavigationFieldManager } from "./navigationFields";
export class IaraTinyMCEAdapter extends EditorAdapter implements EditorAdapter {
protected _styleManager: IaraTinyMceStyleManager;
+ protected _navigationFieldManager: IaraTinyMceNavigationFieldManager;
private _initialUndoStackSize = 0;
constructor(
- protected _editorContainer: Editor,
+ protected _editor: Editor,
protected _recognition: IaraSpeechRecognition,
protected _config: IaraEditorConfig
) {
- super(_editorContainer, _recognition, _config);
+ super(_recognition, _config);
this._inferenceFormatter = new IaraEditorInferenceFormatter();
this._styleManager = new IaraTinyMceStyleManager();
- this._editorContainer.on("destroyed", this._onEditorDestroyed.bind(this));
+ this._navigationFieldManager = new IaraTinyMceNavigationFieldManager(
+ _recognition
+ );
+ this._editor.on("destroyed", this._onEditorDestroyed.bind(this));
}
getUndoStackSize(): number {
- return (this._editorContainer.undoManager as any).data.length || 0;
+ return (this._editor.undoManager as any).data.length || 0;
}
getEditorContent(): Promise<[string, string, string]> {
@@ -51,11 +59,11 @@ export class IaraTinyMCEAdapter extends EditorAdapter implements EditorAdapter {
}
insertParagraph() {
- this._editorContainer.execCommand("InsertParagraph");
+ this._editor.execCommand("InsertParagraph");
}
insertText(text: string) {
- this._editorContainer.insertContent(text);
+ this._editor.insertContent(text);
}
blockEditorWhileSpeaking(status: boolean) {
@@ -64,10 +72,10 @@ export class IaraTinyMCEAdapter extends EditorAdapter implements EditorAdapter {
}
undo() {
- this._editorContainer.undoManager.undo();
+ this._editor.undoManager.undo();
}
- copyReport(): Promise {
+ copyReport(): Promise {
throw new Error("Método não implementado.");
}
@@ -78,4 +86,18 @@ export class IaraTinyMCEAdapter extends EditorAdapter implements EditorAdapter {
print(): void {
throw new Error("Method not implemented.");
}
+
+ nextField(): void {
+ throw new Error("Method not implemented.");
+ }
+ previousField(): void {
+ throw new Error("Method not implemented.");
+ }
+ goToField(title: string): void {
+ console.log(title);
+ throw new Error("Method not implemented.");
+ }
+ hasEmptyRequiredFields(): boolean {
+ throw new Error("Method not implemented.");
+ }
}
diff --git a/src/tinymce/navigationFields.ts b/src/tinymce/navigationFields.ts
new file mode 100644
index 0000000..d2c7a09
--- /dev/null
+++ b/src/tinymce/navigationFields.ts
@@ -0,0 +1,17 @@
+import { IaraEditorNavigationFieldManager } from "../editor/navigationFields";
+
+export class IaraTinyMceNavigationFieldManager extends IaraEditorNavigationFieldManager {
+ nextField(): void {
+ throw new Error("Method not implemented.");
+ }
+ previousField(): void {
+ throw new Error("Method not implemented.");
+ }
+ goToField(title: string): void {
+ console.log(title);
+ throw new Error(`Method not implemented.`);
+ }
+ hasEmptyRequiredFields(): boolean {
+ throw new Error("Method not implemented.");
+ }
+}