mirror of
https://github.com/flynx/pWiki.git
synced 2025-10-30 02:20:08 +00:00
fixed collapsing nodes...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
2fd8fbdbeb
commit
a7d9d9e40f
@ -26,7 +26,6 @@ var atLine = function(elem, index){
|
|||||||
|
|
||||||
//---------------------------------------------------------------------
|
//---------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
var Node = {
|
var Node = {
|
||||||
dom: undefined,
|
dom: undefined,
|
||||||
document: undefined,
|
document: undefined,
|
||||||
@ -251,14 +250,14 @@ var Outline = {
|
|||||||
// .toggleCollapse(<state>)
|
// .toggleCollapse(<state>)
|
||||||
if(['next', true, false].includes(node)){
|
if(['next', true, false].includes(node)){
|
||||||
state = node
|
state = node
|
||||||
node = null }
|
node = 'focused' }
|
||||||
node ??= this.get()
|
node = this.get(node)
|
||||||
if(!node
|
if(!node
|
||||||
// only nodes with children can be collapsed...
|
// only nodes with children can be collapsed...
|
||||||
|| !node.querySelector('[tabindex]')){
|
|| !node.querySelector('[tabindex]')){
|
||||||
return }
|
return }
|
||||||
state = state == 'next' ?
|
state = state == 'next' ?
|
||||||
!node.getAttribute('collapsed')
|
node.getAttribute('collapsed') != ''
|
||||||
: state
|
: state
|
||||||
if(state){
|
if(state){
|
||||||
node.setAttribute('collapsed', '')
|
node.setAttribute('collapsed', '')
|
||||||
@ -267,13 +266,12 @@ var Outline = {
|
|||||||
for(var elem of [...node.querySelectorAll('textarea')]){
|
for(var elem of [...node.querySelectorAll('textarea')]){
|
||||||
elem.updateSize() } }
|
elem.updateSize() } }
|
||||||
return node },
|
return node },
|
||||||
|
|
||||||
remove: function(node='focused', offset){
|
remove: function(node='focused', offset){
|
||||||
var elem = this.get(...arguments)
|
var elem = this.get(...arguments)
|
||||||
var next
|
var next
|
||||||
if(elem.classList.contains('focused')){
|
if(elem.classList.contains('focused')){
|
||||||
// XXX need to be able to get the next elem on same level...
|
// XXX need to be able to get the next elem on same level...
|
||||||
this.toggleCollapse(elem)
|
this.toggleCollapse(elem, true)
|
||||||
next = this.get(elem, 'next') }
|
next = this.get(elem, 'next') }
|
||||||
elem?.remove()
|
elem?.remove()
|
||||||
next?.focus()
|
next?.focus()
|
||||||
|
|||||||
@ -49,10 +49,12 @@ var setup = function(){
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="toolbar">
|
<div class="toolbar">
|
||||||
|
<!-- XXX these all should focus the node back so as not to hide the keyboard on mobine -->
|
||||||
<button onclick="editor.deindent()"><</button>
|
<button onclick="editor.deindent()"><</button>
|
||||||
<button onclick="editor.indent()">></button>
|
<button onclick="editor.indent()">></button>
|
||||||
<button onclick="editor.Block('before').focus()">O</button>
|
<button onclick="editor.Block('before').focus()" style="text-decoration:underline">+</button>
|
||||||
<button onclick="editor.Block('after').focus()">o</button>
|
<button onclick="editor.Block('after').focus()" style="text-decoration:overline">+</button>
|
||||||
|
<button onclick="editor.toggleCollapse()">+/-</button>
|
||||||
<button onclick="editor.remove()">×</button>
|
<button onclick="editor.remove()">×</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user