Skip to content

Commit f441aa6

Browse files
committed
SF-3565 Fix error when opening a note in a Lynx insight
1 parent 7140f65 commit f441aa6

File tree

2 files changed

+16
-9
lines changed

2 files changed

+16
-9
lines changed

src/SIL.XForge.Scripture/ClientApp/src/app/shared/text/quill-editor-registration/quill-formats/quill-blots.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,12 @@ export class NoteThreadEmbed extends QuillEmbedBlot {
313313
};
314314
}
315315

316+
appendChild(_child: Node): void {
317+
// An embed cannot have children. As such, we will just ignore this request.
318+
// This function can be called by wrap() if the embed is inside an inline of block,
319+
// and this embed is having a format applied to it (i.e. 'highlight' in EditorComponent).
320+
}
321+
316322
format(name: string, value: any): void {
317323
if (name === NoteThreadEmbed.blotName && value != null) {
318324
const ref = value as NoteThread;

src/SIL.XForge.Scripture/ClientApp/src/app/translate/editor/editor.component.ts

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -748,17 +748,15 @@ export class EditorComponent extends DataLoadingComponent implements OnDestroy,
748748
this.userService.currentUserId
749749
);
750750

751-
this.initLynxFeatureStates(this.projectUserConfigDoc);
752-
753751
this.sourceProjectDoc = await this.getSourceProjectDoc();
754752
if (this.projectUserConfigChangesSub != null) {
755753
this.projectUserConfigChangesSub.unsubscribe();
756754
}
757-
this.projectUserConfigChangesSub = this.projectUserConfigDoc.remoteChanges$.subscribe(() => {
755+
this.projectUserConfigChangesSub = this.projectUserConfigDoc.remoteChanges$.subscribe(async () => {
758756
if (this.projectUserConfigDoc?.data != null) {
759757
// Reload config if the checksum has been reset on the server
760758
if (this.projectUserConfigDoc.data.selectedSegmentChecksum == null) {
761-
this.loadProjectUserConfig();
759+
await this.loadProjectUserConfig();
762760
} else {
763761
this.loadTranslateSuggesterConfidence();
764762
}
@@ -789,7 +787,10 @@ export class EditorComponent extends DataLoadingComponent implements OnDestroy,
789787
this.updateVerseNumber();
790788

791789
// Set chapter from route if provided
792-
this.loadProjectUserConfig(chapterNum != null ? Number.parseInt(chapterNum) : undefined);
790+
await this.loadProjectUserConfig(chapterNum != null ? Number.parseInt(chapterNum) : undefined);
791+
792+
// Lynx must be initialized after the adding of notes and other text-change related events
793+
this.initLynxFeatureStates(this.projectUserConfigDoc);
793794

794795
if (this.projectDoc.id !== prevProjectId) {
795796
this.setupTranslationEngine();
@@ -2024,7 +2025,7 @@ export class EditorComponent extends DataLoadingComponent implements OnDestroy,
20242025
});
20252026
}
20262027

2027-
private loadProjectUserConfig(chapterFromUrl?: number): void {
2028+
private async loadProjectUserConfig(chapterFromUrl?: number): Promise<void> {
20282029
let chapter: number = chapterFromUrl ?? this.chapters[0] ?? 1;
20292030
this.loadTranslateSuggesterConfidence();
20302031

@@ -2046,10 +2047,10 @@ export class EditorComponent extends DataLoadingComponent implements OnDestroy,
20462047
}
20472048
this.toggleNoteThreadVerses(false);
20482049
this.chapter$.next(chapter);
2049-
this.changeText();
2050+
await this.changeText();
20502051
this.toggleNoteThreadVerses(true);
2051-
this.updateAutoDraftTabVisibility();
2052-
this.updateBiblicalTermsTabVisibility();
2052+
await this.updateAutoDraftTabVisibility();
2053+
await this.updateBiblicalTermsTabVisibility();
20532054
}
20542055

20552056
private loadTranslateSuggesterConfidence(): void {

0 commit comments

Comments
 (0)