Repository navigation
feat(reader): 概念栏内直接删除概念,子概念接回上一层 - #6
Open
liujieranjerry-lgtm wants to merge 1 commit into
Open
liujieranjerry-lgtm wants to merge 1 commit into
liujieranjerry-lgtm wants to merge 1 commit into
Conversation
Removing a concept previously required opening its card. Each drawer row now carries a delete affordance with an inline confirmation, and the server promotes the deleted card's children to its own parent so no stored card keeps a dangling parentId.
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.
问题
概念只能从卡片里删除:右侧「概念」栏的每一行点下去只会打开卡片,要删一条得先打开卡片、再点卡片底部的删除。读者在概念栏做清理时,每一删都要多一次开卡动作。
改动
src/client/app.js概念栏的每一行加了删除入口:rd-row-delete),点击stopPropagation,不会顺手把卡片打开;rd-drawer-confirm):「确定从概念栏删除?」+「从它下钻的概念会接到它的上一层」,按钮为rd-danger的「删除」与「取消」;removeConcept现在同时清掉确认态、出现位置浮层与编辑态,只保留一处删除入口。index.js的concept/delete增加子概念接回上一层:删除前记下removed,删除后把所有parentId === 被删 id的概念改指removed.parentId(若该父已不存在则置null)。目的是不留悬空parentId——src/client/concepts.js:conceptChain与src/client/mindmap.js都按 id 走 parentId,悬空指针会让面包屑与思维导图出现断链。src/client/styles.js/src/client/i18n.js:行头 flex 布局、× 的弱化样式、rd-danger配色、三段中英文文案。二阶影响(直接后果之外)
parentId。conceptChain不会返回残缺链,思维导图不会出现指向不存在节点的边;配合 PR fix(reader): 嵌套解释带上层语境,命中祖先时不再自循环 #5 的ancestorChain(本身已能容忍缺失 id),嵌套解释链路仍然有效。opacity:.55,列表仍然可扫读。deleteConceptId、occurrencesOpen、conceptEdit,避免出现指向已删 id 的确认条或「出现位置」浮层。三阶影响
removeConcept一个出口,将来加撤销只需要在这里记录被删对象(确认条已经能拿到完整 concept)。mergeStore因为 revision 相同且引用相同而 bail out,界面不刷新。这提醒客户端约定——mutation 必须返回新的 store 对象,测试桩已按此实现(snapshot()深拷贝 + revision 递增)。有意未做
验证
node --test test/*.test.mjs→ 249/249,其中新增:test/concept-delete.test.mjs(jsdom,2 例):行内 × 不打开卡片、确认后只发一次concept/delete、行消失且其它概念保留、确认条关闭;取消后不删除、行仍在。test/host.test.mjs+1 例:删除中间节点后孙子接到祖父,删除根后置null。node eval/run.mjs→ 13/13;node eval/layout-host.mjs→ 6/6。node eval/visual.mjs→ 120/121,唯一失败是既有的markdown relative images load through the file route(干净的 upstream 上同样失败,环境问题)。新增两个真实浏览器场景:行内删除入口打开确认条且不打开卡片;取消后概念保留。05b-concepts-scope基线因多出 × 而更新,其余基线未动。client.js已用node scripts/build-client.mjs重新生成(274123 bytes 字符串长度),构建确定性、工作区干净。服务端
index.js的 explain 路径未改动。