From 6b0a23aa11c2f2af2e9bf18084915a814fbd5b62 Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Sat, 28 Oct 2023 02:42:47 +0300 Subject: [PATCH] working on selection... Signed-off-by: Alex A. Naanou --- experiments/outline-editor/editor.js | 23 ++++++++++++++++++++++- experiments/outline-editor/index.html | 2 +- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/experiments/outline-editor/editor.js b/experiments/outline-editor/editor.js index 907e770..a6fb293 100755 --- a/experiments/outline-editor/editor.js +++ b/experiments/outline-editor/editor.js @@ -1856,7 +1856,7 @@ var Outline = { this.remove(edited) return } }, - c_d: function(evt){ + a_x: function(evt){ // toggle done... evt.preventDefault() tasks.toggleDone(this) }, @@ -1866,6 +1866,15 @@ var Outline = { // - should we select the .block or .text??? // - we should remember the first state and apply it (a-la FAR) // and not simply toggle on/off per node... + Shift: function(evt){ + if(this.get('edited')){ + return } + // XXX set selection mode + // ...need to reset this when shift key is released... + // one way to do this is to save a press id and reset + // it each call -- if the id has changed since lass s-up + // is pressed then reset mode... + }, s_ArrowUp: function(evt){ if(this.get('edited')){ return } @@ -1882,6 +1891,18 @@ var Outline = { elem.removeAttribute('selected') : elem.setAttribute('selected', '') this.keyboard.ArrowDown.call(this, evt) }, + c_d: function(evt){ + if(this.get('edited')){ + return } + evt.preventDefault() + for(var e of this.get('selected')){ + e.removeAttribute('selected') } }, + c_a: function(evt){ + if(this.get('edited')){ + return } + evt.preventDefault() + for(var e of this.get('all')){ + e.setAttribute('selected', '') } }, // toggle checkbox... ' ': function(evt){ diff --git a/experiments/outline-editor/index.html b/experiments/outline-editor/index.html index da32372..abda229 100755 --- a/experiments/outline-editor/index.html +++ b/experiments/outline-editor/index.html @@ -214,7 +214,7 @@ | c-left | prev checkbox | | c-right | next checkbox | | space | toggle current checkbox | - | c-d | toggle current element DONE | + | a-x | toggle current element DONE | | c-z | normal: undo | | c-s-z | normal: redo | | c | normal: crop current node |