mirror of
https://github.com/go-gitea/gitea.git
synced 2025-02-23 19:50:43 +08:00
Remove appSubUrl from pasted images (#17572)
* Remove appSubUrl from pasted images Since we fixed the url base for the links in repositories we no longer need to add the appsuburl to pasted image links. Fix #17057 Signed-off-by: Andrew Thornton <art27@cantab.net>
This commit is contained in:
parent
d168f0498b
commit
513951bc16
@ -1,4 +1,4 @@
|
||||
const {appSubUrl, csrfToken} = window.config;
|
||||
const {csrfToken} = window.config;
|
||||
|
||||
async function uploadFile(file, uploadUrl) {
|
||||
const formData = new FormData();
|
||||
@ -67,7 +67,7 @@ export function initCompImagePaste($target) {
|
||||
const name = img.name.substr(0, img.name.lastIndexOf('.'));
|
||||
insertAtCursor(textarea, `![${name}]()`);
|
||||
const data = await uploadFile(img, uploadUrl);
|
||||
replaceAndKeepCursor(textarea, `![${name}]()`, ``);
|
||||
replaceAndKeepCursor(textarea, `![${name}]()`, ``);
|
||||
const input = $(`<input id="${data.uuid}" name="files" type="hidden">`).val(data.uuid);
|
||||
dropzoneFiles.appendChild(input[0]);
|
||||
}
|
||||
@ -83,7 +83,7 @@ export function initSimpleMDEImagePaste(simplemde, dropzone, files) {
|
||||
const name = img.name.substr(0, img.name.lastIndexOf('.'));
|
||||
const data = await uploadFile(img, uploadUrl);
|
||||
const pos = simplemde.codemirror.getCursor();
|
||||
simplemde.codemirror.replaceRange(``, pos);
|
||||
simplemde.codemirror.replaceRange(``, pos);
|
||||
const input = $(`<input id="${data.uuid}" name="files" type="hidden">`).val(data.uuid);
|
||||
files.append(input);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user