0
0
Fork 0
mirror of https://github.com/go-gitea/gitea synced 2024-12-28 04:54:21 +01:00
gitea/web_src/js/utils
silverwind a3cfe6f39b
Support pasting URLs over markdown text (#29566)
Support pasting URLs over selection text in the textarea editor. Does
not work in EasyMDE and I don't intend to support it. Image paste works
as usual in both Textarea and EasyMDE.

The new `replaceTextareaSelection` function changes textarea content via
[`insertText`](https://developer.mozilla.org/en-US/docs/Web/API/Document/execCommand#using_inserttext)
command, which preserves history, e.g. `CTRL-Z` works and is also
demostrated below. We should later refactor the image paste code to use
the same function because it currently destroys history.

Overriding the formatting via `Shift` key is supported as well, e.g.
`Ctrl+Shift+V` will insert the URL as-is, like on GitHub.


![urlpaste](https://github.com/go-gitea/gitea/assets/115237/522b1023-6797-401c-9e4a-498570adfc88)
2024-03-08 15:15:58 +00:00
..
color.js Implement code frequency graph (#29191) 2024-02-23 23:41:24 +00:00
color.test.js Use vitest globals (#27102) 2023-09-27 04:37:13 +00:00
dom.js Support pasting URLs over markdown text (#29566) 2024-03-08 15:15:58 +00:00
image.js Downscale pasted PNG images based on metadata (#29123) 2024-02-19 02:23:06 +00:00
image.test.js Downscale pasted PNG images based on metadata (#29123) 2024-02-19 02:23:06 +00:00
match.js Avoiding accessing undefined mentionValues (#26461) 2023-08-12 08:36:23 +00:00
match.test.js Use vitest globals (#27102) 2023-09-27 04:37:13 +00:00
time.js Set user's 24h preference from their current OS locale (#29651) 2024-03-08 16:07:56 +08:00
time.test.js Implement contributors graph (#27882) 2024-02-15 23:21:13 +01:00
url.js Support pasting URLs over markdown text (#29566) 2024-03-08 15:15:58 +00:00
url.test.js Support pasting URLs over markdown text (#29566) 2024-03-08 15:15:58 +00:00