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){
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

View File

@ -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