(.*)<\/i>/g, '_$1_') },
// serialization...
json: function(node){
var that = this
- node ??= this.dom
+ node ??= this.outline
return [...node.children]
.map(function(elem){
return elem.nodeName != 'DIV' ?
@@ -318,7 +342,14 @@ var Outline = {
return text },
// XXX use .__code2html__(..)
- load: function(){},
+ load: function(data){
+ // text...
+ if(typeof(data) == 'string'){
+ // XXX
+ }
+ // json...
+ // XXX
+ },
// XXX add scrollIntoView(..) to nav...
keyboard: {
@@ -346,7 +377,7 @@ var Outline = {
// horizontal navigation / collapse...
// XXX if at start/end of element move to prev/next...
ArrowLeft: function(evt){
- if(this.dom.querySelector('.outline textarea:focus')){
+ if(this.outline.querySelector('textarea:focus')){
// XXX if at end of element move to next...
return }
;((this.left_key_collapses
@@ -356,7 +387,7 @@ var Outline = {
this.toggleCollapse(true)
: this.get('parent')?.focus() },
ArrowRight: function(evt){
- if(this.dom.querySelector('.outline textarea:focus')){
+ if(this.outline.querySelector('textarea:focus')){
// XXX if at end of element move to next...
return }
if(this.right_key_expands){
@@ -401,7 +432,7 @@ var Outline = {
this.Block('after')?.querySelector('textarea')?.focus()
: this.get()?.querySelector('textarea')?.focus() },
Escape: function(evt){
- this.dom.querySelector('textarea:focus')?.parentElement?.focus() },
+ this.outline.querySelector('textarea:focus')?.parentElement?.focus() },
Delete: function(evt){
if(evt.target.isContentEditable){
return }
@@ -424,7 +455,7 @@ var Outline = {
setup: function(dom){
var that = this
this.dom = dom
- var outline = dom.querySelector('.outline')
+ var outline = this.outline
// update stuff already in DOM...
for(var elem of [...outline.querySelectorAll('textarea')]){
elem.autoUpdateSize() }
diff --git a/experiments/outline-editor/index.html b/experiments/outline-editor/index.html
index 25aefe4..29cb16e 100755
--- a/experiments/outline-editor/index.html
+++ b/experiments/outline-editor/index.html
@@ -43,18 +43,17 @@ var setup = function(){
This is a line of text
This is a set
- text lines
+text lines
-
@@ -63,8 +62,9 @@ var setup = function(){
TODO:
-- mouse controls
-- touch controls
+- Firefox compatibility -- remove ':has(..)'
+- focus management
+- mouse/touch controls
- navigation
- expand/collapse subtree
- shift subtree up/down