]> BookStack Code Mirror - bookstack/blobdiff - resources/js/components/notification.js
Filtered scripts in custom HTML head for exports
[bookstack] / resources / js / components / notification.js
index f7edb08aa1327fda20c76728f2fb8add65119b60..35bab4ea656b1c052e875fac2bcdf0e4ef27d268 100644 (file)
@@ -28,7 +28,11 @@ class Notification {
             this.elem.classList.add('showing');
         }, 1);
 
-        if (this.autohide) setTimeout(this.hide.bind(this), 2000);
+        if (this.autohide) {
+            const words = textToShow.split(' ').length;
+            const timeToShow = Math.max(2000, 1000 + (250 * words));
+            setTimeout(this.hide.bind(this), timeToShow);
+        }
     }
 
     hide() {