TF-2754 Remove bytes param unnecessary

This commit is contained in:
dab246
2024-04-01 14:47:04 +07:00
committed by Dat H. Pham
parent c021e00bf4
commit 1dfa34ed79
+3 -4
View File
@@ -241,7 +241,7 @@ class HtmlUtils {
console.error(reason); console.error(reason);
}); });
${_fileInfoScript(bytes, fileName)} ${_fileInfoScript(fileName)}
${_downloadButtonListenerScript(bytes, fileName)} ${_downloadButtonListenerScript(bytes, fileName)}
</script> </script>
@@ -308,7 +308,7 @@ class HtmlUtils {
const bytesJs = new Uint8Array(${bytes.toJS}); const bytesJs = new Uint8Array(${bytes.toJS});
PDFObject.embed('data:application/pdf;base64,$base64', "#pdf-viewer"); PDFObject.embed('data:application/pdf;base64,$base64', "#pdf-viewer");
${_fileInfoScript(bytes, fileName)} ${_fileInfoScript(fileName)}
${_downloadButtonListenerScript(bytes, fileName)} ${_downloadButtonListenerScript(bytes, fileName)}
</script> </script>
@@ -406,7 +406,7 @@ class HtmlUtils {
});'''; });''';
} }
static String _fileInfoScript(Uint8List bytes, String? fileName) { static String _fileInfoScript(String? fileName) {
return ''' return '''
function formatFileSize(bytes) { function formatFileSize(bytes) {
if (bytes === 0) return '0 Bytes'; if (bytes === 0) return '0 Bytes';
@@ -420,7 +420,6 @@ class HtmlUtils {
fileNameSpan.textContent = "$fileName"; fileNameSpan.textContent = "$fileName";
const fileSizeSpan = document.getElementById('file-size'); const fileSizeSpan = document.getElementById('file-size');
const byteArray = new Uint8Array(${bytes.toJS});
fileSizeSpan.textContent = formatFileSize(bytesJs.length);'''; fileSizeSpan.textContent = formatFileSize(bytesJs.length);''';
} }
} }