feat: enhance add_nodes method to support nested children structure#671
Merged
hizzgdev merged 12 commits intoSep 18, 2025
Merged
Conversation
- Add recursive processing for nested children in add_nodes method - Support standard jsMind formats: node_tree, node_array, and freemind - Maintain full backward compatibility with existing legacy format - Optimize performance with single UI refresh after batch operations - Add comprehensive test coverage for all formats and edge cases - Include detailed documentation for new nested structure capabilities The enhanced add_nodes method now supports: - Deep nesting with unlimited levels - Mixed format processing in single operation - Custom attribute preservation from all formats - Error handling for malformed data structures - Performance optimization for large datasets This enhancement enables direct import of complex hierarchical data while preserving all existing functionality and API compatibility.
Contributor
Author
hizzgdev
reviewed
Sep 12, 2025
Contributor
Author
重构了一下这个方法,因为周末在家是Windows电脑,所以需要加一下cross依赖用来运行script。 |
Owner
你看 example/demo.html 这里面引用的是 es6 目录里的文件,你在本地用 |
hizzgdev
reviewed
Sep 13, 2025
Contributor
Author
@hizzgdev 重新CR下 |
Contributor
Author
@hizzgdev 麻烦再CR下 |
hizzgdev
reviewed
Sep 15, 2025
hizzgdev
reviewed
Sep 15, 2025
Contributor
Author
|
麻烦再cr下 @hizzgdev |
hizzgdev
approved these changes
Sep 18, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
This PR enhances the
add_nodesmethod to support nested children structures from all major jsMind data formats (node_tree, node_array, and freemind), while maintaining complete backward compatibility.Key Features
✅ Backward Compatibility
🌳 Nested Structure Support
childrenarrays with recursive processing📊 Multiple Format Support
⚡ Performance Optimized
Usage Examples
Legacy Format (Unchanged)
New Nested Format
Technical Implementation
New Methods Added
_add_nodes_recursive(parent_node, node_data): Recursively process nodes and children_extract_node_tree_subnode(node_data): Extract children from various formatsFormat Detection
The method automatically detects the format:
node_data.childrenexists and is an arrayBenefits
For Developers
For Applications
Testing
The enhancement includes comprehensive tests covering:
Files Changed
src/jsmind.js: Enhanced add_nodes method with nested supporttests/unit/jsmind.test.js: Comprehensive test coveragedocs/add_nodes_enhancement.md: Detailed documentationMigration
No Changes Required
Existing code continues to work without any modifications.
Optional Enhancements
To take advantage of new features, developers can now directly use nested data structures instead of manually flattening them.
This enhancement makes jsMind's
add_nodesmethod significantly more powerful while maintaining complete backward compatibility.