协同文档
Collaborative Editing Documents
文章
Collaborative Editing in CodeMirror
作者谈及在给 CodeMirror 6 选择协同编辑支持方案时的一些考虑。
依旧使用了 ProseMirror 在用的 OT 模型,而不是 CRDT,对于文档协同来说,支持真正的分布式可能没那么重要。
CRDT 表示太过复杂,且(给每一个字符分配一个对象的方案)内存占用很高,不决定将其作为内建的基础数据模型。
So for the core of a JavaScript-based library, I decided that support for a distributed model wasn't important enough to justify the additional complexity
Operational Transformation 是一种 hack ? 当文档结构比纯文本更复杂,很难定义一种正确收敛的转换函数。
The main problem is that this technique is hard to reason about. It has many practical advantages but, being a hack, doesn't provide the kind of mental framework that would allow you to confidently apply it in different situations.
提出一些 OT 不是很好处理的场景,例如 Mapped position 很难处理
This is kind of weird. It took me a while to accept that we can make documents converge, but not positions, which are so much simpler. The explanation for that is, I guess, that for document maintenance, what is inside deleted ranges becomes irrelevant as soon as those ranges are deleted, whereas position mapping, to be robust, would still need to be able to compare positions inside such ranges.