refactoring...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2023-10-01 02:58:55 +03:00
parent 76f7a94559
commit 634eca4c86
2 changed files with 41 additions and 0 deletions

View File

@ -64,3 +64,5 @@
.editor div:focus>textarea {
background: rgba(0,0,0,0.1);
}

View File

@ -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 }