From 634eca4c86bebc88474ba5fa4867826301887c68 Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Sun, 1 Oct 2023 02:58:55 +0300 Subject: [PATCH] refactoring... Signed-off-by: Alex A. Naanou --- experiments/outline-editor/editor.css | 2 ++ experiments/outline-editor/editor.js | 39 +++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) diff --git a/experiments/outline-editor/editor.css b/experiments/outline-editor/editor.css index 28b6349..9ea187f 100755 --- a/experiments/outline-editor/editor.css +++ b/experiments/outline-editor/editor.css @@ -64,3 +64,5 @@ .editor div:focus>textarea { background: rgba(0,0,0,0.1); } + + diff --git a/experiments/outline-editor/editor.js b/experiments/outline-editor/editor.js index b3cf538..d22099b 100755 --- a/experiments/outline-editor/editor.js +++ b/experiments/outline-editor/editor.js @@ -26,6 +26,36 @@ var atLine = function(elem, index){ //--------------------------------------------------------------------- + +var Node = { + dom: undefined, + document: undefined, + + get: function(){}, + + get root(){}, + get parent(){}, + get children(){}, + get next(){}, + get prev(){}, + + focus: function(){}, + edit: function(){}, + + indent: function(){ }, + deindent: function(){ }, + toggleCollapse: function(){ }, + + remove: function(){}, + + json: function(){}, + text: function(){}, + + load: function(){}, +} + + +// XXX might be a good idea to do a view-action model... var Outline = { dom: undefined, @@ -191,6 +221,8 @@ var Outline = { if(parent){ parent.append(cur) } } return cur }, + deindent: function(node='focused', indent=false){ + return this.indent(node, indent) }, toggleCollapse: function(node='focused', state='next'){ var that = this if(node == 'all'){ @@ -217,6 +249,10 @@ var Outline = { elem.updateSize() } } return node }, + // XXX + remove: function(node){ + }, + // block serialization... __code2html__: function(code){ return code }, @@ -351,6 +387,9 @@ var Outline = { next?.focus() }, // select... + // XXX add: + // ctrl-A + // ctrl-D ' ': function(evt){ if(this.get('edited') != null){ return }