mirror of
				https://codeberg.org/yeentown/barkey.git
				synced 2025-11-04 07:24:13 +00:00 
			
		
		
		
	Create CustomEmojiFolderTree nodes with correct path
This commit is contained in:
		
							parent
							
								
									fed5ff50b3
								
							
						
					
					
						commit
						ef60a1a8ed
					
				
					 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());
 | 
			
		||||
	let currentNode: CustomEmojiFolderTree = root;
 | 
			
		||||
 | 
			
		||||
	let currentPath = [];
 | 
			
		||||
	for (const part of parts) {
 | 
			
		||||
		currentPath.push(part);
 | 
			
		||||
		let existingNode = currentNode.children.find((node) => node.value === part);
 | 
			
		||||
 | 
			
		||||
		if (!existingNode) {
 | 
			
		||||
			const newNode: CustomEmojiFolderTree = { value: part, category: input, children: [] };
 | 
			
		||||
			const newNode: CustomEmojiFolderTree = { value: part, category: currentPath.join("/"), children: [] };
 | 
			
		||||
			currentNode.children.push(newNode);
 | 
			
		||||
			existingNode = newNode;
 | 
			
		||||
		}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue