diff --git a/experiments/outline-editor/editor.js b/experiments/outline-editor/editor.js
index 0461092..6d51122 100755
--- a/experiments/outline-editor/editor.js
+++ b/experiments/outline-editor/editor.js
@@ -618,6 +618,12 @@ var tasks = {
var toc = {
__proto__: plugin,
+ // XXX not sure on what to build the hierarchy...
+ // this could be:
+ // - heading level
+ // - topology
+ // - both
+ // - ...
update: function(editor, elem){
var outline = editor.outline
var tocs = [...outline.querySelectorAll('.toc .view')]
@@ -632,7 +638,7 @@ var toc = {
depth++ }
parent = parent.parentElement }
return depth }
- var headings = [...editor.outline.querySelectorAll('.heading .view')]
+ var headings = [...editor.outline.querySelectorAll('.block.heading>.view')]
.map(function(e){
return `
${ e.innerText.split(/\n/)[0] }`
})
@@ -1186,7 +1192,7 @@ var Outline = {
// NOTE: this needs to be before styling to prevent it from
// treating '[_] ... [_]' as italic...
tasks,
- //toc,
+ toc,
styling,
// XXX
//attributes,
@@ -1316,7 +1322,7 @@ var Outline = {
outline
: node.parentElement === outline ?
outline
- : node.parentElement.parentElement }
+ : node?.parentElement?.parentElement }
var children = function(node){
return node === outline ?
[...node.children]
@@ -1965,7 +1971,7 @@ var Outline = {
var line = edited.getTextGeometry().line
if(line == 0){
evt.preventDefault()
- that.focus('edited', 'prev') }
+ that.edit('prev') }
} else {
evt.preventDefault()
this.focus('focused', -1) } },
@@ -1986,9 +1992,9 @@ var Outline = {
var edited = this.get('edited')
if(edited){
var {line, lines} = edited.getTextGeometry()
- if(line == lines - 1){
+ if(lines == 0 || line == lines - 1){
evt.preventDefault()
- that.focus('edited', 'next') }
+ that.edit('next') }
} else {
evt.preventDefault()
this.focus('focused', 1) } },
diff --git a/experiments/outline-editor/index.html b/experiments/outline-editor/index.html
index 0b30027..156f3c6 100755
--- a/experiments/outline-editor/index.html
+++ b/experiments/outline-editor/index.html
@@ -48,13 +48,6 @@
-
- ## Bugs:
focused:: true
- - BUG: deleting an element in edit mode breaks code (err)
- - click the next line and press `backspace`
- -
- - BUG: navigation in edit mode broken...
- -
- - // can't go past this down...
- -
- BUG: caret positioning broken
- *TODO*::
- text text text
@@ -118,7 +111,9 @@
- side margins are a bit too large (account for toolbat to the right)
-
- ## ToDo:
- - TOC?
+ - might be a good idea to make the heading level depend on its depth...
+ - Q: do we want to place the caret when moving between nodes???
+ - _would be nice to remember the caret horizontal offset for vertical movement_
- Q: should we use `HTMLTextAreaElement.autoUpdateSize(..)` or handle it globally in setup???
- _...I'm leaning towards the later..._
- Q: can we place a cursor in a table correctly???
@@ -182,6 +177,7 @@
- numbered lists: add counters to a depth of 6-7...
- _or find a way to make them repeat..._
- FEATURE: read-only mode
+ - FEATURE: TOC (???)
- FEATURE: auto-shift done blocks to the end of siblings... (option?)
- ...or should this be `sort:: done` -- i.e. sort children by done status??
- codeblock as a block