X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/5c92b72fdd419ccb6f77bfdf0a1cb1358c51a9d8..refs/pull/5429/head:/resources/js/components/page-comment.js diff --git a/resources/js/components/page-comment.js b/resources/js/components/page-comment.js index dc6ca8264..8c0a8b33e 100644 --- a/resources/js/components/page-comment.js +++ b/resources/js/components/page-comment.js @@ -1,6 +1,6 @@ import {Component} from './component'; -import {getLoading, htmlToDom} from '../services/dom'; -import {buildForInput} from "../wysiwyg/config"; +import {getLoading, htmlToDom} from '../services/dom.ts'; +import {buildForInput} from '../wysiwyg-tinymce/config'; export class PageComment extends Component { @@ -58,6 +58,7 @@ export class PageComment extends Component { this.toggleEditMode(true); if (this.wysiwygEditor) { + this.wysiwygEditor.focus(); return; } @@ -72,6 +73,7 @@ export class PageComment extends Component { window.tinymce.init(config).then(editors => { this.wysiwygEditor = editors[0]; + setTimeout(() => this.wysiwygEditor.focus(), 50); }); } @@ -81,7 +83,7 @@ export class PageComment extends Component { this.form.toggleAttribute('hidden', true); const reqData = { - text: this.input.value, + html: this.wysiwygEditor.getContent(), parent_id: this.parentId || null, }; @@ -102,9 +104,9 @@ export class PageComment extends Component { this.showLoading(); await window.$http.delete(`/comment/${this.commentId}`); + this.$emit('delete'); this.container.closest('.comment-branch').remove(); window.$events.success(this.deletedText); - this.$emit('delete'); } showLoading() {