Skip to content

Commit 8a8ce65

Browse files
committed
Add more file types and hide filename when multiple files selected
1 parent a64c10a commit 8a8ce65

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

js/common/file_dialog.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,13 @@ const extensionMap = {
3030
"gif": {style: FA_STYLE_REGULAR, icon: "file-image", type: "bin"},
3131
"htm": {style: FA_STYLE_REGULAR, icon: "file-code", type: "text"},
3232
"html": {style: FA_STYLE_REGULAR, icon: "file-code", type: "text"},
33+
"ini": {style: FA_STYLE_REGULAR, icon: "file-code", type: "text"},
34+
"inf": {style: FA_STYLE_REGULAR, icon: "file-code", type: "text"},
3335
"jpeg": {style: FA_STYLE_REGULAR, icon: "file-image", type: "bin"},
3436
"jpg": {style: FA_STYLE_REGULAR, icon: "file-image", type: "bin"},
3537
"js": {style: FA_STYLE_REGULAR, icon: "file-code", type: "text"},
3638
"json": {style: FA_STYLE_REGULAR, icon: "file-code", type: "text"},
39+
"md": {style: FA_STYLE_REGULAR, icon: "file-lines", type: "text"},
3740
"mov": {style: FA_STYLE_REGULAR, icon: "file-video", type: "bin"},
3841
"mp3": {style: FA_STYLE_REGULAR, icon: "file-audio", type: "bin"},
3942
"mp4": {style: FA_STYLE_REGULAR, icon: "file-video", type: "bin"},
@@ -50,8 +53,8 @@ const extensionMap = {
5053
const FOLDER_ICON = [FA_STYLE_REGULAR, "fa-folder"];
5154
const DEFAULT_FILE_ICON = [FA_STYLE_REGULAR, "fa-file"];
5255

53-
const FILESIZE_UNITS = ["bytes", "KB", "MB", "GB"];
54-
const COMPACT_UNITS = ["", "K", "M", "G"];
56+
const FILESIZE_UNITS = ["bytes", "KB", "MB", "GB", "TB"];
57+
const COMPACT_UNITS = ["", "K", "M", "G", "T"];
5558

5659
function getFileExtension(filename) {
5760
let extension = filename.split('.').pop();
@@ -280,7 +283,9 @@ class FileDialog extends GenericModal {
280283
this._selectItem(listItem, selectedFiles.includes(listItem));
281284
}
282285

283-
if (clickedItem.getAttribute("data-type") != "folder") {
286+
if (this._multipleItemsSelected()) {
287+
this._getElement('fileNameField').value = "";
288+
} else if (clickedItem.getAttribute("data-type") != "folder") {
284289
this._getElement('fileNameField').value = clickedItem.querySelector("span").innerHTML;
285290
}
286291

0 commit comments

Comments
 (0)