Skip to content

Commit

Permalink
Hide verse and lb numbers if plain text is selected as text flow mode
Browse files Browse the repository at this point in the history
  • Loading branch information
davivcu committed Jul 9, 2024
1 parent 0434632 commit 642aeff
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/app/app.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,4 +236,4 @@ export interface CustomEditorialConvention {
};
}

export type TextFlow = 'prose' | 'proseWithVerseNumbers' | 'verses';
export type TextFlow = 'prose' | 'prose_strict' | 'verses';
2 changes: 1 addition & 1 deletion src/app/components/lb/lb.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[attr.id]="data.id" [attr.data-rend]="data.rend || ''" [attr.data-facs]="data.facs || ''">
<ng-container *ngIf="data">
<br *ngIf="displayBlock$ | async"/>
<span class="lineN" *ngIf="data.n && (displayBlock$ | async)">{{data.n}}</span>
<span class="lineN" *ngIf="(data.n && (displayBlock$ | async)) && !plainTextFlow">{{data.n}}</span>
</ng-container>
<ng-container *ngIf="displayInline$ | async">&nbsp;</ng-container>
</span>
4 changes: 4 additions & 0 deletions src/app/components/lb/lb.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ export class LbComponent {
);
}

get plainTextFlow() {
return this.textFlow === 'prose_strict';
}

get displayInline$() {
return this.displayBlock$.pipe(
map((displayBlock) => !displayBlock),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@
[multiple]="false"
[closeOnSelect]="true"
[searchable]="false"
[placeholder]="'selectItems' | translate"
[placeholder]="'Text Flow' | translate"
[(ngModel)]="selectedType"
[disabled]="textFlowTypes.length === 0"
[clearable]="false"
(change)="updateSelectedType($event)">
<ng-template ng-option-tmp let-item="item" let-item$="item$" let-index="index" let-search="searchTerm">
<evt-icon [iconInfo]="getProseVersesTogglerIcon(item)"></evt-icon>
<span class="ng-value-label"> {{item | translate}}</span>
<span class="ng-value-label"> {{'option_' + item | translate}}</span>
</ng-template>
<ng-template ng-label-tmp let-item="item">
<evt-icon
[iconInfo]="getProseVersesTogglerIcon(item)"
label-left>
</evt-icon>
{{item | translate}}
{{'option_' + item | translate}}
</ng-template>
</ng-select>
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ export class VerseProseSelectComponent {

@Output() textModeSelectionChange: EventEmitter<TextFlow> = new EventEmitter();

public textFlowTypes: TextFlow[] = ['prose', 'proseWithVerseNumbers', 'verses'];
public textFlowTypes: TextFlow[] = ['prose', 'prose_strict', 'verses'];

public selectedType: TextFlow = null;
public selectedType: TextFlow = 'prose';

getProseVersesTogglerIcon(textFlowMode: TextFlow): EvtIconInfo {
return { icon: textFlowMode === 'verses' ? 'align-justify' : 'align-left', iconSet: 'fas' };
Expand Down
2 changes: 1 addition & 1 deletion src/app/components/verse/verse.component.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<span class="verse l " [evtHtmlAttributes]="data.attributes"
[class.display-block]="displayBlock$ | async" [class]="data.class" >
<span class="verse-num" [class.hidden]="(displayBlock$ | async) && showNumber">{{data.n}}</span>
<span *ngIf="!plainTextFlow" class="verse-num" [class.hidden]="(displayBlock$ | async) && showNumber">{{data.n}}</span>
<evt-source-note *ngIf="data.source !== null || data.analogue !== null" [data]="data"></evt-source-note>
<evt-content-viewer *ngFor="let el of data.content" [content]="el" [editionLevel]="editionLevel"
[itemsToHighlight]="itemsToHighlight" [evtHighlight]="highlightData" [textFlow]="textFlow" [withDeletions]="withDeletions" [selectedLayer]="selectedLayer">
Expand Down
4 changes: 4 additions & 0 deletions src/app/components/verse/verse.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ export class VerseComponent {
return !isNaN(num) && num % this.verseNumberPrinter !== 0;
}

get plainTextFlow() {
return this.textFlow === 'prose_strict';
}

constructor(
private evtModelService: EVTModelService,
) {
Expand Down
4 changes: 3 additions & 1 deletion src/assets/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,10 @@
"missingP": "missing",
"omitted": "omitted",
"prose": "Prose",
"proseWithVerseNumbers": "Prose with verse numbers",
"verses": "Verses",
"option_prose": "Prose with verse numbers",
"option_verses": "Verses",
"option_prose_strict": "Plain text",
"page": "Page {{value}}",
"front": "Front",
"mainText": "Main text",
Expand Down
4 changes: 3 additions & 1 deletion src/assets/i18n/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,10 @@
"missingP": "mancanti",
"omitted": "omissione",
"prose": "Prosa",
"proseWithVerseNumbers": "Prosa con numeri dei versi",
"verses": "Versi",
"option_prose": "Prose with verse numbers",
"option_verses": "Verses",
"option_prose_strict": "Plain text",
"page": "Pagina {{value}}",
"front": "Front",
"mainText": "Testo principale",
Expand Down

0 comments on commit 642aeff

Please sign in to comment.