Skip to content

Commit f086687

Browse files
committed
Updated page-nav to show more title content
Will now be truncated using CSS instead of being truncated on PHP side. Closes BookStackApp#1206.
1 parent 7b50644 commit f086687

3 files changed

Lines changed: 8 additions & 4 deletions

File tree

app/Entities/Repos/PageRepo.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -424,9 +424,7 @@ public function getPageNav(string $pageContent)
424424

425425
$tree = collect($headers)->map(function($header) {
426426
$text = trim(str_replace("\xc2\xa0", '', $header->nodeValue));
427-
if (mb_strlen($text) > 30) {
428-
$text = mb_substr($text, 0, 27) . '...';
429-
}
427+
$text = mb_substr($text, 0, 100);
430428

431429
return [
432430
'nodeName' => strtolower($header->nodeName),

resources/assets/sass/_text.scss

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,12 @@ li.checkbox-item, li.task-list-item {
329329
overflow-wrap: break-word;
330330
}
331331

332+
.limit-text {
333+
white-space: nowrap;
334+
overflow: hidden;
335+
text-overflow: ellipsis;
336+
}
337+
332338
/**
333339
* Grouping
334340
*/

resources/views/pages/show.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
<div class="sidebar-page-nav menu">
5757
@foreach($pageNav as $navItem)
5858
<li class="page-nav-item h{{ $navItem['level'] }}">
59-
<a href="{{ $navItem['link'] }}">{{ $navItem['text'] }}</a>
59+
<a href="{{ $navItem['link'] }}" class="limit-text block">{{ $navItem['text'] }}</a>
6060
<div class="primary-background sidebar-page-nav-bullet"></div>
6161
</li>
6262
@endforeach

0 commit comments

Comments
 (0)