Skip to content
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions web_src/js/features/common-global.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,9 @@ export function initGlobalDropzone() {
$.post($dropzone.data('remove-url'), {
file: file.uuid,
_csrf: csrfToken,
}).then(() => {
const filename = file.name.substring(0, file.name.lastIndexOf('.')), oldval = `![${filename}](/attachments/${file.uuid})`, editor = this.element.parentElement.parentElement.querySelector('textarea')._data_easyMDE;
editor.value(editor.value().replace(oldval, ''));
});
}
});
Expand Down
10 changes: 10 additions & 0 deletions web_src/js/features/comp/ImagePaste.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ export function initCompImagePaste($target) {
replaceAndKeepCursor(textarea, `![${name}]()`, `![${name}](/attachments/${data.uuid})`);
const input = $(`<input id="${data.uuid}" name="files" type="hidden">`).val(data.uuid);
dropzoneFiles.appendChild(input[0]);
const upfile = {name: img.name, size: img.size, uuid: data.uuid};
dropzone.dropzone.emit('addedfile', upfile);
dropzone.dropzone.emit('thumbnail', upfile, `/attachments/${data.uuid}`);
dropzone.dropzone.emit('complete', upfile);
dropzone.dropzone.files.push(upfile);
}
}, false);
}
Expand All @@ -87,6 +92,11 @@ export function initEasyMDEImagePaste(easyMDE, dropzone, files) {
easyMDE.codemirror.replaceRange(`![${name}](/attachments/${data.uuid})`, pos);
const input = $(`<input id="${data.uuid}" name="files" type="hidden">`).val(data.uuid);
files.append(input);
const upfile = {name: img.name, size: img.size, uuid: data.uuid};
dropzone.dropzone.emit('addedfile', upfile);
dropzone.dropzone.emit('thumbnail', upfile, `/attachments/${data.uuid}`);
dropzone.dropzone.emit('complete', upfile);
dropzone.dropzone.files.push(upfile);
}
});
}
3 changes: 3 additions & 0 deletions web_src/js/features/repo-legacy.js
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,9 @@ async function onEditContent(event) {
$.post($dropzone.data('remove-url'), {
file: file.uuid,
_csrf: csrfToken,
}).then(() => {
const filename = file.name.substring(0, file.name.lastIndexOf('.')), oldval = `![${filename}](/attachments/${file.uuid})`, editor = this.element.parentElement.parentElement.querySelector('textarea')._data_easyMDE;
editor.value(editor.value().replace(oldval, ''));
});
}
});
Expand Down