- # Outline editor prototype - An outline-based markdown editor experiment - ### Infuences:: - Logseq - Tomboy - Bonsai - - // Seems that I unintentionally implemented quite a chunk of the markdown spec ;) - - ## Bugs: - BUG: editor: FF seems to update the style every other key press -- should be live... - - ## ToDo: - ASAP: scroll into view is bad... - ASAP: mobile browsers behave quite chaotically ignoring parts of the styling... - pgup/pgdown/home/end buttons - identify a block (index, id, ...) - focus - `<editor>.autofocus` - `focused:: true` attr (`.text(..)`/`.json(..)`/`.load(..)`) - focusing editor -> focus focused block - undo collapsed:: true - edit stack (position, action, ...) - 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 _...if only whitespace before/after clear it and style whole block..._ _...might be a good idea to do this with codeblock at start/end of block..._ - Code blocks and bullets: - ``` code ``` - _bullet should be either in the middle of the block or at the first line of code (preferred)..._ - copy/paste nodes/trees - FEATURE: read-only mode - export html - embed css - cleanup html - generate ideomatic html (???) - FEATURE: `collapse-children:: true` block option -- when loading collapse all immediate children - FF: figure out a way to draw expand/collapse bullets without the use of CSS' `:has(..)` - table inline editing a-la code editing -- click cell and edit directly... - a way to make a block monospace (???) - editor as a custom element... - Nerd fonts (option???) - multiple node selection - FEATURE? block templates... collapsed:: true - something like: `TPL: [_] <editable/> -- <editable/>` - `TPL:` -- template marker - `<editable/>` -- field marker - each child node will copy the template and allow editing of only fields - not clear how to handle template changes... - cli - Q: do we use \\t for indent? (option???) - Q: persistent empty first/last node (a button to create a new node)? - Q: should list bullets be on the same level as nodes or offset?? collapsed:: true - A) justified to bullet: * list item * list item block text - B) justified to text _(current)_: * list item * list item block text - NOTE: this is only a problem if making list-items manually -- disable??? - empty item height is a bit off... - DONE call `.sync()` on all changes... - DONE show list bullet if node is empty but edited... collapsed:: true - _...not sure which is best, so both options are available, see: `editor.css`_ - DONE Q: can we get the caret line in a textarea??? collapsed:: true - _...this will fix a lot of issues with moving between blocks in edit mode..._ - DONE Q: can we place the cursor on item click where it was clicked before before the code expanded? collapsed:: true - for example - #### Click in this line and see where the cursor goes - _not sure how..._ - DONE click to select/edit node must retain click position in text... - DONE checkbox navigation via `alt-<arrow>` collapsed:: true - _might be a good idea to include also TODO/DONE navigation -- not yet sure how to mark undone blocks (i.e. the ones marked with TODO in Logseg)..._ - toggle with `space` - navigation auto-selects first checkbox - DONE editor: backsapce/del at start/end of a block should join it with prev/next - DONE editor: pressing enter in text edit mode should split text into two blocks - DONE editor: shifting nodes up/down - DONE Q: can we edit code in a code block directly? (a-la Logseq) - DONE "percentage complete" in parent blocks with todo's nested - DONE `.editor .outline:empty` view and behavior... - DONE editor: semi-live update styles - DONE do a better expand/collapse icons - DONE loading from DOM -- fill textarea - DONE focus management - DONE mouse/touch controls - DONE navigation - DONE expand/collapse subtree - DONE shift subtree up/down - DONE create node - DONE edit node - DONE serialize/deserialize - DONE add optional text styling to nodes - - ## Refactoring: - Plugin architecture - DONE basic structure - plugin handler sequencing (see: `<editor>.setup(..)`) - DONE plugin handler canceling (see: `<editor>.runPlugins(..)`) - DONE Item parser (`.__code2html__(..)`) collapsed:: true - DONE split out - DONE define a way to extend/stack parsers - DONE Format parser/generator collapsed:: true - DONE split out - DONE define api (see: `<editor>.__code2text__(..) / <editor>.__text2code__(..)`) - CSS - separate out settings - separate out theming - Actions -- move user actions (code in `.keyboard`) into methods - Move to `keyboard.js` - Q: do we need a concatenative API?? - `<block>.get() -> <block>` - Docs - - ## Docs - ### Controls - ASAP: these need updating... - | Key | Action | | up | focus node above | | down | focus node below | | left | focus parent node | | right | focus first child node | | tab | indent node | | s-tab | deindent node | | s-pgup | shift node up | | s-pgdown | shift node down | | s-left | collapse node | | s-right | expand node | | c-left | prev checkbox | | c-right | next checkbox | | space | toggle current checkbox | | c-d | toggle current element DONE | | enter | normal mode: edit node | | | edit mode: create node below | | esc | exit edit mode | - ### Formatting - The formatting mostly adheres to the markdown spec with a few minor differences - - Styles: - # Heading 1 - ## Heading 2 - ### Heading 3 - #### Heading 4 - ##### Heading 5 - ###### Heading 6 - Text - Lists:: - bullet: - a: collapsed:: true - bullets: - in: - very: - deep: - list: - of: - items: - b - c - numbered# - a - b# - x# collapsed:: true - bullets# - in# - very# - deep# - list# - of# - items# - y - z - c - > quote - Notes - NOTE: a note text - NOTE: - a root note can also be empty - click on the outer border to edit root - // C-style comment - ; ASM-style comment - XXX Highlight - DONE Done (toggled via: `ctrl-d`) - Basic inline *bold*, _italic_ and ~striked~ - Marking ==text== - Code: - Inline quoting `html <b>code</b>` - code blocks ```javascript var text = 'Hello, world!' console.log(text) ``` - Line - --- - Markers: ASAP, BUG, FIX, HACK, STUB, WARNING, and CAUTION - Basic task management - [%] Completion status - Inline [X] checkboxes [_] - To do items/blocks - [_] undone item _(clicking the checkbox updates the item)_ - [X] done item - [_] we can also add inline [x] checkboxes and states: [%] - navigating checkboxes in view mode can be done via `ctrl-left` / `ctrl-right` and toggling is done via `space` - links - [example](about:blank) - https://example.com - ./path/to/file /path/to -- _not supported yet_ - Tables - | a | b | c | | 1 | 2 | 3 | | 11 | 22 | 33 | - Symbols -- _should these be ligatures?_ - (i), (c), /!\, ... - -- and --- - - --- - ### Playground for testing - A collapsed:: true - a - b - c - B - d - e - C - This is a line of text - This is a set text lines - Lots of text Lots of text Lots of text Lots of text Lots of text Lots of text Lots of text Lots of text Lots of text Lots of text Lots of text Lots of text Lots of text Lots of text Lots of text Lots of text Lots of text Lots of text Lots of text Lots of text Lots of text Lots of text Lots of text Lots of text Lots of text -