From dae6fae3d666e8b4434498972845041b00031de6 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Fri, 2 Aug 2019 13:45:52 +0200 Subject: [PATCH] describe caret nodes --- docs/ciderEditor.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docs/ciderEditor.md b/docs/ciderEditor.md index ae08d3a445..2448be852a 100644 --- a/docs/ciderEditor.md +++ b/docs/ciderEditor.md @@ -55,6 +55,13 @@ with the new model state, see `renderModel` in `render.js` for this. If the model didn't reject the input and didn't make any additional changes, this won't make any changes to the DOM at all, and should thus be fairly efficient. +For the browser to allow the user to place the caret between two pills, +or between a pill and the start and end of the line, we need some extra DOM nodes. +These DOM nodes are called caret nodes, and contain an invisble character, so +the caret can be placed into them. The model is unaware of caret nodes, and they +are only added to the DOM during the render phase. Likewise, when calculating +the content string, caret nodes need to be ignored, as they would confuse the model. + As part of the reconciliation, the caret position is also adjusted to any changes the model made to the input. The caret is passed around in two formats. The model receives the caret *offset* within the content string (which includes