summaryrefslogtreecommitdiffstats
path: root/web_src/js/features/comp/ImagePaste.js
diff options
context:
space:
mode:
Diffstat (limited to 'web_src/js/features/comp/ImagePaste.js')
-rw-r--r--web_src/js/features/comp/ImagePaste.js8
1 files changed, 4 insertions, 4 deletions
diff --git a/web_src/js/features/comp/ImagePaste.js b/web_src/js/features/comp/ImagePaste.js
index b6881dd282..30c5820f62 100644
--- a/web_src/js/features/comp/ImagePaste.js
+++ b/web_src/js/features/comp/ImagePaste.js
@@ -1,4 +1,4 @@
-const {AppSubUrl, csrf} = window.config;
+const {appSubUrl, csrfToken} = window.config;
async function uploadFile(file, uploadUrl) {
const formData = new FormData();
@@ -6,7 +6,7 @@ async function uploadFile(file, uploadUrl) {
const res = await fetch(uploadUrl, {
method: 'POST',
- headers: {'X-Csrf-Token': csrf},
+ headers: {'X-Csrf-Token': csrfToken},
body: formData,
});
return await res.json();
@@ -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}]()`, `![${name}](${AppSubUrl}/attachments/${data.uuid})`);
+ replaceAndKeepCursor(textarea, `![${name}]()`, `![${name}](${appSubUrl}/attachments/${data.uuid})`);
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(`![${name}](${AppSubUrl}/attachments/${data.uuid})`, pos);
+ simplemde.codemirror.replaceRange(`![${name}](${appSubUrl}/attachments/${data.uuid})`, pos);
const input = $(`<input id="${data.uuid}" name="files" type="hidden">`).val(data.uuid);
files.append(input);
}