Skip to content

Commit a27df48

Browse files
committed
Comments: Fixed display, added archive list support for editor toolbox
1 parent c82fa33 commit a27df48

File tree

4 files changed

+43
-3
lines changed

4 files changed

+43
-3
lines changed

lang/en/entities.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,7 @@
396396
'comment_placeholder' => 'Leave a comment here',
397397
'comment_thread_count' => ':count Comment Thread|:count Comment Threads',
398398
'comment_archived_count' => ':count Archived',
399+
'comment_archived_threads' => 'Archived Threads',
399400
'comment_save' => 'Save Comment',
400401
'comment_new' => 'New Comment',
401402
'comment_created' => 'commented :createDiff',

resources/js/components/page-comment-reference.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,26 @@ export class PageCommentReference extends Component {
3434
window.addEventListener('editor-toolbox-change', (event) => {
3535
const tabName: string = (event as {detail: {tab: string, open: boolean}}).detail.tab;
3636
const isOpen = (event as {detail: {tab: string, open: boolean}}).detail.open;
37-
if (tabName === 'comments' && isOpen) {
37+
if (tabName === 'comments' && isOpen && this.link.checkVisibility()) {
3838
this.showForEditor();
3939
} else {
4040
this.hideMarker();
4141
}
4242
});
4343

44+
// Handle visibility changes within editor toolbox archived details dropdown
45+
window.addEventListener('toggle', event => {
46+
if (event.target instanceof HTMLElement && event.target.contains(this.link)) {
47+
window.requestAnimationFrame(() => {
48+
if (this.link.checkVisibility()) {
49+
this.showForEditor();
50+
} else {
51+
this.hideMarker();
52+
}
53+
});
54+
}
55+
}, {capture: true});
56+
4457
// Handle comments tab changes to hide/show markers & indicators
4558
window.addEventListener('tabs-change', event => {
4659
const sectionId = (event as {detail: {showing: string}}).detail.showing;

resources/sass/_components.scss

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1202,4 +1202,19 @@ input.scroll-box-search, .scroll-box-header-item {
12021202
}
12031203
.scroll-box > li.empty-state:last-child {
12041204
display: list-item;
1205+
}
1206+
1207+
details.section-expander summary {
1208+
border-top: 1px solid #DDD;
1209+
font-weight: bold;
1210+
font-size: 12px;
1211+
color: #888;
1212+
cursor: pointer;
1213+
padding-block: vars.$xs;
1214+
}
1215+
details.section-expander:open summary {
1216+
margin-bottom: vars.$s;
1217+
}
1218+
details.section-expander {
1219+
border-bottom: 1px solid #DDD;
12051220
}
Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,26 @@
1+
{{--
2+
$comments - CommentTree
3+
--}}
14
<div refs="editor-toolbox@tab-content" data-tab-content="comments" class="toolbox-tab-content">
25
<h4>{{ trans('entities.comments') }}</h4>
36

47
<div class="comment-container-compact px-l">
58
<p class="text-muted small mb-m">
69
{{ trans('entities.comment_editor_explain') }}
710
</p>
8-
@foreach($comments->get() as $branch)
11+
@foreach($comments->getActive() as $branch)
912
@include('comments.comment-branch', ['branch' => $branch, 'readOnly' => true])
1013
@endforeach
1114
@if($comments->empty())
12-
<p class="italic text-muted">{{ trans('common.no_items') }}</p>
15+
<p class="italic text-muted">{{ trans('entities.comment_none') }}</p>
16+
@endif
17+
@if($comments->archivedThreadCount() > 0)
18+
<details class="section-expander mt-s">
19+
<summary>{{ trans('entities.comment_archived_threads') }}</summary>
20+
@foreach($comments->getArchived() as $branch)
21+
@include('comments.comment-branch', ['branch' => $branch, 'readOnly' => true])
22+
@endforeach
23+
</details>
1324
@endif
1425
</div>
1526
</div>

0 commit comments

Comments
 (0)