mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-07-07 18:05:40 +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
This commit is contained in:
parent
ad1adabcbb
commit
6e66380408
10 changed files with 303 additions and 158 deletions
|
@ -445,7 +445,7 @@ export async function handleReply($el) {
|
|||
// When the page is loaded, the dropzone is initialized by initGlobalDropzone, but the editor is not initialized.
|
||||
// When the form is submitted and partially reload, none of them is initialized.
|
||||
const dropzone = $form.find('.dropzone')[0];
|
||||
if (!dropzone.dropzone) initDropzone(dropzone);
|
||||
if (!dropzone.dropzone) await initDropzone(dropzone);
|
||||
editor = await initComboMarkdownEditor($form.find('.combo-markdown-editor'));
|
||||
}
|
||||
editor.focus();
|
||||
|
@ -580,7 +580,7 @@ export function initRepoPullRequestReview() {
|
|||
$td.find("input[name='side']").val(side === 'left' ? 'previous' : 'proposed');
|
||||
$td.find("input[name='path']").val(path);
|
||||
|
||||
initDropzone($td.find('.dropzone')[0]);
|
||||
await initDropzone($td.find('.dropzone')[0]);
|
||||
const editor = await initComboMarkdownEditor($td.find('.combo-markdown-editor'));
|
||||
editor.focus();
|
||||
} catch (error) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue