Skip to content

Commit 77f12d0

Browse files
committed
fixed script upload
1 parent a306b14 commit 77f12d0

File tree

1 file changed

+14
-11
lines changed
  • app/aem/ui.apps.base/src/main/content/jcr_root/apps/apm/clientlibs/views/scripts/js

1 file changed

+14
-11
lines changed

app/aem/ui.apps.base/src/main/content/jcr_root/apps/apm/clientlibs/views/scripts/js/fileupload.js

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@
1717
* limitations under the License.
1818
* =========================LICENSE_END==================================
1919
*/
20-
(function(window, $, Coral) {
20+
(function (window, $, Coral) {
2121
'use strict';
2222

2323
let dragCounter = 0,
24-
fileUploader;
24+
fileUploader ;
2525

2626
function init() {
2727
fileUploader = new Coral.FileUpload();
@@ -42,9 +42,9 @@
4242
];
4343
fileUploader.upload(filename);
4444
})
45-
.on('coral-fileupload:load', function(event) {
45+
.on('coral-fileupload:load', function (event) {
4646
let savePath = window.location.pathname.split('.html')[1];
47-
fileUploader.uploadQueue.forEach(function(item, index) {
47+
fileUploader.uploadQueue.forEach(function (item, index) {
4848
let filename = event.detail.item.file.name;
4949
if (item.file.name === filename) {
5050
item._parameters = [
@@ -57,23 +57,26 @@
5757
_reload();
5858
}
5959
});
60+
fileUploader._getTargetChangeInput().addEventListener('change', function (event) {
61+
fileUploader._onInputChange(event);
62+
});
6063

6164
const coralShell = $('coral-shell-content').get(0);
62-
coralShell.addEventListener('drop', function(event) {
65+
coralShell.addEventListener('drop', function (event) {
6366
dragCounter = 0;
6467
event.preventDefault();
6568
_dropZoneDrop();
6669
fileUploader._onInputChange(event);
6770
}, false);
68-
coralShell.addEventListener('dragenter', function(event) {
71+
coralShell.addEventListener('dragenter', function (event) {
6972
event.preventDefault();
7073
dragCounter++;
7174
_dropZoneDragEnter();
7275
}, false);
73-
coralShell.addEventListener('dragover', function(event) {
76+
coralShell.addEventListener('dragover', function (event) {
7477
event.preventDefault();
7578
}, false);
76-
coralShell.addEventListener('dragleave', function() {
79+
coralShell.addEventListener('dragleave', function () {
7780
dragCounter--;
7881
if (dragCounter === 0) {
7982
_dropZoneDragLeave();
@@ -87,21 +90,21 @@
8790

8891
function _dropZoneDragEnter() {
8992
let message = Granite.I18n.get('Drag and drop to upload'),
90-
dragAndDropMessage = $('<div class=\"drag-drop-message\" style="text-align: center;"><h1 > <span>{</span>' + message + '<span>}</span></h1></div>');
93+
dragAndDropMessage = $('<div class=\"drag-drop-message\" style="text-align: center;"><h1 > <span>{</span>' + message + '<span>}</span></h1></div>');
9194
$('.foundation-collection').overlayMask('show', dragAndDropMessage);
9295
}
9396

9497
function _dropZoneDragLeave() {
9598
$('.foundation-collection').overlayMask('hide');
9699
}
97100

98-
function _dropZoneDrop () {
101+
function _dropZoneDrop() {
99102
$('.foundation-collection').overlayMask('hide');
100103
}
101104

102105
$(window).adaptTo('foundation-registry').register('foundation.collection.action.action', {
103106
name: 'scripts.upload',
104-
handler: function() {
107+
handler: function () {
105108
fileUploader._showFileDialog();
106109
}
107110
});

0 commit comments

Comments
 (0)