Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ <h1>{{ t("formatting_options") }}</h1>
[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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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<SFProjectProfile>): void {
const texts: TextInfo[] = [
{
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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);
Expand Down
Loading