only show rename info on update of file

This commit is contained in:
2024-04-23 02:17:19 +10:00
parent b60e368cb9
commit 27941b2017

View File

@@ -35,11 +35,6 @@
document.getElementById('{{ $name }}_name').innerText = fileName; document.getElementById('{{ $name }}_name').innerText = fileName;
document.getElementById('{{ $name }}_name').classList.add('italic'); document.getElementById('{{ $name }}_name').classList.add('italic');
const newFileInfo = document.createElement('i');
newFileInfo.classList.add('fa-solid', 'fa-info-circle', 'text-gray-500', 'ml-2');
newFileInfo.setAttribute('data-tooltip', 'The filename may change from the actual file name if a file with the same name already exists.');
document.getElementById('{{ $name }}_name').appendChild(newFileInfo);
document.getElementById('{{ $name }}_size').innerText = SM.bytesToString(fileSize); document.getElementById('{{ $name }}_size').innerText = SM.bytesToString(fileSize);
if(fileType.startsWith('image/')) { if(fileType.startsWith('image/')) {
@@ -61,6 +56,12 @@
const reader = new FileReader(); const reader = new FileReader();
reader.onload = function(e) { reader.onload = function(e) {
updateDetails(file.name, file.type, file.size, e.target.result); updateDetails(file.name, file.type, file.size, e.target.result);
const newFileInfo = document.createElement('i');
newFileInfo.classList.add('fa-solid', 'fa-info-circle', 'text-gray-500', 'ml-2');
newFileInfo.setAttribute('data-tooltip', 'The filename may change from the actual file name if a file with the same name already exists.');
document.getElementById('{{ $name }}_name').appendChild(newFileInfo);
if('{{ $onchange }}' !== '' && typeof window['{{ $onchange }}'] === 'function') { if('{{ $onchange }}' !== '' && typeof window['{{ $onchange }}'] === 'function') {
window['{{ $onchange }}'](file, file.name); window['{{ $onchange }}'](file, file.name);
} }