diff --git a/experiments/outline-editor/editor.js b/experiments/outline-editor/editor.js index f8a79bf..1b33bb3 100755 --- a/experiments/outline-editor/editor.js +++ b/experiments/outline-editor/editor.js @@ -29,6 +29,8 @@ function clickPoint(x,y){ // box corresponds the to desired coordinates. This accounts for nested // elements. // +// XXX with multi-line text when clicking outside the text to the left/right +// need to select the appropriate line... // XXX it would be a better idea to do a binary search instead of a liner // pass... // ...though b-search will get us to the target, we stll need to count... diff --git a/experiments/outline-editor/generic.js b/experiments/outline-editor/generic.js index 75d409e..9a64b9c 100755 --- a/experiments/outline-editor/generic.js +++ b/experiments/outline-editor/generic.js @@ -180,7 +180,6 @@ HTMLTextAreaElement.prototype.getTextOffsetAt = function(x, y){ r.setEnd(t, i) prev = rect rect = r.getBoundingClientRect() - // line change... if(prev && prev.y != rect.y){ // went off the cursor line @@ -192,21 +191,21 @@ HTMLTextAreaElement.prototype.getTextOffsetAt = function(x, y){ ?? i - 1 } // reset col col = undefined } - // cursor line... cursor_line = oy >= rect.y - clone.y && oy <= rect.bottom - clone.y - // cursor col -- set once per line... if(col == null && ox <= rect.x - clone.x){ - col = (!prev - || Math.abs(rect.x - clone.x - x) <= Math.abs(prev.x - clone.x - x)) ? + // XXX not sure about this test... + col = (ox > 0 + || i == 0) ? i : i - 1 if(cursor_line){ return col } } } + // below or right of the block -> return last col or last char... return col ?? i } diff --git a/experiments/outline-editor/index.html b/experiments/outline-editor/index.html index dcbed62..078dc07 100755 --- a/experiments/outline-editor/index.html +++ b/experiments/outline-editor/index.html @@ -56,13 +56,9 @@ var setup = function(){ - side margins are a bit too large (account for toolbat to the right) - - ## ToDo: - - DONE selecting expanded code by _click-n-drag_ - - # this is a test - string with - some extra words - - BUG: while selecting if the cursor moves to the left far enough (outside parent?) the first char in current line gets toggled... - custom element / web component - - BUG: select via click-n-drag and double/triple clicks does not work... + - BUG: select via double/triple clicks does not work... + - _looks like something is refocusing the element..._ - BUG/race: the non-value versions of custom elem seem to sometimes get loaded as empty... - DONE data interface: collapsed:: true @@ -126,6 +122,11 @@ var setup = function(){ - `` -- field marker - each child node will copy the template and allow editing of only fields - not clear how to handle template changes... + - DONE selecting expanded code by _click-n-drag_ + collapsed:: true + - # this is a test + string with + some extra words - DONE `backspace`/`delete` in block contract the field with a delay... collapsed:: true - _...looks like we are updating size on keyup..._