diff --git a/experiments/outline-editor/editor.js b/experiments/outline-editor/editor.js index 9dc3124..095681d 100755 --- a/experiments/outline-editor/editor.js +++ b/experiments/outline-editor/editor.js @@ -1303,11 +1303,16 @@ var Outline = { function(evt){ var elem = evt.target // correct offset in editor... - if(elem.classList.contains('code') && document.activeElement !== elem){ + if(elem.classList.contains('code') + && document.activeElement !== elem){ + evt.preventDefault() var view = that.get(elem).querySelector('.view') var c = getCharOffset(view, evt.clientX, evt.clientY) - if(c != null){ - evt.preventDefault() + if(c == null){ + elem.focus() + elem.selectionStart = elem.value.length + elem.selectionEnd = elem.value.length + } else { var m = getMarkdownOffset(elem.value, view.innerText, c) elem.focus() elem.selectionStart = c + m diff --git a/experiments/outline-editor/index.html b/experiments/outline-editor/index.html index 05753fe..026d7dc 100755 --- a/experiments/outline-editor/index.html +++ b/experiments/outline-editor/index.html @@ -49,7 +49,7 @@ var setup = function(){ - - ## ToDo: - DONE click to select/edit node must retain click position in text... - - _...needs more testing..._ + - _...need a bit of tuning -- where in the char a click is made and where the cursor is placed..._ - ASAP: scroll into view is bad... - ASAP: mobile browsers behave quite chaotically ignoring parts of the styling... - FEATURE: read-only mode