gitea/templates
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`.
2023-03-23 17:56:15 +08:00
..
admin Fix .locale.Tr function not found in delete modal (#23468) 2023-03-20 20:41:57 -04:00
api/packages/pypi Add Package Registry (#16510) 2022-03-30 16:42:47 +08:00
base Use a general approch to improve a11y for all checkboxes and dropdowns. (#23542) 2023-03-22 10:52:01 +08:00
code Fix 'View File' button in code search (#23478) 2023-03-14 22:19:27 -04:00
custom Add footer extra links template (#9576) 2020-01-03 20:41:56 +02:00
explore Fix long name ui issues and label ui issue (#23541) 2023-03-18 17:07:59 +01:00
mail Revert relative links to absolute links in mail templates (#23267) 2023-03-03 22:43:30 +08:00
org Replace a few fontawesome icons with svg (#23602) 2023-03-20 21:42:02 -04:00
package Convert <div class="button"> to <button class="button"> (#23337) 2023-03-14 11:34:09 +08:00
projects Improve <SvgIcon> to make it output svg node and optimize performance (#23570) 2023-03-23 11:24:16 +08:00
repo Use a general approach to show tooltip, fix temporary tooltip bug (#23574) 2023-03-23 17:56:15 +08:00
shared Display the version of runner in the runner list (#23490) 2023-03-19 22:19:40 -04:00
status Move helpers to be prefixed with gt- (#22879) 2023-02-13 17:59:59 +00:00
swagger Add absent repounits to create/edit repo API (#23500) 2023-03-16 12:30:42 -05:00
user Improve <SvgIcon> to make it output svg node and optimize performance (#23570) 2023-03-23 11:24:16 +08:00
home.tmpl Add main landmark to templates and adjust titles (#22670) 2023-02-01 22:56:10 +00:00
install.tmpl Refactor hiding-methods, remove jQuery show/hide, remove .hide class, remove inline style=display:none (#22950) 2023-02-19 12:06:14 +08:00
post-install.tmpl Fix various bugs for "install" page (#23194) 2023-03-04 10:12:02 +08:00