Serve upload files directly from nginx

This commit is contained in:
2025-04-06 12:08:15 +02:00
parent 91b30e7550
commit 67bc49fb21
10 changed files with 65 additions and 52 deletions

View File

@ -26,13 +26,14 @@ const loadEasyMde = (textarea: HTMLTextAreaElement) => {
return;
}
onSuccess(response.data.href);
// Workaround function to add ! and image name to uploaded image
// Without this, you get [](url) instead of ![name](url)
// Workaround function to add an image name to uploaded image
// Without this, you get ![](url) instead of ![name](url)
let cursor = easymde.codemirror.getCursor();
easymde.codemirror.setSelection({ line: cursor.line, ch: cursor.ch - 1 });
easymde.codemirror.replaceSelection("!");
easymde.codemirror.setSelection({ line: cursor.line, ch: cursor.ch + 1 });
easymde.codemirror.setSelection({
line: cursor.line,
ch: cursor.ch - response.data.href.length - 3,
});
easymde.codemirror.replaceSelection(response.data.name);
// Move cursor at the end of the url and add a new line