Skip to content

Commit

Permalink
- fix tooltips
Browse files Browse the repository at this point in the history
  • Loading branch information
Osiris-Team committed Aug 12, 2024
1 parent f6bd25c commit a9f4b53
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
7 changes: 7 additions & 0 deletions src/main/java/com/osiris/desku/ui/UI.java
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,13 @@ public static void remove(Thread... threads) {
*/
public abstract void plusY(int y) throws InterruptedException, InvocationTargetException;

/**
* @see #executeJavaScriptSafely(String, String, int)
*/
public void executeJavaScriptSafely(String jsCode) {
executeJavaScriptSafely(jsCode, "internal", 0);
}

/**
* Executes {@link #executeJavaScript(String, String, int)} only once the UI is loaded and after
* some internals JS dependencies are loaded.
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/com/osiris/desku/ui/layout/Tooltip.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.osiris.desku.ui.layout;

import com.osiris.desku.ui.Component;
import com.osiris.desku.ui.UI;

public class Tooltip{
public Component<?, ?> parent;
Expand All @@ -15,7 +16,8 @@ public Tooltip attachToParent(){
parent.atr("data-bs-toggle", "tooltip");
parent.atr("data-bs-title", content);

parent.executeJS("new bootstrap.Tooltip(comp)");
UI ui = UI.get();
ui.executeJavaScriptSafely(ui.jsGetComp("comp", parent.id) + "new bootstrap.Tooltip(comp)");
return this;
}
}

0 comments on commit a9f4b53

Please sign in to comment.