mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-06-07 04:22:06 +03:00
Comments: Fixed display, added archive list support for editor toolbox
This commit is contained in:
parent
c82fa33210
commit
a27df485bb
@ -396,6 +396,7 @@ return [
|
|||||||
'comment_placeholder' => 'Leave a comment here',
|
'comment_placeholder' => 'Leave a comment here',
|
||||||
'comment_thread_count' => ':count Comment Thread|:count Comment Threads',
|
'comment_thread_count' => ':count Comment Thread|:count Comment Threads',
|
||||||
'comment_archived_count' => ':count Archived',
|
'comment_archived_count' => ':count Archived',
|
||||||
|
'comment_archived_threads' => 'Archived Threads',
|
||||||
'comment_save' => 'Save Comment',
|
'comment_save' => 'Save Comment',
|
||||||
'comment_new' => 'New Comment',
|
'comment_new' => 'New Comment',
|
||||||
'comment_created' => 'commented :createDiff',
|
'comment_created' => 'commented :createDiff',
|
||||||
|
@ -34,13 +34,26 @@ export class PageCommentReference extends Component {
|
|||||||
window.addEventListener('editor-toolbox-change', (event) => {
|
window.addEventListener('editor-toolbox-change', (event) => {
|
||||||
const tabName: string = (event as {detail: {tab: string, open: boolean}}).detail.tab;
|
const tabName: string = (event as {detail: {tab: string, open: boolean}}).detail.tab;
|
||||||
const isOpen = (event as {detail: {tab: string, open: boolean}}).detail.open;
|
const isOpen = (event as {detail: {tab: string, open: boolean}}).detail.open;
|
||||||
if (tabName === 'comments' && isOpen) {
|
if (tabName === 'comments' && isOpen && this.link.checkVisibility()) {
|
||||||
this.showForEditor();
|
this.showForEditor();
|
||||||
} else {
|
} else {
|
||||||
this.hideMarker();
|
this.hideMarker();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Handle visibility changes within editor toolbox archived details dropdown
|
||||||
|
window.addEventListener('toggle', event => {
|
||||||
|
if (event.target instanceof HTMLElement && event.target.contains(this.link)) {
|
||||||
|
window.requestAnimationFrame(() => {
|
||||||
|
if (this.link.checkVisibility()) {
|
||||||
|
this.showForEditor();
|
||||||
|
} else {
|
||||||
|
this.hideMarker();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}, {capture: true});
|
||||||
|
|
||||||
// Handle comments tab changes to hide/show markers & indicators
|
// Handle comments tab changes to hide/show markers & indicators
|
||||||
window.addEventListener('tabs-change', event => {
|
window.addEventListener('tabs-change', event => {
|
||||||
const sectionId = (event as {detail: {showing: string}}).detail.showing;
|
const sectionId = (event as {detail: {showing: string}}).detail.showing;
|
||||||
|
@ -1202,4 +1202,19 @@ input.scroll-box-search, .scroll-box-header-item {
|
|||||||
}
|
}
|
||||||
.scroll-box > li.empty-state:last-child {
|
.scroll-box > li.empty-state:last-child {
|
||||||
display: list-item;
|
display: list-item;
|
||||||
|
}
|
||||||
|
|
||||||
|
details.section-expander summary {
|
||||||
|
border-top: 1px solid #DDD;
|
||||||
|
font-weight: bold;
|
||||||
|
font-size: 12px;
|
||||||
|
color: #888;
|
||||||
|
cursor: pointer;
|
||||||
|
padding-block: vars.$xs;
|
||||||
|
}
|
||||||
|
details.section-expander:open summary {
|
||||||
|
margin-bottom: vars.$s;
|
||||||
|
}
|
||||||
|
details.section-expander {
|
||||||
|
border-bottom: 1px solid #DDD;
|
||||||
}
|
}
|
@ -1,3 +1,6 @@
|
|||||||
|
{{--
|
||||||
|
$comments - CommentTree
|
||||||
|
--}}
|
||||||
<div refs="editor-toolbox@tab-content" data-tab-content="comments" class="toolbox-tab-content">
|
<div refs="editor-toolbox@tab-content" data-tab-content="comments" class="toolbox-tab-content">
|
||||||
<h4>{{ trans('entities.comments') }}</h4>
|
<h4>{{ trans('entities.comments') }}</h4>
|
||||||
|
|
||||||
@ -5,11 +8,19 @@
|
|||||||
<p class="text-muted small mb-m">
|
<p class="text-muted small mb-m">
|
||||||
{{ trans('entities.comment_editor_explain') }}
|
{{ trans('entities.comment_editor_explain') }}
|
||||||
</p>
|
</p>
|
||||||
@foreach($comments->get() as $branch)
|
@foreach($comments->getActive() as $branch)
|
||||||
@include('comments.comment-branch', ['branch' => $branch, 'readOnly' => true])
|
@include('comments.comment-branch', ['branch' => $branch, 'readOnly' => true])
|
||||||
@endforeach
|
@endforeach
|
||||||
@if($comments->empty())
|
@if($comments->empty())
|
||||||
<p class="italic text-muted">{{ trans('common.no_items') }}</p>
|
<p class="italic text-muted">{{ trans('entities.comment_none') }}</p>
|
||||||
|
@endif
|
||||||
|
@if($comments->archivedThreadCount() > 0)
|
||||||
|
<details class="section-expander mt-s">
|
||||||
|
<summary>{{ trans('entities.comment_archived_threads') }}</summary>
|
||||||
|
@foreach($comments->getArchived() as $branch)
|
||||||
|
@include('comments.comment-branch', ['branch' => $branch, 'readOnly' => true])
|
||||||
|
@endforeach
|
||||||
|
</details>
|
||||||
@endif
|
@endif
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
Loading…
x
Reference in New Issue
Block a user