Procházet zdrojové kódy

Allow setting text-align on popovers

Svilen Markov před 10 měsíci
rodič
revize
014abdcc00
1 změnil soubory, kde provedl 8 přidání a 1 odebrání
  1. 8 1
      internal/assets/static/js/popover.js

+ 8 - 1
internal/assets/static/js/popover.js

@@ -60,7 +60,6 @@ function showPopover() {
     pendingTarget = null;
 
     const popoverType = activeTarget.dataset.popoverType;
-    const contentMaxWidth = activeTarget.dataset.popoverMaxWidth || defaultMaxWidth;
 
     if (popoverType === "text") {
         const text = activeTarget.dataset.popoverText;
@@ -87,6 +86,14 @@ function showPopover() {
         return;
     }
 
+    const contentMaxWidth = activeTarget.dataset.popoverMaxWidth || defaultMaxWidth;
+
+    if (activeTarget.dataset.popoverTextAlign !== undefined) {
+        contentElement.style.textAlign = activeTarget.dataset.popoverTextAlign;
+    } else {
+        contentElement.style.removeProperty("text-align");
+    }
+
     contentElement.style.maxWidth = contentMaxWidth;
     containerElement.style.display = "block";
     activeTarget.classList.add("popover-active");