fix: register pre-existing bs tooltips

This commit is contained in:
Oliver Booth 2023-08-10 23:31:34 +01:00
parent 4cc9efce42
commit e3702878cd
Signed by: oliverbooth
GPG Key ID: 725DB725A0D9EE61

View File

@ -81,6 +81,10 @@ class UI {
*/ */
public static addBootstrapTooltips(element?: Element) { public static addBootstrapTooltips(element?: Element) {
element = element || document.body; element = element || document.body;
const list = element.querySelectorAll('[data-bs-toggle="tooltip"]');
list.forEach((el: Element) => new bootstrap.Tooltip(el));
element.querySelectorAll("[title]").forEach((el) => { element.querySelectorAll("[title]").forEach((el) => {
el.setAttribute("data-bs-toggle", "tooltip"); el.setAttribute("data-bs-toggle", "tooltip");
el.setAttribute("data-bs-placement", "bottom"); el.setAttribute("data-bs-placement", "bottom");