X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/dc6013fd7e5b6c261da4ce8a88052dd3f7b5111f..refs/pull/5280/head:/resources/js/components/page-comments.js diff --git a/resources/js/components/page-comments.js b/resources/js/components/page-comments.js index cfb0634a9..1d6abfe20 100644 --- a/resources/js/components/page-comments.js +++ b/resources/js/components/page-comments.js @@ -1,6 +1,6 @@ import {Component} from './component'; import {getLoading, htmlToDom} from '../services/dom'; -import {buildForInput} from '../wysiwyg/config'; +import {buildForInput} from '../wysiwyg-tinymce/config'; export class PageComments extends Component { @@ -40,7 +40,7 @@ export class PageComments extends Component { setupListeners() { this.elem.addEventListener('page-comment-delete', () => { - this.updateCount(); + setTimeout(() => this.updateCount(), 1); this.hideForm(); }); @@ -72,7 +72,13 @@ export class PageComments extends Component { window.$http.post(`/comment/${this.pageId}`, reqData).then(resp => { const newElem = htmlToDom(resp.data); - this.formContainer.after(newElem); + + if (reqData.parent_id) { + this.formContainer.after(newElem); + } else { + this.container.append(newElem); + } + window.$events.success(this.createdText); this.hideForm(); this.updateCount(); @@ -87,7 +93,8 @@ export class PageComments extends Component { updateCount() { const count = this.getCommentCount(); - this.commentsTitle.textContent = window.trans_plural(this.countText, count, {count}); + console.log('update count', count, this.container); + this.commentsTitle.textContent = window.$trans.choice(this.countText, count, {count}); } resetForm() {