You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
wxiaoguang 9be90a5875
Use a general approach to show tooltip, fix temporary tooltip bug (#23574)
## TLDR

* Improve performance: lazy creating the tippy instances.
* Transparently support all "tooltip" elements, no need to call
`initTooltip` again and again.
* Fix a temporary tooltip re-entrance bug, which causes showing temp
content forever.
* Upgrade vue3-calendar-heatmap to 2.0.2 with lazy tippy init
(initHeatmap time decreases from 100ms to 50ms)

## Details

### The performance

Creating a lot of tippy tooltip instances is expensive. This PR doesn't
create all tippy tooltip instances, instead, it only adds "mouseover"
event listener to necessary elements, and then switches to the tippy
tooltip

### The general approach for all tooltips

Before, dynamically generated tooltips need to be called with
`initTooltip`.

After, use MutationObserver to:

* Attach the event listeners to newly created tooltip elements, work for
Vue (easier than before)
* Catch changed attributes and update the tooltip content (better than
before)

It does help a lot, eg:

1a4efa0ee9/web_src/js/components/PullRequestMergeForm.vue (L33-L36)

### Temporary tooltip re-entrance bug

To reproduce, on try.gitea.io, click the "copy clone url" quickly, then
the tooltip will be "Copied!" forever.

After this PR, with the help of `attachTippyTooltip`, the tooltip
content could be reset to the default correctly.

### Other changes

* `data-tooltip-content` is preferred from now on, the old
`data-content` may cause conflicts with other modules.
* `data-placement` was only used for tooltip, so it's renamed to
`data-tooltip-placement`, and removed from `createTippy`.
1 year ago
..
components Use a general approach to show tooltip, fix temporary tooltip bug (#23574) 1 year ago
features Use a general approach to show tooltip, fix temporary tooltip bug (#23574) 1 year ago
markup update to mermaid v10 (#23178) 1 year ago
modules Use a general approach to show tooltip, fix temporary tooltip bug (#23574) 1 year ago
standalone Add new JS linter rules (#17699) 3 years ago
test Use link in UI which returned a relative url but not html_url which contains an absolute url (#21986) 1 year ago
utils Refactor branch/tag selector to Vue SFC (#23421) 1 year ago
webcomponents Polyfill the window.customElements (#23592) 1 year ago
bootstrap.js Quick fixes monaco-editor error: "vs.editor.nullLanguage" (#21734) 2 years ago
index.js Use a general approach to show tooltip, fix temporary tooltip bug (#23574) 1 year ago
jquery.js Upgrade jQuery to 3.5.0, remove jQuery-Migrate, fix deprecations (#11055) 4 years ago
serviceworker.js Fix serviceworker output file and misc improvements (#11562) 4 years ago
svg.js Improve `<SvgIcon>` to make it output `svg` node and optimize performance (#23570) 1 year ago
svg.test.js Improve `<SvgIcon>` to make it output `svg` node and optimize performance (#23570) 1 year ago
utils.js Scoped labels (#22585) 1 year ago
utils.test.js Fix links for the menus in the view file page (#22795) 1 year ago