Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .yarn/install-state.gz
Binary file not shown.
1 change: 1 addition & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nodeLinker: node-modules
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@editorjs/image",
"version": "2.9.0",
"version": "2.9.1",
"keywords": [
"codex editor",
"image",
Expand Down Expand Up @@ -47,4 +47,4 @@
"dependencies": {
"@codexteam/icons": "^0.0.6"
}
}
}
8 changes: 5 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,8 @@ export default class ImageTool {
if (response.success && response.file) {
this.image = response.file;
} else {
this.uploadingFailed('incorrect response: ' + JSON.stringify(response));
const customErrorMessage = typeof response.message === 'string' ? response.message : undefined;
this.uploadingFailed('incorrect response: ' + JSON.stringify(response), customErrorMessage);
}
}

Expand All @@ -408,13 +409,14 @@ export default class ImageTool {
*
* @private
* @param {string} errorText - uploading error text
* @param {string | undefined} customErrorText - displayed error text
* @returns {void}
*/
uploadingFailed(errorText) {
uploadingFailed(errorText, customErrorText) {
console.log('Image Tool: uploading failed because of', errorText);

this.api.notifier.show({
message: this.api.i18n.t('Couldn’t upload image. Please try another.'),
message: customErrorText ?? this.api.i18n.t('Couldn’t upload image. Please try another.'),
style: 'error',
});
this.ui.hidePreloader();
Expand Down
Loading