diff --git a/src/SIL.XForge.Scripture/ClientApp/src/app/shared/text/quill-editor-registration/quill-formats/quill-blots.ts b/src/SIL.XForge.Scripture/ClientApp/src/app/shared/text/quill-editor-registration/quill-formats/quill-blots.ts index b70c06cfd0d..4e5d9f7fb49 100644 --- a/src/SIL.XForge.Scripture/ClientApp/src/app/shared/text/quill-editor-registration/quill-formats/quill-blots.ts +++ b/src/SIL.XForge.Scripture/ClientApp/src/app/shared/text/quill-editor-registration/quill-formats/quill-blots.ts @@ -313,6 +313,12 @@ export class NoteThreadEmbed extends QuillEmbedBlot { }; } + appendChild(_child: Node): void { + // An embed cannot have children. As such, we will just ignore this request. + // This function can be called by wrap() if the embed is inside an inline of block, + // and this embed is having a format applied to it (i.e. 'highlight' in EditorComponent). + } + format(name: string, value: any): void { if (name === NoteThreadEmbed.blotName && value != null) { const ref = value as NoteThread; diff --git a/src/SIL.XForge.Scripture/ClientApp/src/app/translate/editor/editor.component.ts b/src/SIL.XForge.Scripture/ClientApp/src/app/translate/editor/editor.component.ts index 2929079bc70..b18807f429d 100644 --- a/src/SIL.XForge.Scripture/ClientApp/src/app/translate/editor/editor.component.ts +++ b/src/SIL.XForge.Scripture/ClientApp/src/app/translate/editor/editor.component.ts @@ -748,17 +748,15 @@ export class EditorComponent extends DataLoadingComponent implements OnDestroy, this.userService.currentUserId ); - this.initLynxFeatureStates(this.projectUserConfigDoc); - this.sourceProjectDoc = await this.getSourceProjectDoc(); if (this.projectUserConfigChangesSub != null) { this.projectUserConfigChangesSub.unsubscribe(); } - this.projectUserConfigChangesSub = this.projectUserConfigDoc.remoteChanges$.subscribe(() => { + this.projectUserConfigChangesSub = this.projectUserConfigDoc.remoteChanges$.subscribe(async () => { if (this.projectUserConfigDoc?.data != null) { // Reload config if the checksum has been reset on the server if (this.projectUserConfigDoc.data.selectedSegmentChecksum == null) { - this.loadProjectUserConfig(); + await this.loadProjectUserConfig(); } else { this.loadTranslateSuggesterConfidence(); } @@ -789,7 +787,10 @@ export class EditorComponent extends DataLoadingComponent implements OnDestroy, this.updateVerseNumber(); // Set chapter from route if provided - this.loadProjectUserConfig(chapterNum != null ? Number.parseInt(chapterNum) : undefined); + await this.loadProjectUserConfig(chapterNum != null ? Number.parseInt(chapterNum) : undefined); + + // Lynx must be initialized after the adding of notes and other text-change related events + this.initLynxFeatureStates(this.projectUserConfigDoc); if (this.projectDoc.id !== prevProjectId) { this.setupTranslationEngine(); @@ -2024,7 +2025,7 @@ export class EditorComponent extends DataLoadingComponent implements OnDestroy, }); } - private loadProjectUserConfig(chapterFromUrl?: number): void { + private async loadProjectUserConfig(chapterFromUrl?: number): Promise { let chapter: number = chapterFromUrl ?? this.chapters[0] ?? 1; this.loadTranslateSuggesterConfidence(); @@ -2046,10 +2047,10 @@ export class EditorComponent extends DataLoadingComponent implements OnDestroy, } this.toggleNoteThreadVerses(false); this.chapter$.next(chapter); - this.changeText(); + await this.changeText(); this.toggleNoteThreadVerses(true); - this.updateAutoDraftTabVisibility(); - this.updateBiblicalTermsTabVisibility(); + await this.updateAutoDraftTabVisibility(); + await this.updateBiblicalTermsTabVisibility(); } private loadTranslateSuggesterConfidence(): void {