1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-07-28 17:02:04 +03:00

Updated a batch of JS components

This commit is contained in:
Dan Brown
2022-11-15 11:24:31 +00:00
parent 09c6a3c240
commit 4310d34135
19 changed files with 124 additions and 128 deletions

View File

@ -1,9 +1,8 @@
import {scrollAndHighlightElement} from "../services/util";
import {Component} from "./component";
import {htmlToDom} from "../services/dom";
/**
* @extends {Component}
*/
class PageComments {
export class PageComments extends Component {
setup() {
this.elem = this.$el;
@ -119,9 +118,7 @@ class PageComments {
};
this.showLoading(this.form);
window.$http.post(`/comment/${this.pageId}`, reqData).then(resp => {
let newComment = document.createElement('div');
newComment.innerHTML = resp.data;
let newElem = newComment.children[0];
const newElem = htmlToDom(resp.data);
this.container.appendChild(newElem);
window.$components.init(newElem);
window.$events.success(this.createdText);
@ -199,6 +196,4 @@ class PageComments {
formElem.querySelector('.form-group.loading').style.display = 'none';
}
}
export default PageComments;
}