-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(table): adjust border size depending on devicePixelRatio [which d…
…epends on page zoom level] so we do not lose table cell borders
- Loading branch information
Showing
2 changed files
with
21 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { ApplicationController } from './application_controller'; | ||
|
||
export class FixTableBorderController extends ApplicationController { | ||
connect() { | ||
const pixelSize = Math.round((1 / window.devicePixelRatio) * 100) / 100; | ||
|
||
// Safari does not support devicePixelRatio | ||
if (navigator.userAgent.indexOf('Safari') > -1) { | ||
return; | ||
} | ||
|
||
const fix = document.createElement('style'); | ||
fix.innerText = ` | ||
.fr-table.fr-table--bordered .fr-table__content th, | ||
.fr-table.fr-table--bordered .fr-table__content td { | ||
background-size: 100% ${pixelSize}px, ${pixelSize}px 100%} | ||
}`; | ||
document.body.appendChild(fix); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters