Template
1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo synced 2024-11-27 04:06:10 +01:00
forgejo/web_src/js
Giteabot b272224918
Preserve BOM in web editor (#28935) (#28959)
Backport #28935 by @silverwind

The `ToUTF8*` functions were stripping BOM, while BOM is actually valid
in UTF8, so the stripping must be optional depending on use case. This
does:

- Add a options struct to all `ToUTF8*` functions, that by default will
strip BOM to preserve existing behaviour
- Remove `ToUTF8` function, it was dead code
- Rename `ToUTF8WithErr` to `ToUTF8`
- Preserve BOM in Monaco Editor
- Remove a unnecessary newline in the textarea value. Browsers did
ignore it, it seems but it's better not to rely on this behaviour.

Fixes: https://github.com/go-gitea/gitea/issues/28743
Related: https://github.com/go-gitea/gitea/issues/6716 which seems to
have once introduced a mechanism that strips and re-adds the BOM, but
from what I can tell, this mechanism was removed at some point after
that PR.

Co-authored-by: silverwind <me@silverwind.io>
(cherry picked from commit b8e6cffd31)
2024-01-31 14:18:26 +01:00
..
components Modernize merge button (#28140) (#28786) 2024-01-16 14:40:18 +00:00
features Preserve BOM in web editor (#28935) (#28959) 2024-01-31 14:18:26 +01:00
markup Change katex limits (#27823) (#27868) 2023-11-01 22:26:45 +01:00
modules Polyfill SubmitEvent for PaleMoon (#28441) (#28478) 2023-12-22 12:05:11 +01:00
render Use vitest globals (#27102) (#27311) 2023-09-27 16:10:08 +02:00
standalone [API] Forgejo API /api/forgejo/v1 2023-11-13 12:33:48 +01:00
test Avoid duplicate JS error messages on UI (#28873) (#28881) 2024-01-31 14:18:25 +01:00
utils Polyfill SubmitEvent for PaleMoon (#28441) (#28478) 2023-12-22 12:05:11 +01:00
vendor Vendor jquery.are-you-sure with strict mode fixes (#26901) 2023-09-06 00:02:44 +00:00
webcomponents Polyfill SubmitEvent for PaleMoon (#28441) (#28478) 2023-12-22 12:05:11 +01:00
bootstrap.js Avoid duplicate JS error messages on UI (#28873) (#28881) 2024-01-31 14:18:25 +01:00
bootstrap.test.js Avoid duplicate JS error messages on UI (#28873) (#28881) 2024-01-31 14:18:25 +01: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 Replace ajax with fetch, improve image diff (#27267) (#27583) 2023-10-11 16:12:31 +02:00
utils.test.js Use vitest globals (#27102) (#27311) 2023-09-27 16:10:08 +02:00