diff --git a/src/SIL.XForge.Scripture/ClientApp/src/app/translate/draft-generation/draft-usfm-format/draft-usfm-format.component.html b/src/SIL.XForge.Scripture/ClientApp/src/app/translate/draft-generation/draft-usfm-format/draft-usfm-format.component.html index 02c386b1e35..d2555c01267 100644 --- a/src/SIL.XForge.Scripture/ClientApp/src/app/translate/draft-generation/draft-usfm-format/draft-usfm-format.component.html +++ b/src/SIL.XForge.Scripture/ClientApp/src/app/translate/draft-generation/draft-usfm-format/draft-usfm-format.component.html @@ -96,6 +96,7 @@

{{ t("formatting_options") }}

[isReadOnly]="true" [subscribeToUpdates]="false" [isRightToLeft]="isRightToLeft" + [fontSize]="fontSize" [placeholder]="isOnline ? t('chapter_draft_does_not_exist') : t('text_unavailable_offline')" [class.initializing]="isInitializing" [class.loading]="isLoadingData" diff --git a/src/SIL.XForge.Scripture/ClientApp/src/app/translate/draft-generation/draft-usfm-format/draft-usfm-format.component.spec.ts b/src/SIL.XForge.Scripture/ClientApp/src/app/translate/draft-generation/draft-usfm-format/draft-usfm-format.component.spec.ts index 23b916d6329..51ee0c5a5b5 100644 --- a/src/SIL.XForge.Scripture/ClientApp/src/app/translate/draft-generation/draft-usfm-format/draft-usfm-format.component.spec.ts +++ b/src/SIL.XForge.Scripture/ClientApp/src/app/translate/draft-generation/draft-usfm-format/draft-usfm-format.component.spec.ts @@ -342,6 +342,14 @@ describe('DraftUsfmFormatComponent', () => { expect(env.quoteFormatWarning).not.toBeNull(); })); + it('shows the draft using the font size configured for the project', fakeAsync(() => { + const env = new TestEnvironment({ project: { defaultFontSize: 24 } }); + tick(EDITOR_READY_TIMEOUT); + env.fixture.detectChanges(); + expect(env.component.fontSize).toEqual('2rem'); + expect(env.draftTextContainer?.style.fontSize).toEqual('2rem'); + })); + it('shows a notice if unable to access the draft source', fakeAsync(() => { const env = new TestEnvironment({ userCanAccessDraftingSource: false }); expect(env.draftSourceWarning).not.toBeNull(); @@ -433,6 +441,10 @@ class TestEnvironment { return this.fixture.nativeElement.querySelector('.quote-format-warning'); } + get draftTextContainer(): HTMLElement | null { + return this.fixture.nativeElement.querySelector('.viewer .ql-container'); + } + private setupProject(project?: Partial): void { const texts: TextInfo[] = [ { @@ -468,7 +480,8 @@ class TestEnvironment { id: this.projectId, data: createTestProjectProfile({ translateConfig: project?.translateConfig ?? this.translateConfig, - texts: project?.texts ?? texts + texts: project?.texts ?? texts, + defaultFontSize: project?.defaultFontSize }) } as SFProjectProfileDoc; when(mockedActivatedProjectService.projectId).thenReturn(this.projectId); diff --git a/src/SIL.XForge.Scripture/ClientApp/src/app/translate/draft-generation/draft-usfm-format/draft-usfm-format.component.ts b/src/SIL.XForge.Scripture/ClientApp/src/app/translate/draft-generation/draft-usfm-format/draft-usfm-format.component.ts index 3bdc015fe38..900b94d37c4 100644 --- a/src/SIL.XForge.Scripture/ClientApp/src/app/translate/draft-generation/draft-usfm-format/draft-usfm-format.component.ts +++ b/src/SIL.XForge.Scripture/ClientApp/src/app/translate/draft-generation/draft-usfm-format/draft-usfm-format.component.ts @@ -35,7 +35,7 @@ import { BookChapterChooserComponent } from '../../../shared/book-chapter-choose import { NoticeComponent } from '../../../shared/notice/notice.component'; import { ConfirmOnLeave } from '../../../shared/project-router.guard'; import { TextComponent } from '../../../shared/text/text.component'; -import { booksFromScriptureRange, projectLabel } from '../../../shared/utils'; +import { booksFromScriptureRange, formatFontSizeToRems, projectLabel } from '../../../shared/utils'; import { DraftGenerationService } from '../draft-generation.service'; import { DraftHandlingService } from '../draft-handling.service'; import { DraftSourcesAsArrays } from '../draft-source'; @@ -125,6 +125,10 @@ export class DraftUsfmFormatComponent extends DataLoadingComponent implements Af return !!this.activatedProjectService.projectDoc?.data?.isRightToLeft; } + get fontSize(): string | undefined { + return formatFontSizeToRems(this.activatedProjectService.projectDoc?.data?.defaultFontSize); + } + get textDocId(): TextDocId | undefined { if (this.projectId == null || this.bookNum == null || this.chapterNum == null) return undefined; return new TextDocId(this.projectId, this.bookNum, this.chapterNum);