mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-08-04 17:35:21 +02:00
fix(ui): Add pasted images to dropzone
This adds pasted images to the dropzone to provide the same experience
as when using the dropzone. This gives the possibility to preview and
delete the image. Additionally it provides a copy button to copy the
markdown code for inserting the image.
Removed the old implementation in `repo-legacy.js` and generalized
everything in `common-global.js` as common implementation.
Replaced old jquery code with plain JS.
Fixes #4588
(cherry picked from commit 6e66380408
)
This commit is contained in:
parent
f71e5ac323
commit
de0c6b1dd2
10 changed files with 303 additions and 158 deletions
|
@ -525,7 +525,12 @@ func TestIssueCommentAttachment(t *testing.T) {
|
|||
assert.NotEqual(t, 0, id)
|
||||
|
||||
req = NewRequest(t, "GET", fmt.Sprintf("/%s/%s/comments/%d/attachments", "user2", "repo1", id))
|
||||
session.MakeRequest(t, req, http.StatusOK)
|
||||
resp = session.MakeRequest(t, req, http.StatusOK)
|
||||
var attachments []*api.WebAttachment
|
||||
DecodeJSON(t, resp, &attachments)
|
||||
assert.Len(t, attachments, 1)
|
||||
assert.Equal(t, attachments[0].UUID, uuid)
|
||||
assert.Equal(t, "image/png", attachments[0].MimeType)
|
||||
|
||||
// Using the ID of a comment that does not belong to the repository must fail
|
||||
req = NewRequest(t, "GET", fmt.Sprintf("/%s/%s/comments/%d/attachments", "user5", "repo4", id))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue