0
0
Fork 0
mirror of https://github.com/go-gitea/gitea synced 2024-09-28 20:19:01 +02:00
gitea/web_src/js
Giteabot bfc7c8a598
Fix user-defined markup links targets (#29305) (#29666)
Backport #29305 by @DanielMatiasCarvalho

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: DC <106393991+DanielMatiasCarvalho@users.noreply.github.com>
Co-authored-by: silverwind <me@silverwind.io>
2024-03-08 16:53:36 +00:00
..
components Modernize merge button (#28140) (#28786) 2024-01-15 09:40:52 +08:00
features Fix incorrect subpath in links (#29535) (#29541) 2024-03-02 12:26:54 +00:00
markup Fix user-defined markup links targets (#29305) (#29666) 2024-03-08 16:53:36 +00:00
modules Avoid showing unnecessary JS errors when there are elements with different origin on the page (#29081) (#29089) 2024-02-08 02:48:06 +00:00
render Use vitest globals (#27102) (#27311) 2023-09-27 16:10:08 +02:00
standalone Add toasts to UI (#25449) 2023-06-27 02:45:24 +00:00
test Avoid duplicate JS error messages on UI (#28873) (#28881) 2024-01-21 15:40:26 +00:00
utils Make submit event code work with both jQuery event and native event (#29223) (#29234) 2024-02-18 06:36:41 +00: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) (#29473) 2024-02-28 15:25:53 +00:00
bootstrap.js Fix/Improve processWindowErrorEvent (#29407) (#29480) 2024-02-29 01:22:53 +01:00
bootstrap.test.js Avoid duplicate JS error messages on UI (#28873) (#28881) 2024-01-21 15:40:26 +00:00
index.js Hide archived labels by default from the suggestions when assigning labels for an issue (#27451) (#27661) 2023-10-17 14:46:35 +00: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 Replace ajax with fetch, improve image diff (#27267) (#27583) 2023-10-11 16:12:31 +02:00
svg.test.js Use vitest globals (#27102) (#27311) 2023-09-27 16:10:08 +02:00
utils.js enforce maxlength in frontend (#29389) (#29396) 2024-02-25 14:56:44 +00:00
utils.test.js Use vitest globals (#27102) (#27311) 2023-09-27 16:10:08 +02:00