From ad776fbfca8559747c3dc9f6c040c09ebcfee3c9 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Fri, 2 Aug 2019 13:45:35 +0200 Subject: [PATCH] describe all reasons why we need a custom textify algorithm --- docs/ciderEditor.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/ciderEditor.md b/docs/ciderEditor.md index 93751b590a..ae08d3a445 100644 --- a/docs/ciderEditor.md +++ b/docs/ciderEditor.md @@ -16,8 +16,10 @@ The parts are then reconciled with the DOM. When typing in the `contenteditable` element, the `input` event fires and the DOM of the editor is turned into a string. The way this is done has -some logic to it to deal with adding newlines for block elements, ... -so doesn't use `innerText`, `textContent` or anything similar. +some logic to it to deal with adding newlines for block elements, to make sure +the caret offset is calculated in the same way as the content string, and the ignore +caret nodes (more on that later). +For these reasons it doesn't use `innerText`, `textContent` or anything similar. The model addresses any content in the editor within as an offset within this string. The caret position is thus also converted from a position in the DOM tree to an offset in the content string. This happens in `getCaretOffsetAndText` in `dom.js`.