Skip to content

Instantly share code, notes, and snippets.

@ichaykin
Created March 27, 2020 12:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ichaykin/cc1c50a7674871fc204dd185ef4bd9c7 to your computer and use it in GitHub Desktop.
Save ichaykin/cc1c50a7674871fc204dd185ef4bd9c7 to your computer and use it in GitHub Desktop.
diff --git a/js/tygh/file_uploader.js b/js/tygh/file_uploader.js
index b14be17..d9947e5 100644
--- a/js/tygh/file_uploader.js
+++ b/js/tygh/file_uploader.js
@@ -36,7 +36,9 @@
value: function () {
for (var i = 0; i < this.length; i++) {
if (this[i].image_type === 'M') {
- return this[i]; } }
+ return this[i];
+ }
+ }
return false;
},
@@ -453,6 +455,7 @@
}
self.refreshPreview(addedFile);
self.registerCustomRemoveEvent(addedFile);
+ self.registerCustomAltUpdateEvent(addedFile);
self.expandAltTextarea(addedFile);
});
},
@@ -608,6 +611,15 @@
});
},
+ registerCustomAltUpdateEvent: function (file) {
+ var self = this;
+
+ $(file.previewElement).find('.file-uploader__file-description-input').on('keyup', function () {
+ file.dynamicData['alt-text-detailed'].value = $(this).val();
+ self.refreshPreview(file);
+ });
+ },
+
refreshPreview: function (previewFile) {
if ('dynamicData' in previewFile) {
var self = this;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment