mirror of
https://github.com/eitchtee/WYGIWYH.git
synced 2026-04-23 00:58:40 +02:00
feat: more changes and fixes
This commit is contained in:
27
frontend/src/js/bootstrap.js
vendored
Normal file
27
frontend/src/js/bootstrap.js
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
import './_tooltip.js';
|
||||
import 'bootstrap/js/dist/dropdown';
|
||||
import Toast from 'bootstrap/js/dist/toast';
|
||||
import 'bootstrap/js/dist/dropdown';
|
||||
import 'bootstrap/js/dist/collapse';
|
||||
import Offcanvas from 'bootstrap/js/dist/offcanvas';
|
||||
|
||||
window.Offcanvas = Offcanvas;
|
||||
|
||||
|
||||
function initiateToasts() {
|
||||
const toastElList = document.querySelectorAll('.toasty');
|
||||
const toastList = [...toastElList].map(toastEl => new Toast(toastEl)); // eslint-disable-line no-undef
|
||||
|
||||
for (let i = 0; i < toastList.length; i++) {
|
||||
if (toastList[i].isShown() === false) {
|
||||
toastList[i].show();
|
||||
toastList[i]._element.addEventListener('hidden.bs.toast', (event) => {
|
||||
event.target.remove();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', initiateToasts, false);
|
||||
document.addEventListener('htmx:afterSwap', initiateToasts, false);
|
||||
initiateToasts();
|
||||
Reference in New Issue
Block a user