|
|
@ -1810,7 +1810,7 @@ class PostActions {
|
|
|
|
pageInfo.append('form_token', document.getElementById('form_token').value);
|
|
|
|
pageInfo.append('form_token', document.getElementById('form_token').value);
|
|
|
|
if (files.length > 0 && files != null) for(var i = 0; i < files.length; i++){
|
|
|
|
if (files.length > 0 && files != null) for(var i = 0; i < files.length; i++){
|
|
|
|
var file = files[i];
|
|
|
|
var file = files[i];
|
|
|
|
if (file.type.match('image.*') || file.type.match('video.mp4')) pageInfo.append('page_files[]', file, file.name);
|
|
|
|
if (file.type.match('image.*') || file.type.match('video.mp4') || file.type.match('audio.mpeg') || file.type.match('application.pdf') || file.type.match('text.plain') || file.type.match('text.rtf')) pageInfo.append('page_files[]', file, file.name);
|
|
|
|
else reject('Not an image file');
|
|
|
|
else reject('Not an image file');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else //check to see if image exists
|
|
|
|
else //check to see if image exists
|
|
|
@ -5417,7 +5417,10 @@ class FileManager {
|
|
|
|
'image/png',
|
|
|
|
'image/png',
|
|
|
|
'image/svg',
|
|
|
|
'image/svg',
|
|
|
|
'audio/mpeg',
|
|
|
|
'audio/mpeg',
|
|
|
|
'video/mp4'
|
|
|
|
'video/mp4',
|
|
|
|
|
|
|
|
'application/pdf',
|
|
|
|
|
|
|
|
'text/plain',
|
|
|
|
|
|
|
|
'text/rtf'
|
|
|
|
];
|
|
|
|
];
|
|
|
|
this.files = [];
|
|
|
|
this.files = [];
|
|
|
|
this.sortedFiles = [];
|
|
|
|
this.sortedFiles = [];
|
|
|
@ -5444,7 +5447,21 @@ class FileManager {
|
|
|
|
if (item.className == 'img-item') url = item.style.backgroundImage.slice(4, -1).replace(/"/g, '');
|
|
|
|
if (item.className == 'img-item') url = item.style.backgroundImage.slice(4, -1).replace(/"/g, '');
|
|
|
|
else url = item.getAttribute('data-source');
|
|
|
|
else url = item.getAttribute('data-source');
|
|
|
|
currentFiles.push({
|
|
|
|
currentFiles.push({
|
|
|
|
id: item.getAttribute('id'),
|
|
|
|
earl: url
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
this.reindexFiles(currentFiles, 0);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
_sortablejsDefault.default.create(this.fileList, {
|
|
|
|
|
|
|
|
onUpdate: (e)=>{
|
|
|
|
|
|
|
|
notify.alert('REINDEXING FILES', null);
|
|
|
|
|
|
|
|
let currentFiles = [];
|
|
|
|
|
|
|
|
let items = e.target.children;
|
|
|
|
|
|
|
|
for(let index = 0; index < items.length; index++){
|
|
|
|
|
|
|
|
var item = items[index];
|
|
|
|
|
|
|
|
let url = item.getAttribute('data-source');
|
|
|
|
|
|
|
|
currentFiles.push({
|
|
|
|
earl: url
|
|
|
|
earl: url
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -5476,7 +5493,8 @@ class FileManager {
|
|
|
|
var self = this;
|
|
|
|
var self = this;
|
|
|
|
this.files = []; //clear files array
|
|
|
|
this.files = []; //clear files array
|
|
|
|
this.imageList.innerHTML = '';
|
|
|
|
this.imageList.innerHTML = '';
|
|
|
|
for(var i = 0, file; file = files[i]; i++){
|
|
|
|
this.fileList.innerHTML = '';
|
|
|
|
|
|
|
|
for(var i = 0, file1; file1 = files[i]; i++){
|
|
|
|
var reader = new FileReader(); // Closure to capture the file information
|
|
|
|
var reader = new FileReader(); // Closure to capture the file information
|
|
|
|
reader.onload = ((theFile)=>{
|
|
|
|
reader.onload = ((theFile)=>{
|
|
|
|
return function(f) {
|
|
|
|
return function(f) {
|
|
|
@ -5516,12 +5534,23 @@ class FileManager {
|
|
|
|
case 'audio/mpeg':
|
|
|
|
case 'audio/mpeg':
|
|
|
|
var sound = document.createElement('div');
|
|
|
|
var sound = document.createElement('div');
|
|
|
|
sound.className = 'audio-item';
|
|
|
|
sound.className = 'audio-item';
|
|
|
|
|
|
|
|
sound.setAttribute('data-source', f.target.result);
|
|
|
|
self.fileList.appendChild(sound);
|
|
|
|
self.fileList.appendChild(sound);
|
|
|
|
|
|
|
|
self.files.push(theFile);
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'application/pdf':
|
|
|
|
|
|
|
|
case 'text/plain':
|
|
|
|
|
|
|
|
case 'text/rtf':
|
|
|
|
|
|
|
|
var file = document.createElement('div');
|
|
|
|
|
|
|
|
file.className = 'file-item';
|
|
|
|
|
|
|
|
file.setAttribute('data-source', f.target.result);
|
|
|
|
|
|
|
|
self.fileList.appendChild(file);
|
|
|
|
|
|
|
|
self.files.push(theFile);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
})(file); // Read in the image file as a data URL.
|
|
|
|
})(file1); // Read in the image file as a data URL.
|
|
|
|
reader.readAsDataURL(file);
|
|
|
|
reader.readAsDataURL(file1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// event handlers
|
|
|
|
// event handlers
|
|
|
|