summaryrefslogtreecommitdiffstats
path: root/web_src/js
diff options
context:
space:
mode:
authorGiteabot <teabot@gitea.io>2023-10-22 21:35:58 +0800
committerGitHub <noreply@github.com>2023-10-22 15:35:58 +0200
commit48e3aec86228ec4617419c354b565708d5db341c (patch)
tree1e8135cec9062ca4bf55637492cc093d848adb28 /web_src/js
parentaabcf2d7ad247fb0bf8131ebdf8400fcf5292828 (diff)
downloadgitea-48e3aec86228ec4617419c354b565708d5db341c.tar.gz
gitea-48e3aec86228ec4617419c354b565708d5db341c.zip
Enable followCursor for language stats bar (#27713) (#27739)
Backport #27713 by @silverwind Fixes: https://github.com/go-gitea/gitea/issues/27600 ![](https://github.com/go-gitea/gitea/assets/115237/96743d90-0712-4f13-84ec-66f84e6ed2d7) Also tested together with https://github.com/go-gitea/gitea/pull/27704, works well. Co-authored-by: silverwind <me@silverwind.io>
Diffstat (limited to 'web_src/js')
-rw-r--r--web_src/js/modules/tippy.js4
1 files changed, 3 insertions, 1 deletions
diff --git a/web_src/js/modules/tippy.js b/web_src/js/modules/tippy.js
index 4eed0aa4bb..ec7ee2141f 100644
--- a/web_src/js/modules/tippy.js
+++ b/web_src/js/modules/tippy.js
@@ -1,4 +1,4 @@
-import tippy from 'tippy.js';
+import tippy, {followCursor} from 'tippy.js';
const visibleInstances = new Set();
@@ -35,6 +35,7 @@ export function createTippy(target, opts = {}) {
arrow: `<svg width="16" height="7"><path d="m0 7 8-7 8 7Z" class="tippy-svg-arrow-outer"/><path d="m0 8 8-7 8 7Z" class="tippy-svg-arrow-inner"/></svg>`,
role: 'menu', // HTML role attribute, only tooltips should use "tooltip"
theme: other.role || 'menu', // CSS theme, we support either "tooltip" or "menu"
+ plugins: [followCursor],
...other,
});
@@ -78,6 +79,7 @@ function attachTooltip(target, content = null) {
theme: 'tooltip',
hideOnClick,
placement: target.getAttribute('data-tooltip-placement') || 'top-start',
+ followCursor: target.getAttribute('data-tooltip-follow-cursor') || false,
...(target.getAttribute('data-tooltip-interactive') === 'true' ? {interactive: true, aria: {content: 'describedby', expanded: false}} : {}),
};