Skip to content

Commit

Permalink
fix: focus text area after file upload finised (#1244)
Browse files Browse the repository at this point in the history
  • Loading branch information
nlopin authored Jul 20, 2024
1 parent b4f17d4 commit 6ed3a39
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,12 @@ export default {
if (filename) {
const urlMarkdown = settings.urlText.replace(settings.filenameTag, filename);
textarea.value = replaceProgressTextOrAppend(textarea.value, settings.progressText, urlMarkdown);
this.focusTextareaIfNeeded(true);
}
},
() => {
textarea.value = replaceProgressTextOrAppend(textarea.value, settings.progressText, settings.errorText);
this.focusTextareaIfNeeded(true);
}
);
}
Expand Down
13 changes: 12 additions & 1 deletion frontend/static/js/inline-attachment.js
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,18 @@ export function isFileAllowed(file, settings) {
if (isFileAllowed(file, this.settings)) {
result = true;
this.onFileInserted(file);
uploadFile(file, this.settings, this.onFileUploadResponse.bind(this), this.onFileUploadError.bind(this));
uploadFile(
file,
this.settings,
(xhr) => {
this.onFileUploadResponse.call(this, xhr);
this.editor.codeMirror.focus();
},
(xhr) => {
this.onFileUploadError.call(this, xhr);
this.editor.codeMirror.focus();
}
);
}
}

Expand Down

0 comments on commit 6ed3a39

Please sign in to comment.