From 868d059abf0a07c7ab378213ddd9495b38839c94 Mon Sep 17 00:00:00 2001 From: silverwind Date: Wed, 14 Jun 2023 22:38:11 +0200 Subject: [PATCH] destructure all the things --- web_src/js/modules/tippy.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/web_src/js/modules/tippy.js b/web_src/js/modules/tippy.js index 270a15f22692b..8d8619e0bbcd1 100644 --- a/web_src/js/modules/tippy.js +++ b/web_src/js/modules/tippy.js @@ -2,8 +2,7 @@ import tippy from 'tippy.js'; const visibleInstances = new Set(); -export function createTippy(target, opts = {}) { - const {onHide, onShow, onDestroy, ...other} = opts; +export function createTippy(target, {onHide, onShow, onDestroy, role, content, ...other} = {}) { const instance = tippy(target, { appendTo: document.body, animation: false, @@ -32,15 +31,16 @@ export function createTippy(target, opts = {}) { }, arrow: ``, role: 'menu', // HTML role attribute, only tooltips should use "tooltip" - theme: other.role || 'menu', // CSS theme, we support either "tooltip" or "menu" + theme: role || 'menu', // CSS theme, we support either "tooltip" or "menu" + content, ...other, }); // for popups where content refers to a DOM element, we use the 'tippy-target' class // to initially hide the content, now we can remove it as the content has been removed // from the DOM by tippy - if (other.content instanceof Element) { - other.content.classList.remove('tippy-target'); + if (content instanceof Element) { + content.classList.remove('tippy-target'); } return instance;