diff --git a/experiments/outline-editor/editor.js b/experiments/outline-editor/editor.js index a2b8922..2fad816 100755 --- a/experiments/outline-editor/editor.js +++ b/experiments/outline-editor/editor.js @@ -1051,6 +1051,7 @@ var Outline = { // crop... + // XXX add crop/path indicator... __crop_stack: undefined, crop: function(node='focused'){ var stack = this.__crop_stack ??= [] @@ -1328,6 +1329,7 @@ var Outline = { cur[place](block) : undefined } return block }, + // XXX see inside... load: function(data){ var that = this data = typeof(data) == 'string' ? @@ -1348,9 +1350,12 @@ var Outline = { .clear() .outline .append(...level(data)) + //* XXX do we actually need this??? // update sizes of all the textareas (transparent)... - for(var e of [...this.outline.querySelectorAll('textarea')]){ - e.updateSize() } + setTimeout(function(){ + for(var e of [...that.outline.querySelectorAll('textarea')]){ + e.updateSize() } }, 0) + //*/ // restore focus... this.focus() return this }, @@ -1374,7 +1379,6 @@ var Outline = { right: function(){}, // XXX move the code here into methods/actions... - // XXX add scrollIntoView(..) to nav... // XXX use keyboard.js... keyboard: { // vertical navigation... @@ -1397,7 +1401,7 @@ var Outline = { var edited = this.get('edited') if(edited){ var {line, lines} = edited.getTextGeometry() - if(line == lines -1){ + if(line == lines - 1){ evt.preventDefault() that.focus('edited', 'next') } } else { diff --git a/experiments/outline-editor/generic.js b/experiments/outline-editor/generic.js index f70524a..ea5e06b 100755 --- a/experiments/outline-editor/generic.js +++ b/experiments/outline-editor/generic.js @@ -75,9 +75,12 @@ HTMLTextAreaElement.prototype.getTextGeometry = function(){ document.body.append(span) + var padding = parseFloat(style.paddingTop) + parseFloat(style.paddingBottom) var res = { length: text.length, - lines: Math.floor(this.offsetHeight / carret.offsetHeight), + lines: Math.floor( + (this.offsetHeight - padding) + / carret.offsetHeight), line: Math.floor(carret.offsetTop / carret.offsetHeight), offset: offset, offsetLeft: carret.offsetLeft, diff --git a/experiments/outline-editor/index.html b/experiments/outline-editor/index.html index 6c302e2..76c9fd3 100755 --- a/experiments/outline-editor/index.html +++ b/experiments/outline-editor/index.html @@ -40,6 +40,7 @@ var setup = function(){ - Logseq - Conboy (Nokia N900's Tomboy clone) - Bonsai (on PalmOS) + - Google Keep - - // Seems that I unintentionally implemented quite a chunk of the markdown spec ;) - @@ -245,6 +246,7 @@ var setup = function(){ - z - c - > quote + id::quote-example - Notes - NOTE: a note text - NOTE: