more tuning...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2023-10-18 23:50:01 +03:00
parent a2913d7731
commit 044df2e013
2 changed files with 9 additions and 4 deletions

View File

@ -1303,11 +1303,16 @@ var Outline = {
function(evt){ function(evt){
var elem = evt.target var elem = evt.target
// correct offset in editor... // 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 view = that.get(elem).querySelector('.view')
var c = getCharOffset(view, evt.clientX, evt.clientY) var c = getCharOffset(view, evt.clientX, evt.clientY)
if(c != null){ if(c == null){
evt.preventDefault() elem.focus()
elem.selectionStart = elem.value.length
elem.selectionEnd = elem.value.length
} else {
var m = getMarkdownOffset(elem.value, view.innerText, c) var m = getMarkdownOffset(elem.value, view.innerText, c)
elem.focus() elem.focus()
elem.selectionStart = c + m elem.selectionStart = c + m

View File

@ -49,7 +49,7 @@ var setup = function(){
- -
- ## ToDo: - ## ToDo:
- DONE click to select/edit node must retain click position in text... - 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: scroll into view is bad...
- ASAP: mobile browsers behave quite chaotically ignoring parts of the styling... - ASAP: mobile browsers behave quite chaotically ignoring parts of the styling...
- FEATURE: read-only mode - FEATURE: read-only mode