X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/0335f584783ee5a892aba751e27ce95e7b9921c3..refs/pull/1117/head:/resources/assets/js/components/notification.js diff --git a/resources/assets/js/components/notification.js b/resources/assets/js/components/notification.js index c352a9c85..f7edb08aa 100644 --- a/resources/assets/js/components/notification.js +++ b/resources/assets/js/components/notification.js @@ -6,11 +6,16 @@ class Notification { this.type = elem.getAttribute('notification'); this.textElem = elem.querySelector('span'); this.autohide = this.elem.hasAttribute('data-autohide'); + this.elem.style.display = 'grid'; + window.$events.listen(this.type, text => { this.show(text); }); elem.addEventListener('click', this.hide.bind(this)); - if (elem.hasAttribute('data-show')) this.show(this.textElem.textContent); + + if (elem.hasAttribute('data-show')) { + setTimeout(() => this.show(this.textElem.textContent), 100); + } this.hideCleanup = this.hideCleanup.bind(this); } @@ -38,4 +43,4 @@ class Notification { } -module.exports = Notification; \ No newline at end of file +export default Notification; \ No newline at end of file