Skip to content

Commit

Permalink
fix(datepicker): Fix navigation alignment with preserveWhitespaces: f…
Browse files Browse the repository at this point in the history
…alse (#4509)

* fix(datepicker): Fix navigation alignment with preserveWhitespaces: false

When used with `preserveWhitespaces: false` compilation option in
Angular, the datepicker title elements are misaligned, because spaces
are missing in the justified text.

Since Angular 6, `preserveWhitespaces: false` is the default, so many
users will encounter this bug.

Let's add zero-width spaces in order to have a correct alignment in all
cases.

Closes #4443

* fix(main): Reset `preserveWhitespaces` option to default

This commit reverts fee535a and 0478637, which should not be needed
anymore.

`preserveWhitespaces: false` is the default since Angular 6: let's use
the default!
  • Loading branch information
adrienverge authored and valorkin committed Oct 11, 2018
1 parent e225d8d commit 9980218
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion demo/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ if (environment.production) {
enableProdMode();
}

platformBrowserDynamic().bootstrapModule(AppModule, {preserveWhitespaces: true});
platformBrowserDynamic().bootstrapModule(AppModule);
5 changes: 1 addition & 4 deletions demo/src/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,5 @@
"exclude": [
"src/test.ts",
"**/*.spec.ts"
],
"angularCompilerOptions": {
"preserveWhitespaces": true
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,24 @@ import {
(click)="navTo(true)"><span>&lsaquo;</span>
</button>
&#8203; <!-- zero-width space needed for correct alignement
with preserveWhitespaces: false in Angular -->
<button class="current"
*ngIf="calendar.monthTitle"
(click)="view('month')"
><span>{{ calendar.monthTitle }}</span>
</button>
&#8203; <!-- zero-width space needed for correct alignement
with preserveWhitespaces: false in Angular -->
<button class="current" (click)="view('year')"
><span>{{ calendar.yearTitle }}</span></button>
&#8203; <!-- zero-width space needed for correct alignement
with preserveWhitespaces: false in Angular -->
<button class="next"
[disabled]="calendar.disableRightArrow"
[style.visibility]="calendar.hideRightArrow ? 'hidden' : 'visible'"
Expand Down

0 comments on commit 9980218

Please sign in to comment.