mirror of
https://github.com/flynx/pWiki.git
synced 2025-10-30 02:20:08 +00:00
tweaking....
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
4c9597e27b
commit
69701f0697
@ -74,6 +74,9 @@
|
|||||||
outline: none;
|
outline: none;
|
||||||
border: none;
|
border: none;
|
||||||
}
|
}
|
||||||
|
.editor.block-offsets .outline .block {
|
||||||
|
border-left: solid 1px silver;
|
||||||
|
}
|
||||||
.editor .outline .block .block {
|
.editor .outline .block .block {
|
||||||
margin-left: var(--item-indent);
|
margin-left: var(--item-indent);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -855,13 +855,19 @@ var Outline = {
|
|||||||
var elem = this.get(...arguments)
|
var elem = this.get(...arguments)
|
||||||
?? this.get(0)
|
?? this.get(0)
|
||||||
if(elem){
|
if(elem){
|
||||||
|
var cur = this.get()
|
||||||
|
var blocks = this.get('visible')
|
||||||
elem.focus({preventScroll: true})
|
elem.focus({preventScroll: true})
|
||||||
;(elem.classList.contains('code') ?
|
;(elem.classList.contains('code') ?
|
||||||
elem
|
elem
|
||||||
: elem.querySelector('.code'))
|
: elem.querySelector('.code'))
|
||||||
.scrollIntoView({
|
.scrollIntoView({
|
||||||
block: 'nearest',
|
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 },
|
return elem },
|
||||||
edit: function(node='focused', offset){
|
edit: function(node='focused', offset){
|
||||||
|
|||||||
@ -342,6 +342,7 @@ var setup = function(){
|
|||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
<button onclick="editor.dom.classList.toggle('show-click-zones')">show/hide click zones</button>
|
<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>
|
</body>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user