Enable numeric sorting on file list
This commit is contained in:
@@ -184,7 +184,7 @@ const sort_children = children => {
|
|||||||
if (a.type !== b.type) {
|
if (a.type !== b.type) {
|
||||||
return a.type === "dir" ? -1 : 1
|
return a.type === "dir" ? -1 : 1
|
||||||
}
|
}
|
||||||
return a.name.localeCompare(b.name, "default", {numeric: true})
|
return a.name.localeCompare(b.name, undefined, {numeric: true})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -9,8 +9,7 @@
|
|||||||
//
|
//
|
||||||
// on_error is called when the upload has failed. The parameters are the error
|
// on_error is called when the upload has failed. The parameters are the error
|
||||||
|
|
||||||
import { fs_get_node, fs_mkdirall } from "../FilesystemAPI"
|
import { fs_path_url } from "../FilesystemUtil"
|
||||||
import { fs_path_url, fs_split_path } from "../FilesystemUtil"
|
|
||||||
|
|
||||||
// code and an error message
|
// code and an error message
|
||||||
export const upload_file = async (file, path, on_progress, on_success, on_error) => {
|
export const upload_file = async (file, path, on_progress, on_success, on_error) => {
|
||||||
|
@@ -160,9 +160,9 @@ const sortBy = (field) => {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (currentSortAscending) {
|
if (currentSortAscending) {
|
||||||
return fieldA.localeCompare(fieldB)
|
return fieldA.localeCompare(fieldB, undefined, {numeric: true})
|
||||||
} else {
|
} else {
|
||||||
return fieldB.localeCompare(fieldA)
|
return fieldB.localeCompare(fieldA, undefined, {numeric: true})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
Reference in New Issue
Block a user