Skip to content

Commit

Permalink
Adjust viewport for plain text (#1016)
Browse files Browse the repository at this point in the history
  • Loading branch information
joshliebe authored Aug 23, 2024
1 parent fedace5 commit 2780f88
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/features/web-compat.js
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,12 @@ export class WebCompat extends ContentFeature {
forcedValues['maximum-scale'] = 10
}

if (!viewportTag || this.desktopModeEnabled) {
if (this.getFeatureSettingEnabled('plainTextViewPort') && document.contentType === 'text/plain') {
// text should span the full screen width
forcedValues.width = 'device-width'
// keep default scale to prevent text from appearing too small
forcedValues['initial-scale'] = 1
} else if (!viewportTag || this.desktopModeEnabled) {
// force wide viewport width
forcedValues.width = screen.width >= 1280 ? 1280 : 980
forcedValues['initial-scale'] = (screen.width / forcedValues.width).toFixed(3)
Expand Down

0 comments on commit 2780f88

Please sign in to comment.