diff --git a/experiments/outline-editor/editor.js b/experiments/outline-editor/editor.js index 5061dcf..e12cbf3 100755 --- a/experiments/outline-editor/editor.js +++ b/experiments/outline-editor/editor.js @@ -609,10 +609,12 @@ var Outline = { outline.addEventListener('click', function(evt){ var elem = evt.target - // expand/collapse... - // XXX - if(elem.getAttribute('collapsed')){ - } + // expand/collapse + // NOTE: clicking outside the element to the right i.e. on :after/:before + if(elem.nodeName == 'DIV' + && elem.getAttribute('tabindex') + && evt.clientX > elem.offsetWidth){ + that.toggleCollapse(elem) } // todo: toggle checkbox... if(elem.classList.contains('todo')){ var node = elem.parentElement.parentElement diff --git a/experiments/outline-editor/index.html b/experiments/outline-editor/index.html index e6de346..69f6dc3 100755 --- a/experiments/outline-editor/index.html +++ b/experiments/outline-editor/index.html @@ -35,6 +35,7 @@ var setup = function(){ - Bonsai - - ## ToDo + - do a better expand/collapse icon on hover - read-only mode - editor: bksapce/del at start/end of a block should join it with prev/next - editor: pressing enter in text edit mode should split text into two blocks