Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2023-12-12 02:27:45 +03:00
parent b0dc4a39cc
commit 1400050cef
2 changed files with 9 additions and 6 deletions

View File

@ -44,7 +44,7 @@ var getCharOffset = function(elem, x, y, data){
?? 0 ?? 0
// text node... // text node...
if(e instanceof Text){ if(e instanceof Text){
/* XXX not needed wit getText(..) /* XXX GETTEXT: not needed wit getText(..)
// count "virtual" newlines between text and block elements... // count "virtual" newlines between text and block elements...
if(data.prev_elem == 'block'){ if(data.prev_elem == 'block'){
data.c += 1 } data.c += 1 }
@ -103,7 +103,7 @@ var getCharOffset = function(elem, x, y, data){
&& ' \t\n'.includes(data.last)){ && ' \t\n'.includes(data.last)){
return data.c - 1 } return data.c - 1 }
/* XXX not needed wit getText(..) /* XXX GETTEXT: not needed wit getText(..)
// count "virtual" newlines between text and block elements... // count "virtual" newlines between text and block elements...
var type = getComputedStyle(e).display var type = getComputedStyle(e).display
var block = [ var block = [
@ -127,7 +127,7 @@ var getCharOffset = function(elem, x, y, data){
// handle the node... // handle the node...
data = getCharOffset(e, x, y, data) data = getCharOffset(e, x, y, data)
/* XXX not needed wit getText(..) /* XXX GETTEXT: not needed wit getText(..)
// compensate for table stuff... // compensate for table stuff...
if(type == 'table-row'){ if(type == 'table-row'){
data.c -= 1 } data.c -= 1 }

View File

@ -48,7 +48,8 @@ var setup = function(){
- -
- ## Bugs: - ## Bugs:
focused:: true focused:: true
- BUG: caret positioning broken - DONE BUG: caret positioning broken (ASAP CLEANUP: GETTEXT)
collapsed:: true
- Strategies to test:: - Strategies to test::
- ASAP use `getText(..)` to build the input text instead of `.innerText` - ASAP use `getText(..)` to build the input text instead of `.innerText`
- DONE adds 1 char offset per block element - DONE adds 1 char offset per block element
@ -58,10 +59,13 @@ var setup = function(){
- try and build offset maps on parse - try and build offset maps on parse
_(potentially too complicated)_ _(potentially too complicated)_
- *TODO*:: - *TODO*::
- *DONE*::
collapsed:: true
- ``` - ```
text text text text text text
``` ```
text text text (a click here is offset right) text text text (a click here is offset right)
collapsed:: true
- the offset's amount depends on where in the text we click after the code block, the farther right the greater the offset... - 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(..)` - `getCharOffset(..)` produces correct results, the problem is in `getMarkdownOffset(..)`
- text text text - text text text
@ -69,6 +73,7 @@ var setup = function(){
block element block element
</div> </div>
this line, and above placement of completely broken this line, and above placement of completely broken
collapsed:: true
- the odd thing is that a nested (bug) qupted text below also breaks... - the odd thing is that a nested (bug) qupted text below also breaks...
- _this seems to be an issue with: `.getMarkdownOffset(..)`_ - _this seems to be an issue with: `.getMarkdownOffset(..)`_
- ``` - ```
@ -83,8 +88,6 @@ var setup = function(){
this returns `69` while it should return `5` this returns `69` while it should return `5`
_...replacing `\n\n\n` with `\n\n` seems to fix the issue (also works with spaces)_ _...replacing `\n\n\n` with `\n\n` seems to fix the issue (also works with spaces)_
(BUG also the above line is not italic -- can't reproduce) (BUG also the above line is not italic -- can't reproduce)
- *DONE*::
collapsed:: true
- text text text - text text text
- text text text - text text text
text text text text text text