From 03b308391f3c65d6bf1329a2ae9dc8c3b4b53c34 Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Sun, 29 Oct 2023 16:16:21 +0300 Subject: [PATCH] notes + fixes and tweaks... Signed-off-by: Alex A. Naanou --- experiments/outline-editor/editor.js | 13 +++++++------ experiments/outline-editor/index.html | 12 +++++++++--- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/experiments/outline-editor/editor.js b/experiments/outline-editor/editor.js index 61a8396..8043077 100755 --- a/experiments/outline-editor/editor.js +++ b/experiments/outline-editor/editor.js @@ -1781,22 +1781,23 @@ var Outline = { this.Block('next')) } }, Enter: function(evt){ var edited = this.get('edited') - // edit -> split text... if(edited){ if(evt.ctrlKey || evt.shiftKey){ return } + // split text... evt.preventDefault() var a = edited.selectionStart var b = edited.selectionEnd var prev = edited.value.slice(0, a) var next = edited.value.slice(b) edited.value = prev - this.Block('next') - edited = this.edit('next') - edited.value = next - edited.selectionStart = 0 - edited.selectionEnd = 0 + this.Block({text: next}, 'next') + // focus next if not at position 0, otherwise keep focus... + if(a != 0){ + edited = this.edit('next') + edited.selectionStart = 0 + edited.selectionEnd = 0 } return } // view -> edit... evt.preventDefault() diff --git a/experiments/outline-editor/index.html b/experiments/outline-editor/index.html index 4ee80c6..72e2b9c 100755 --- a/experiments/outline-editor/index.html +++ b/experiments/outline-editor/index.html @@ -52,7 +52,12 @@ var setup = function(){ - this node has a second empty line - this is a sibling to the above node - - _see code_ + - BUG: undo: does not handle element splitting correctly... + - place cursor somewhere here, hit `Enter`, and then undo. + - _this will correctly restore the old node but will not remove the new one_ + - need to: + - add undo to `.Block(..)` + - group `new` and `cange` into one undo action... - BUG: mobile browsers behave quite chaotically ignoring parts of the styling... - FF: - zooming on edited field @@ -61,8 +66,6 @@ var setup = function(){ - side margins are a bit too large (account for toolbat to the right) - - ## ToDo: - - might be a good idea to focus the prev (empty) node if pressing `Enter` at 0 position - - <- place cursor here and press enter - editor as a custom element / web component - DONE data interface: collapsed:: true @@ -127,6 +130,9 @@ var setup = function(){ - empty item height is a bit off... - search? - _...not sure if search should be internal or external yet..._ + - DONE might be a good idea to focus the prev (empty) node if pressing `Enter` at 0 position + collapsed:: true + - <- place cursor here and press enter - DONE make `---` block not show list bullets... - DONE: undo: checkboxes and DONE?? collapsed:: true