Skip to content

Commit

Permalink
bugfix + notes...
Browse files Browse the repository at this point in the history
Signed-off-by: Alex A. Naanou <[email protected]>
  • Loading branch information
flynx committed Nov 9, 2023
1 parent 5b0967f commit 99da7ca
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 14 deletions.
18 changes: 12 additions & 6 deletions experiments/outline-editor/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')]
Expand All @@ -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 `<li>${ e.innerText.split(/\n/)[0] }</li>`
})
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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]
Expand Down Expand Up @@ -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) } },
Expand All @@ -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) } },
Expand Down
12 changes: 4 additions & 8 deletions experiments/outline-editor/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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???
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 99da7ca

Please sign in to comment.