exploring new ctretegies to fix a very annoying bug...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2023-12-07 22:50:05 +03:00
parent 4ef1be394c
commit 71b365c8d7
2 changed files with 18 additions and 7 deletions

View File

@ -191,6 +191,15 @@ var getMarkdownOffset = function(markdown, text, i){
return map[i] } return map[i] }
//*/ //*/
getText = function(elem, res=[]){
for(var n of elem.childNodes){
if(n.nodeType == n.TEXT_NODE){
res.push(n.textContent)
} else {
getText(n, res) } }
return res }
//--------------------------------------------------------------------- //---------------------------------------------------------------------

View File

@ -48,15 +48,14 @@ var setup = function(){
- -
- ## Bugs: - ## Bugs:
focused:: true focused:: true
- BUG: caret placement is off again...
- ```
text text text
```
text text text (a click here is offset right)
- the offset's amount depends on where in the text we click after the code block, the farther right the greater the offset...
- this seems to be the same as the below `div` case... (TEST)
- BUG: caret positioning broken - BUG: caret positioning broken
- *TODO*:: - *TODO*::
- ```
text text text
```
text text text (a click here is offset right)
- the offset's amount depends on where in the text we click after the code block, the farther right the greater the offset...
- `getCharOffset(..)` produces correct results, the problem is in `getMarkdownOffset(..)`
- text text text - text text text
<div> <div>
block element block element
@ -82,6 +81,9 @@ var setup = function(){
- text text text - text text text
text text text text text text
text text text text text text
- text text text
text &amp; text &amp; text
text text text
- M - M
M can't place cursor before first char M can't place cursor before first char
M M