UX: Prevent last child from being deleted?

未关闭
#125 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
35/100
Issue 类型
功能
描述清晰度
需要澄清
活跃度
冷清
技术栈
javascript
领域
frontend

调研方向

未指定任何文件、测试或入口点。将提议的数据层不变量与禁止会清空节点数组的用户操作进行比较,然后定义所需行为,并验证删除最后一个子节点后,列表节点对用户来说仍然显示为空。

由索引模型根据 Issue 内容生成。

描述

E.g. take a list node. When you delete the last child, it's no longer clear to the user they are working with a list node. If I could prevent the deletion of the last remaining node (instead keep just an empty one) this would probably feel better to the user.

Implementation ideas:

  • allow_empty definition for node_array prop
    • when true then each time a node_array is manipulated it in the ops, it will auto-fill an empty default
    • e.g. if you created a list node with an empty list_items array it would auto fill.
    • or alternatively: throw when that invariant is violated before commiting a transaction
  • another approach would be not to touch the data layer (empty node_arrays are allowed) but just forbid the actions that could make it empty (user input) e.g. when you have the node cursor after the last item and press backspace, or when the last item is an empty text element and you have the text cursor there and press backspace (this would also lead to an empty list.list_items)

Downsides:

  • Creates some special edge cases data-model wise

Priority: Low, lets see if users really struggle with this.

主要语言
TypeScript
星标
1.8k
派生
148
平均合并
2 小时 47 分钟
30 天内合并 PR
13

环境准备

  • 提供 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 没有贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

michael/editable 的其他 Issue

查看 michael/editable 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。