feat: comments#12672
Conversation
There was a problem hiding this comment.
Pull request overview
This PR introduces a built-in block-level Comments feature for DB graphs. It adds a new :logseq.class/Comments tag and :logseq.property.comments/blocks property (with a schema migration to 65.28), a comments component/model pair, a comments handler, a /Add comment slash command + ctrl+space shortcut, an action-bar button and context-menu entries to add comments, plus extensive editor changes so navigation/indent/move/expand-collapse/slash-commands behave correctly around comment areas. Block-rendering, drag-and-drop, asset paste, and graph-view filtering are updated to recognize and protect the new comment containers.
Changes:
- Add a Comments tag/property/migration and surface a comments UI (component, handler, CSS, i18n strings, slash command, shortcut, action bar/context menu).
- Teach editor logic (move/indent/outdent/up-down/expand-collapse/slash/navigation) and DnD to skip or protect comment areas and their children, including a new
navigable-sibling-blockhelper. - Extend
db-based-save-assets!with an explicit:target-blockand add outliner deletion cleanup of orphaned range-comment areas; add many cljs tests for the new behaviors.
Reviewed changes
Copilot reviewed 30 out of 30 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| deps/db/src/logseq/db/frontend/class.cljs | Add built-in :logseq.class/Comments class. |
| deps/db/src/logseq/db/frontend/property.cljs | Add :logseq.property.comments/blocks and register logseq.property.comments namespace. |
| deps/db/src/logseq/db/frontend/schema.cljs | Bump schema version to 65.28. |
| deps/db/test/logseq/db/frontend/property_test.cljs | Tests for the new built-in property. |
| deps/outliner/src/logseq/outliner/core.cljs | Cascade-delete orphaned range comments when all targets are deleted. |
| deps/outliner/test/logseq/outliner/core_test.cljs | Tests for orphan range-comment deletion behavior. |
| src/main/frontend/commands.cljs | New /Add comment slash command and step handler. |
| src/main/frontend/common/graph_view.cljs | Filter the new Comments class from graph view. |
| src/main/frontend/components/block.cljs | Render comments-area inline, comment-thread button, draggable guards. |
| src/main/frontend/components/block.css | Styles for comments area, rows, actions, reply box. |
| src/main/frontend/components/block/comments.cljs | New comments UI components (box, rows, area view). |
| src/main/frontend/components/block/comments_model.cljs | New comments model/helpers (drafts, formatting, guards). |
| src/main/frontend/components/content.cljs | Add "Add comment" entries to context menus. |
| src/main/frontend/components/selection.cljs | Add comment action to selection action bar. |
| src/main/frontend/components/views.cljs | Suppress outliner-only actions in table selection bar. |
| src/main/frontend/handler/block.cljs | Skip comment-protected blocks during indent/outdent. |
| src/main/frontend/handler/comments.cljs | New comments handler (ensure area, insert/save/delete, paste assets). |
| src/main/frontend/handler/dnd.cljs | Block moves involving protected comment blocks. |
| src/main/frontend/handler/editor.cljs | Comment-aware navigation, slash suppression, expand/collapse guard, asset target-block. |
| src/main/frontend/handler/editor/lifecycle.cljs | Respect new :skip-focus? editor config. |
| src/main/frontend/handler/events.cljs | Register :editor/add-comment event. |
| src/main/frontend/modules/shortcut/config.cljs | New mod+alt+c shortcut + category registration. |
| src/main/frontend/worker/db/migrate.cljs | Migrations adding the Comments class and blocks property. |
| src/resources/dicts/en.edn, zh-cn.edn | i18n strings for comments. |
| src/test/* | New/expanded tests for editor, migrate, comments-model, comments handler. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
https://www.loom.com/share/bc2c25ee80ae43ccb514e991401ce0ef