tweaking....

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2023-10-23 20:46:44 +03:00
parent 4c9597e27b
commit 69701f0697
3 changed files with 11 additions and 1 deletions

View File

@ -74,6 +74,9 @@
outline: none;
border: none;
}
.editor.block-offsets .outline .block {
border-left: solid 1px silver;
}
.editor .outline .block .block {
margin-left: var(--item-indent);
}

View File

@ -855,13 +855,19 @@ var Outline = {
var elem = this.get(...arguments)
?? this.get(0)
if(elem){
var cur = this.get()
var blocks = this.get('visible')
elem.focus({preventScroll: true})
;(elem.classList.contains('code') ?
elem
: elem.querySelector('.code'))
.scrollIntoView({
block: 'nearest',
//behavior: 'smooth',
// smooth for long jumps and instant for short jumps...
behavior: (cur == null
|| Math.abs(blocks.indexOf(cur) - blocks.indexOf(elem)) > 2) ?
'smooth'
: 'instant'
}) }
return elem },
edit: function(node='focused', offset){

View File

@ -342,6 +342,7 @@ var setup = function(){
<hr>
<button onclick="editor.dom.classList.toggle('show-click-zones')">show/hide click zones</button>
<button onclick="editor.dom.classList.toggle('block-offsets')">show/hide block offsets</button>
</body>