diff --git a/experiments/outline-editor/index.html b/experiments/outline-editor/index.html index 1662057..32f53d9 100755 --- a/experiments/outline-editor/index.html +++ b/experiments/outline-editor/index.html @@ -7,14 +7,42 @@ font-size: 5mm; } -.editor div div { +.editor [tabindex] { + position: relative; +} +.editor div [tabindex] { margin-left: 2em; } -.editor div span { - display: block; - padding: 0.2em; +.editor [tabindex]>span, +.editor [tabindex]>textarea { + --padding: 0.2em; + display: block; + width: 100%; + padding: var(--padding); + margin: 0; + + font-family: sans-serif; + font-size: 5mm; white-space: pre; + + outline: none; + border: none; +} +.editor [tabindex]>textarea { + height: calc(2 * var(--padding) + 1em); + overflow: hidden; + resize: none; +} + +/* show/hide node's view/code... */ +.editor [tabindex]>span+textarea:not(:focus), +/* XXX not sure how to do this without :has(..)... */ +.editor [tabindex]:has(>span+textarea:focus)>span:has(+textarea), +.editor [tabindex]:focus>span+textarea { + position: absolute; + opacity: 0; + top: 0; } .editor div[collapsed] { @@ -28,15 +56,23 @@ /*outline: solid 0.2em silver;*/ outline: none; } -.editor div:focus>span { +.editor div:focus>span, +.editor div:focus>textarea { background: silver; } -
+TODO: -navigation-expand/collapse subtree-shift subtree up/down-- edit node +-create node+-edit node+- undo delete node +- copy/paste nodes/trees +- shifting nodes up/down - multiple node selection -- create node - mouse controls - touch controls +- serialize/deserialize +- add optional styling to nodes Controls: up - focus node above @@ -256,31 +356,36 @@ Controls: s-tab - deindent node s-left - collapse node s-right - expand node + enter - normal mode: edit node + - edit mode: create node below + esc - exit edit mode