mirror of
https://codeberg.org/yeentown/barkey.git
synced 2025-04-29 18:16:58 +00:00
Create CustomEmojiFolderTree nodes with correct path (fixes #25)
This commit is contained in:
parent
cfa273adfa
commit
38fec5f18f
1 changed files with 3 additions and 1 deletions
|
@ -186,11 +186,13 @@ function parseAndMergeCategories(input: string, root: CustomEmojiFolderTree): Cu
|
||||||
const parts = input.split('/').map(p => p.trim());
|
const parts = input.split('/').map(p => p.trim());
|
||||||
let currentNode: CustomEmojiFolderTree = root;
|
let currentNode: CustomEmojiFolderTree = root;
|
||||||
|
|
||||||
|
let currentPath = [];
|
||||||
for (const part of parts) {
|
for (const part of parts) {
|
||||||
|
currentPath.push(part);
|
||||||
let existingNode = currentNode.children.find((node) => node.value === part);
|
let existingNode = currentNode.children.find((node) => node.value === part);
|
||||||
|
|
||||||
if (!existingNode) {
|
if (!existingNode) {
|
||||||
const newNode: CustomEmojiFolderTree = { value: part, category: input, children: [] };
|
const newNode: CustomEmojiFolderTree = { value: part, category: currentPath.join("/"), children: [] };
|
||||||
currentNode.children.push(newNode);
|
currentNode.children.push(newNode);
|
||||||
existingNode = newNode;
|
existingNode = newNode;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue