diff --git a/experiments/outline-editor/editor.css b/experiments/outline-editor/editor.css index 7a827ec..d2d5274 100755 --- a/experiments/outline-editor/editor.css +++ b/experiments/outline-editor/editor.css @@ -221,6 +221,8 @@ /* clickable things in view */ & a, & pre, + & button, + & select, & input { pointer-events: auto; } diff --git a/experiments/outline-editor/editor.js b/experiments/outline-editor/editor.js index 5a9343c..f6d66f7 100755 --- a/experiments/outline-editor/editor.js +++ b/experiments/outline-editor/editor.js @@ -309,6 +309,46 @@ var attributes = { } +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +// XXX make this collapsed... +// XXX handle cursor marker... +var templates = { + __proto__: plugin, + + nodeFromTemplate: function(){ + }, + + __pre_parse__: function(text, editor, elem){ + if(!text.startsWith('TEMPLATE')){ + return text } + + text = text + .replace(/^TEMPLATE/, '') + var [header, ...lines] = text.split(/\n/g) + header = + `` + + // body... + // XXX only do this if we have nested elements... + elem.collapsed = true + // XXX + + // button... + return header }, + // XXX focus button... + __focusin__: function(evt, editor, elem){ + }, + // XXX handle button??? + __click__: function(evt, editor, elem){ + }, +} + + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // XXX revise headings... @@ -967,6 +1007,7 @@ var JSONOutline = { // XXX split out DOM-specific plugins into Outline.plugins... pre_plugins: [ attributes, + templates, blocks, quoted, ], diff --git a/experiments/outline-editor/index.html b/experiments/outline-editor/index.html index ef54fdc..4b4ea30 100755 --- a/experiments/outline-editor/index.html +++ b/experiments/outline-editor/index.html @@ -157,26 +157,44 @@ var setup = function(){ - ## ToDo: - Item templates: - inline - - [template title] + - TEMPLATE + text [cursor] + - TEMPLATE title text [cursor] - sub-tree - - [template title] + - TEMPLATE title - text [cursor] - multi-template - - [template title A] + - TEMPLATE title A text [cursor] - - [template title B] + - TEMPLATE title B - text [cursor] - renders as: - - - - action + + - action: - duplicate template text / subtree (w.o. markers) - select / place cursor at cursor marker - - XXX revise syntac + - TODO: + - nested templates?? + - global templates -- or should this be an external macro??? + - revise syntax + - templated lists -- a list that uses a template for it's items + - something like: + - or here there is an explicit item template + - TEMPLATE new + - [ ] [cursor] + - [ ] A + - [ ] B + - [ ] C + - and a shorthand for todo: + - TODO in lists like this new items will be created with a todo template + - [ ] A + - [ ] B + - [ ] C - Time to think about a standalone client -- at least to edit own notes as a test... - _also this would be a nice opportunity to start the move to a newer electron version_ - Deployment: