-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Improve the outline panel #15814
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve the outline panel #15814
Conversation
|
Your PR was set to target |
|
重启思源之后大纲能恢复吗? |
可以的,重启后localstorage依然还在的 |
This comment was marked as outdated.
This comment was marked as outdated.
- 新增 resetLevelDisplay 方法以重置层级显示状态 - 更新层级控制的初始化逻辑,默认不显示层级 - 在文档切换时重置层级显示状态
- 合并大纲存储为单一文件 outline.json
|
改为在data/storage文件夹下创建outline.json文件,只需要新建一个json来统一管理,不需要像方案二一样,新文档都新建json
|
|
outline.json 是不是会越来越大?参与同步吗? |
几百万行的json才算大,有1w文档都算超级多的了,没多少用户有这个量级 7w字的思源笔记sy文件,40w字符,才590k大小,倒是不必担心文件大小 |
|
可以加一个机制,outline.json只存储最近打开的前2000个文档,或者文档超过一年都没打开,就删除折叠标题信息,其实也没必要记住所有文档的标题折叠信息,一个文档长期不打开,就没必要记录了 |
保持当前标题展开按钮
- 超过两级折叠,也能都展开 - 如果父节点折叠,展开时自动折叠兄弟节点,只展开当前节点路径,如果父节点是展开状态,则不影响兄弟节点折叠状态
- 确保父标题保持展开状态 - 保存展开状态到持久化存储 - 移除冗余的状态保存逻辑
|
@Achuan-2 我和 V 开始 review 了 |
保持当前标题展开按钮、支持大纲筛选、标题添加右键菜单|
推迟到 v3.3.6 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR significantly enhances the outline panel with persistent storage, search filtering, level expansion controls, and comprehensive context menu functionality.
- Persistent storage: Document outline fold states are now saved to
data/storage/outline.jsonand restored when reopening documents - Enhanced UI controls: Added search filtering, level-based expansion, and "keep current heading expanded" functionality
- Context menu integration: Right-click menus for heading operations like upgrade/downgrade, copy/cut with children, and insert operations
Reviewed Changes
Copilot reviewed 19 out of 19 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| kernel/model/storage.go | Implements backend storage for outline states with 2000 document limit |
| kernel/api/storage.go | Adds API endpoints for outline storage operations |
| kernel/api/router.go | Registers new outline storage API routes |
| app/src/util/Tree.ts | Enhances tree component with right-click expand/collapse and toggle callbacks |
| app/src/protyle/util/compatibility.ts | Updates default storage structure for outline |
| app/src/layout/dock/Outline.ts | Major overhaul adding filtering, context menus, level expansion, and persistence |
| app/appearance/langs/*.json | Adds localized strings for new outline features |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Signed-off-by: Daniel <[email protected]>
Signed-off-by: Daniel <[email protected]>
|
后续问题:#16121 |
|
无敌了这个pr,感谢川佬 |


实现标题大纲持久化、展开特定级别标题、添加
保持当前标题展开按钮、支持大纲筛选、标题添加右键菜单功能改进
大纲持久化
关联:持久化文档大纲状态 #12387
data/storage文件夹下创建outline.json文件,记录文档展开的标题ID,最多记录2000个文档支持alt click标题图标折叠/展开同级标题
新增标题展开特定层级按钮
关联:The outline panel supports expansion by the specified level #11533
新增
保持当前标题展开按钮,保持全部展开改为全部展开按钮为什么要改进
保持全部展开这个功能我感觉用处不大,还很容易让用户以为就是普通的全部展开按钮,不知道是会一直持续起作用的,而且很多时候是不需要一直保持全部展开状态的,只是需要展开当前编辑的标题个人觉得把
保持全部展开改为普通的全部展开,然后新增一个保持当前标题展开会更有用,就是当前我编辑这个标题,标题大纲定位到这个标题,就会自动展开到当前标题,把父标题都展开,不影响其他标题,这样就算一直起作用影响也小一点,不至于标题全部都展开了保持当前标题展开功能右键click点击折叠图标,会折叠/展开所有子标题
大纲支持筛选功能
支持右键菜单