Ref #25.
Unified · Split
| @@ -9,22 +9,23 @@ templates.sidebarDoc = (doc, options = {}) -> · 8 unmodified lines | |||
| 9 | else | 9 | else |
| 10 | link += """<span class="_list-arrow"></span>""" | 10 | link += """<span class="_list-arrow"></span>""" |
| 11 | link += """<span class="_list-count">#{doc.release}</span>""" if doc.release | 11 | link += """<span class="_list-count">#{doc.release}</span>""" if doc.release |
| 12 | link += "#{doc.name}" | 12 | link += """<span class="_list-text">#{doc.name}""" |
| 13 | link += " #{doc.version}" if options.disabled and doc.version | 13 | link += " #{doc.version}" if options.disabled and doc.version |
| 14 | link + "</a>" | 14 | link + "</span></a>" |
| 15 | 15 | ||
| 16 | templates.sidebarType = (type) -> | 16 | templates.sidebarType = (type) -> |
| 17 | """<a href="#{type.fullPath()}" class="_list-item _list-dir" data-slug="#{type.slug}"><span class="_list-arrow"></span><span class="_list-count">#{type.count}</span>#{type.name}</a>""" | 17 | """<a href="#{type.fullPath()}" class="_list-item _list-dir" data-slug="#{type.slug}"><span class="_list-arrow"></span><span class="_list-count">#{type.count}</span><span class="_list-text">#{type.name}</span></a>""" |
| 18 | 18 | ||
| 19 | templates.sidebarEntry = (entry) -> | 19 | templates.sidebarEntry = (entry) -> |
| 20 | """<a href="#{entry.fullPath()}" class="_list-item _list-hover">#{$.escape entry.name}</a>""" | 20 | """<a href="#{entry.fullPath()}" class="_list-item _list-hover">#{$.escape entry.name}</a>""" |
| 21 | 21 | ||
| 22 | templates.sidebarResult = (entry) -> | 22 | templates.sidebarResult = (entry) -> |
| 23 | addon = if entry.isIndex() and app.disabledDocs.contains(entry.doc) | 23 | addons = if entry.isIndex() and app.disabledDocs.contains(entry.doc) |
| 24 | """<span class="_list-enable" data-enable="#{entry.doc.slug}">Enable</span>""" | 24 | """<span class="_list-enable" data-enable="#{entry.doc.slug}">Enable</span>""" |
| 25 | else | 25 | else |
| 26 | """<span class="_list-reveal" data-reset-list title="Reveal in list"></span>""" | 26 | """<span class="_list-reveal" data-reset-list title="Reveal in list"></span>""" |
| 27 | """<a href="#{entry.fullPath()}" class="_list-item _list-hover _list-result _icon-#{entry.doc.icon}">#{addon}#{$.escape entry.name}</a>""" | 27 | addons += """<span class="_list-count">#{entry.doc.version}</span>""" if entry.doc.version |
| 28 | """<a href="#{entry.fullPath()}" class="_list-item _list-hover _list-result _icon-#{entry.doc.icon}">#{addons}<span class="_list-text">#{$.escape entry.name}</span></a>""" | ||
| 28 | 29 | ||
| 29 | templates.sidebarNoResults = -> | 30 | templates.sidebarNoResults = -> |
| 30 | html = """ <div class="_list-note">No results.</div> """ | 31 | html = """ <div class="_list-note">No results.</div> """ |
| @@ -41,7 +42,7 @@ templates.sidebarLabel = (doc, options = {}) -> · 10 unmodified lines | |||
| 41 | label += " _icon-#{doc.icon}" unless doc.version | 42 | label += " _icon-#{doc.icon}" unless doc.version |
| 42 | label += """"><input type="checkbox" name="#{doc.slug}" class="_list-checkbox" """ | 43 | label += """"><input type="checkbox" name="#{doc.slug}" class="_list-checkbox" """ |
| 43 | label += "checked" if options.checked | 44 | label += "checked" if options.checked |
| 44 | label + ">#{doc.fullName}</label>" | 45 | label + """><span class="_list-text">#{doc.fullName}</span></label>""" |
| 45 | 46 | ||
| 46 | templates.sidebarVersionedDoc = (doc, versions, options = {}) -> | 47 | templates.sidebarVersionedDoc = (doc, versions, options = {}) -> |
| 47 | html = """<div class="_list-item _list-dir _list-rdir _icon-#{doc.icon}""" | 48 | html = """<div class="_list-item _list-dir _list-rdir _icon-#{doc.icon}""" |
| @@ -24,7 +24,7 @@ class app.views.SidebarHover extends app.View · 23 unmodified lines | |||
| 24 | show: (el) -> | 24 | show: (el) -> |
| 25 | unless el is @cursor | 25 | unless el is @cursor |
| 26 | @hide() | 26 | @hide() |
| 27 | if @isTarget(el) and @isTruncated(el) | 27 | if @isTarget(el) and @isTruncated(el.lastElementChild or el) |
| 28 | @cursor = el | 28 | @cursor = el |
| 29 | @clone = @makeClone @cursor | 29 | @clone = @makeClone @cursor |
| 30 | $.append document.body, @clone | 30 | $.append document.body, @clone |
| @@ -48,8 +48,7 @@ class app.views.SidebarHover extends app.View · 17 unmodified lines | |||
| 48 | return | 48 | return |
| 49 | 49 | ||
| 50 | makeClone: (el) -> | 50 | makeClone: (el) -> |
| 51 | clone = el.cloneNode() | 51 | clone = el.cloneNode(true) |
| 52 | clone.textContent = el.textContent | ||
| 53 | clone.classList.add 'clone' | 52 | clone.classList.add 'clone' |
| 54 | clone | 53 | clone |
| 55 | 54 | ||
| @@ -80,14 +80,9 @@ · 79 unmodified lines | |||
| 80 | ._list-item { | 80 | ._list-item { |
| 81 | display: block; | 81 | display: block; |
| 82 | position: relative; | 82 | position: relative; |
| 83 | overflow: hidden; | ||
| 84 | padding: .25rem .75rem; | 83 | padding: .25rem .75rem; |
| 85 | line-height: 1.5rem; | 84 | line-height: 1.5rem; |
| 86 | font-size: .875rem; | 85 | font-size: .875rem; |
| 87 | white-space: nowrap; | ||
| 88 | word-wrap: normal; | ||
| 89 | overflow-wrap: normal; | ||
| 90 | text-overflow: ellipsis; | ||
| 91 | cursor: default; | 86 | cursor: default; |
| 92 | background: $sidebarBackground; | 87 | background: $sidebarBackground; |
| 93 | box-shadow: inset -1px 0 $sidebarBorder; | 88 | box-shadow: inset -1px 0 $sidebarBorder; |
| @@ -120,9 +115,23 @@ · 26 unmodified lines | |||
| 120 | } | 115 | } |
| 121 | } | 116 | } |
| 122 | 117 | ||
| 118 | ._list-item, ._list-text { | ||
| 119 | overflow: hidden; | ||
| 120 | white-space: nowrap; | ||
| 121 | word-wrap: normal; | ||
| 122 | overflow-wrap: normal; | ||
| 123 | text-overflow: ellipsis; | ||
| 124 | } | ||
| 125 | |||
| 126 | ._list-text { | ||
| 127 | display: block; | ||
| 128 | pointer-events: none; | ||
| 129 | } | ||
| 130 | |||
| 123 | ._list-count, ._list-enable { | 131 | ._list-count, ._list-enable { |
| 124 | float: right; | 132 | float: right; |
| 125 | font-size: .75rem; | 133 | font-size: .75rem; |
| 134 | margin-left: .375rem; | ||
| 126 | 135 | ||
| 127 | .focus > &, | 136 | .focus > &, |
| 128 | .active > & { | 137 | .active > & { |
| @@ -229,6 +238,7 @@ · 100 unmodified lines | |||
| 229 | padding-right: 1.75rem; | 238 | padding-right: 1.75rem; |
| 230 | 239 | ||
| 231 | > ._list-reveal { display: block; } | 240 | > ._list-reveal { display: block; } |
| 241 | > ._list-count { display: none; } | ||
| 232 | } | 242 | } |
| 233 | 243 | ||
| 234 | ._list-reveal { | 244 | ._list-reveal { |
| @@ -237,14 +247,14 @@ · 2 unmodified lines | |||
| 237 | top: 0; | 247 | top: 0; |
| 238 | bottom: 0; | 248 | bottom: 0; |
| 239 | right: 0; | 249 | right: 0; |
| 240 | width: 1.75rem; | 250 | width: 2rem; |
| 241 | cursor: pointer; | 251 | cursor: pointer; |
| 242 | 252 | ||
| 243 | &:before { | 253 | &:before { |
| 244 | content: ''; | 254 | content: ''; |
| 245 | position: absolute; | 255 | position: absolute; |
| 246 | bottom: 50%; | 256 | bottom: 50%; |
| 247 | left: .5rem; | 257 | left: .75rem; |
| 248 | width: .75rem; | 258 | width: .75rem; |
| 249 | height: 1px; | 259 | height: 1px; |
| 250 | background: rgba($selectionText, .9); | 260 | background: rgba($selectionText, .9); |
| @@ -274,9 +284,9 @@ · 23 unmodified lines | |||
| 274 | 284 | ||
| 275 | ._list-hover.clone { | 285 | ._list-hover.clone { |
| 276 | position: fixed; | 286 | position: fixed; |
| 287 | overflow: visible; | ||
| 277 | z-index: $hoverZ; | 288 | z-index: $hoverZ; |
| 278 | left: 0; | 289 | left: 0; |
| 279 | overflow: visible; | ||
| 280 | min-width: $sidebarWidth; | 290 | min-width: $sidebarWidth; |
| 281 | padding: .25rem .75rem; | 291 | padding: .25rem .75rem; |
| 282 | pointer-events: none; | 292 | pointer-events: none; |
| @@ -287,11 +297,15 @@ · 4 unmodified lines | |||
| 287 | 297 | ||
| 288 | @media #{$mediumScreen} { min-width: $sidebarMediumWidth; } | 298 | @media #{$mediumScreen} { min-width: $sidebarMediumWidth; } |
| 289 | 299 | ||
| 300 | > ._list-text { display: inline; } | ||
| 301 | |||
| 290 | &:not(._list-result) { | 302 | &:not(._list-result) { |
| 291 | padding-left: 2.75rem; | 303 | padding-left: 2.75rem; |
| 292 | 304 | ||
| 293 | &:before { content: none; } | 305 | &:before { content: none; } |
| 294 | } | 306 | } |
| 307 | |||
| 308 | ._list-reveal, ._list-enable { display: none; } | ||
| 295 | } | 309 | } |
| 296 | 310 | ||
| 297 | // | 311 | // |