History

Merge pull request #1640 from freeCodeCamp/text-justify-hyphenate

Simon Legner committed 5 years ago

Commit bd55b792 parents c2f420a 03d28173 files · +16 −2Browse files

Unified · Split

3 files
  1. assets/javascripts/app/settings.coffee +8 −2
  2. assets/javascripts/templates/pages/settings_tmpl.coffee +3 −0
  3. assets/stylesheets/components/_content.scss +5 −0
assets/javascripts/app/settings.coffee+8−2
@@ -24,7 +24,12 @@ class app.Settings · 23 unmodified lines
24 'news'24 'news'
25 ]25 ]
26 26
27 LAYOUTS: ['_max-width', '_sidebar-hidden', '_native-scrollbars']27 LAYOUTS: [
28 '_max-width'
29 '_sidebar-hidden'
30 '_native-scrollbars'
31 '_text-justify-hyphenate'
32 ]
28 33
29 @defaults:34 @defaults:
30 count: 035 count: 0
@@ -153,7 +158,8 @@ class app.Settings · 122 unmodified lines
153 158
154 toggleLayout: (layout, enable) ->159 toggleLayout: (layout, enable) ->
155 classList = document.body.classList160 classList = document.body.classList
156 classList.toggle(layout, enable) unless app.router?.isSettings161 # sidebar is always shown for settings; its state is updated in app.views.Settings
162 classList.toggle(layout, enable) unless layout is '_sidebar-hidden' and app.router?.isSettings
157 classList.toggle('_overlay-scrollbars', $.overlayScrollbarsEnabled())163 classList.toggle('_overlay-scrollbars', $.overlayScrollbarsEnabled())
158 return164 return
159 165
assets/javascripts/templates/pages/settings_tmpl.coffee+3−0
@@ -27,6 +27,9 @@ app.templates.settingsPage = (settings) -> """ · 26 unmodified lines
27 <label class="_settings-label _setting-max-width">27 <label class="_settings-label _setting-max-width">
28 <input type="checkbox" form="settings" name="layout" value="_max-width"#{if settings['_max-width'] then ' checked' else ''}>Enable fixed-width layout28 <input type="checkbox" form="settings" name="layout" value="_max-width"#{if settings['_max-width'] then ' checked' else ''}>Enable fixed-width layout
29 </label>29 </label>
30 <label class="_settings-label _setting-text-justify-hyphenate">
31 <input type="checkbox" form="settings" name="layout" value="_text-justify-hyphenate"#{if settings['_text-justify-hyphenate'] then ' checked' else ''}>Enable justified layout and automatic hyphenation
32 </label>
30 <label class="_settings-label _hide-on-mobile">33 <label class="_settings-label _hide-on-mobile">
31 <input type="checkbox" form="settings" name="layout" value="_sidebar-hidden"#{if settings['_sidebar-hidden'] then ' checked' else ''}>Automatically hide and show the sidebar34 <input type="checkbox" form="settings" name="layout" value="_sidebar-hidden"#{if settings['_sidebar-hidden'] then ' checked' else ''}>Automatically hide and show the sidebar
32 <small>Tip: drag the edge of the sidebar to resize it.</small>35 <small>Tip: drag the edge of the sidebar to resize it.</small>
assets/stylesheets/components/_content.scss+5−0
@@ -33,6 +33,11 @@ · 32 unmodified lines
33 margin-top: var(--headerHeight);33 margin-top: var(--headerHeight);
34 }34 }
35 35
36 ._text-justify-hyphenate & {
37 text-align: justify;
38 hyphens: auto;
39 }
40
36 ._overlay-scrollbars & { padding-left: .625rem; }41 ._overlay-scrollbars & { padding-left: .625rem; }
37 @media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) { margin-left: 0; }42 @media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) { margin-left: 0; }
38 @supports (-ms-overflow-style: none) { margin-left: 0; }43 @supports (-ms-overflow-style: none) { margin-left: 0; }