mirror of
https://github.com/marktext/marktext.git
synced 2025-05-04 03:32:36 +08:00
* fix: #438 to sort files in folder * Change to use localeCompare as per review
This commit is contained in:
parent
230c90c920
commit
68be52a87d
1
.github/CHANGELOG.md
vendored
1
.github/CHANGELOG.md
vendored
@ -141,6 +141,7 @@ foo<section>bar</section>zar
|
|||||||
- Mark Text didn't remove highlight when I delete the markdown symbol like * or `. (#893)
|
- Mark Text didn't remove highlight when I delete the markdown symbol like * or `. (#893)
|
||||||
- After delete ``` at the beginning to paragraph by backspace, then type other text foo, the color will be strange, if you type 1. bar. error happened. (#892)
|
- After delete ``` at the beginning to paragraph by backspace, then type other text foo, the color will be strange, if you type 1. bar. error happened. (#892)
|
||||||
- Fix highlight error in code block (#545 #890)
|
- Fix highlight error in code block (#545 #890)
|
||||||
|
- Fix files sorting in folder (#438)
|
||||||
|
|
||||||
### 0.13.65
|
### 0.13.65
|
||||||
|
|
||||||
|
@ -28,7 +28,9 @@ const getters = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (state.projectTree) travel(state.projectTree)
|
if (state.projectTree) travel(state.projectTree)
|
||||||
return files.sort()
|
files.sort((f1, f2) => f1.name.localeCompare(f2.name))
|
||||||
|
|
||||||
|
return files
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,9 +56,17 @@ export const addFile = (tree, file) => {
|
|||||||
// Add file to related directory
|
// Add file to related directory
|
||||||
if (!currentFolder.files.find(f => f.name === name)) {
|
if (!currentFolder.files.find(f => f.name === name)) {
|
||||||
file.id = getUniqueId()
|
file.id = getUniqueId()
|
||||||
|
|
||||||
|
const idx = currentFolder.files.findIndex(f => {
|
||||||
|
return f.name.localeCompare(name) > 0
|
||||||
|
})
|
||||||
|
if (idx !== -1) {
|
||||||
|
currentFolder.files.splice(idx, 0, file)
|
||||||
|
} else {
|
||||||
currentFolder.files.push(file)
|
currentFolder.files.push(file)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a new directory to the tree list.
|
* Add a new directory to the tree list.
|
||||||
|
Loading…
Reference in New Issue
Block a user