mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-23 11:37:02 -04:00
Add mock for upload response
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
parent
5933fb801d
commit
ed9f4aefab
4 changed files with 14 additions and 11 deletions
|
@ -14,8 +14,7 @@ export const handleUpload = (file: File, editor: Editor): void => {
|
|||
if (!file) {
|
||||
return
|
||||
}
|
||||
const mimeType = file.type
|
||||
if (!supportedMimeTypes.includes(mimeType)) {
|
||||
if (!supportedMimeTypes.includes(file.type)) {
|
||||
// this mimetype is not supported
|
||||
return
|
||||
}
|
||||
|
@ -23,7 +22,7 @@ export const handleUpload = (file: File, editor: Editor): void => {
|
|||
const uploadPlaceholder = `![${i18n.t('editor.upload.uploadFile', { fileName: file.name })}]()`
|
||||
const noteId = store.getState().noteDetails.id
|
||||
editor.replaceRange(uploadPlaceholder, cursor, cursor, '+input')
|
||||
uploadFile(noteId, mimeType, file)
|
||||
uploadFile(noteId, file)
|
||||
.then(({ link }) => {
|
||||
editor.replaceRange(
|
||||
getCorrectSyntaxForLink(mimeType, link),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue