forgejo/web_src/js
DC 2e49c82f80
Fix user-defined markup links targets (#29305)
This seeks to fix the bug reported on issue #29196.

Cause:
ID's with custom characters (- , _ , etc.), were not linking correctly
in the Markdown file when rendered in the browser because the ID in the
respective destinies would be different than the one in anchor, while
for IDs with only letters, the ID would be the same.

Fix:
It was suggested that to fix this bug, it should more or less like
GitHub does it. While in gitea the anchors would be put in HTML like
this:
```
<p dir="auto"><a href="#user-content-_toc152597800" rel="nofollow">Review</a></p>
<p dir="auto"><a href="#user-content-_toc152597802" rel="nofollow">Staging</a></p>
<p dir="auto"><a href="#user-content-_toc152597803" rel="nofollow">Development</a></p>
<p dir="auto"><a href="#user-content-_toc152597828" rel="nofollow">Testing</a></p>
<p dir="auto"><a href="#user-content-_toc152597829" rel="nofollow">Unit-tests</a></p>

```
In GitHub, the same anchor's href properties would be the same without
"user-content-" trailing behind.

So my code made sure to change those anchors, so it would not include
"user-content-" and then add respective Event Listeners so it would
scroll into the supposed places.

Fixes: #29196

---------

Co-authored-by: silverwind <me@silverwind.io>
(cherry picked from commit f219ea8d0e0eccd74c786202a4ddb2784a0175ad)
2024-03-11 23:36:59 +07:00
..
components Set user's 24h preference from their current OS locale (#29651) 2024-03-11 23:36:59 +07:00
features Don't show AbortErrors on logout (#29639) 2024-03-11 23:36:59 +07:00
markup Fix user-defined markup links targets (#29305) 2024-03-11 23:36:59 +07:00
modules Set user's 24h preference from their current OS locale (#29651) 2024-03-11 23:36:59 +07:00
render Use vitest globals (#27102) 2023-09-27 04:37:13 +00:00
standalone [FRONTEND] fix javascript linting errors 2024-02-25 23:43:58 +01:00
utils Set user's 24h preference from their current OS locale (#29651) 2024-03-11 23:36:59 +07:00
vendor Vendor jquery.are-you-sure with strict mode fixes (#26901) 2023-09-06 00:02:44 +00:00
webcomponents Fix URL calculation in clone input box (#29470) 2024-03-06 12:10:44 +08:00
bootstrap.js Fix/Improve processWindowErrorEvent (#29407) 2024-03-06 12:10:44 +08:00
bootstrap.test.js Avoid duplicate JS error messages on UI (#28873) 2024-01-21 14:23:08 +00:00
htmx.js Auto-update the system status in admin dashboard (#29163) 2024-02-17 23:24:31 +01:00
index.js Filter Repositories by type (#29231) 2024-03-06 12:10:46 +08:00
jquery.js Upgrade jQuery to 3.5.0, remove jQuery-Migrate, fix deprecations (#11055) 2020-04-18 18:46:29 -04:00
svg.js Artifact deletion in actions ui (#27172) 2024-02-23 09:06:14 +01:00
svg.test.js Use vitest globals (#27102) 2023-09-27 04:37:13 +00:00
utils.js enforce maxlength in frontend (#29389) 2024-02-26 22:30:27 +01:00
utils.test.js Use vitest globals (#27102) 2023-09-27 04:37:13 +00:00
vitest.setup.js [gitea] Move vitest setup file to root (#29097) 2024-02-10 10:53:43 +01:00