Skip to content

Commit

Permalink
Merge commit from fork
Browse files Browse the repository at this point in the history
  • Loading branch information
dew326 authored Jul 31, 2024
1 parent 7d1971c commit 7a9f991
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 10 deletions.
10 changes: 6 additions & 4 deletions src/bundle/Resources/public/js/scripts/fieldType/ezbinaryfile.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(function(global, doc, eZ) {
(function (global, doc, eZ) {
const SELECTOR_FIELD = '.ez-field-edit--ezbinaryfile';
const SELECTOR_LABEL_WRAPPER = '.ez-field-edit__label-wrapper';
const SELECTOR_FILESIZE_NOTICE = '.ez-data-source__message--filesize';
Expand All @@ -15,9 +15,11 @@
const sizeContainer = preview.querySelector('.ez-field-edit-preview__file-size');
const files = [].slice.call(event.target.files);
const fileSize = this.formatFileSize(files[0].size);
const { escapeHTML } = eZ.helpers.text;
const fileName = escapeHTML(files[0].name);

nameContainer.innerHTML = files[0].name;
nameContainer.title = files[0].name;
nameContainer.innerHTML = fileName;
nameContainer.title = fileName;
sizeContainer.innerHTML = fileSize;
sizeContainer.title = fileSize;

Expand Down Expand Up @@ -63,5 +65,5 @@
previewField.init();

eZ.addConfig('fieldTypeValidators', [validator], true);
})
});
})(window, window.document, window.eZ);
8 changes: 5 additions & 3 deletions src/bundle/Resources/public/js/scripts/fieldType/ezimage.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(function(global, doc, eZ) {
(function (global, doc, eZ) {
const SELECTOR_FIELD = '.ez-field-edit--ezimage';
const SELECTOR_INPUT_FILE = 'input[type="file"]';
const SELECTOR_LABEL_WRAPPER = '.ez-field-edit__label-wrapper';
Expand Down Expand Up @@ -36,11 +36,13 @@
const sizeContainer = preview.querySelector('.ez-field-edit-preview__file-size');
const files = [].slice.call(event.target.files);
const fileSize = this.formatFileSize(files[0].size);
const { escapeHTML } = eZ.helpers.text;
const fileName = escapeHTML(files[0].name);

this.getImageUrl(files[0], (url) => image.setAttribute('src', url));

nameContainer.innerHTML = files[0].name;
nameContainer.title = files[0].name;
nameContainer.innerHTML = fileName;
nameContainer.title = fileName;
sizeContainer.innerHTML = fileSize;
sizeContainer.title = fileSize;

Expand Down
8 changes: 5 additions & 3 deletions src/bundle/Resources/public/js/scripts/fieldType/ezmedia.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(function(global, doc, eZ) {
(function (global, doc, eZ) {
const SELECTOR_FIELD = '.ez-field-edit--ezmedia';
const SELECTOR_PREVIEW = '.ez-field-edit__preview';
const SELECTOR_MEDIA = '.ez-field-edit-preview__media';
Expand Down Expand Up @@ -62,9 +62,11 @@
const sizeContainer = preview.querySelector('.ez-field-edit-preview__file-size');
const files = [].slice.call(event.target.files);
const fileSize = this.formatFileSize(files[0].size);
const { escapeHTML } = eZ.helpers.text;
const fileName = escapeHTML(files[0].name);

nameContainer.innerHTML = files[0].name;
nameContainer.title = files[0].name;
nameContainer.innerHTML = fileName;
nameContainer.title = fileName;
sizeContainer.innerHTML = fileSize;
sizeContainer.title = fileSize;

Expand Down

0 comments on commit 7a9f991

Please sign in to comment.