mirror of
https://github.com/flynx/pWiki.git
synced 2025-10-29 10:00:08 +00:00
fix...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
9e8557ebc3
commit
44a542e816
@ -1043,6 +1043,7 @@ var Outline = {
|
|||||||
var cur = this.get(node)
|
var cur = this.get(node)
|
||||||
if(!cur){
|
if(!cur){
|
||||||
return }
|
return }
|
||||||
|
var prev = this.path(cur)
|
||||||
var siblings = this.get(node, 'siblings')
|
var siblings = this.get(node, 'siblings')
|
||||||
// deindent...
|
// deindent...
|
||||||
if(indent == 'out'){
|
if(indent == 'out'){
|
||||||
@ -1056,17 +1057,19 @@ var Outline = {
|
|||||||
this.setUndo(
|
this.setUndo(
|
||||||
this.path(cur),
|
this.path(cur),
|
||||||
'indent',
|
'indent',
|
||||||
['in'])
|
['in'],
|
||||||
|
prev)
|
||||||
this.__change__() }
|
this.__change__() }
|
||||||
// indent...
|
// indent...
|
||||||
} else {
|
} else {
|
||||||
var parent = siblings[siblings.indexOf(cur) - 1]
|
var parent = siblings[siblings.indexOf(cur) - 1]
|
||||||
if(parent){
|
if(parent){
|
||||||
parent.lastChild.append(cur)
|
parent.lastChild.append(cur)
|
||||||
this.setUndo(
|
this.setUndo(
|
||||||
this.path(cur),
|
this.path(cur),
|
||||||
'indent',
|
'indent',
|
||||||
['out'])
|
['out'],
|
||||||
|
prev)
|
||||||
this.__change__()} }
|
this.__change__()} }
|
||||||
return cur },
|
return cur },
|
||||||
shift: function(node='focused', direction){
|
shift: function(node='focused', direction){
|
||||||
@ -1084,13 +1087,11 @@ var Outline = {
|
|||||||
if(direction == 'up'
|
if(direction == 'up'
|
||||||
&& i > 0){
|
&& i > 0){
|
||||||
siblings[i-1].before(node)
|
siblings[i-1].before(node)
|
||||||
focused
|
|
||||||
&& this.focus()
|
|
||||||
} else if(direction == 'down'
|
} else if(direction == 'down'
|
||||||
&& i < siblings.length-1){
|
&& i < siblings.length-1){
|
||||||
siblings[i+1].after(node)
|
siblings[i+1].after(node) }
|
||||||
focused
|
focused
|
||||||
&& this.focus() }
|
&& this.focus()
|
||||||
this.setUndo(
|
this.setUndo(
|
||||||
this.path(node),
|
this.path(node),
|
||||||
'shift',
|
'shift',
|
||||||
@ -1211,8 +1212,8 @@ var Outline = {
|
|||||||
// are reassigning the stacks manually.
|
// are reassigning the stacks manually.
|
||||||
__undo_stack: undefined,
|
__undo_stack: undefined,
|
||||||
__redo_stack: undefined,
|
__redo_stack: undefined,
|
||||||
setUndo: function(path, action, args){
|
setUndo: function(path, action, args, next){
|
||||||
;(this.__undo_stack ??= []).push([path, action, args])
|
;(this.__undo_stack ??= []).push([path, action, args, next])
|
||||||
this.__redo_stack = undefined
|
this.__redo_stack = undefined
|
||||||
return this },
|
return this },
|
||||||
clearUndo: function(){
|
clearUndo: function(){
|
||||||
@ -1223,11 +1224,14 @@ var Outline = {
|
|||||||
if(from == null
|
if(from == null
|
||||||
|| from.length == 0){
|
|| from.length == 0){
|
||||||
return [from, to] }
|
return [from, to] }
|
||||||
var [path, action, args] = from.pop()
|
var [path, action, args, next] = from.pop()
|
||||||
var l = from.length
|
var l = from.length
|
||||||
path != null
|
path != null
|
||||||
&& this.focus(path)
|
&& this.focus(path)
|
||||||
this[action](...args)
|
this[action](...args)
|
||||||
|
next != null ?
|
||||||
|
this.focus(next)
|
||||||
|
: this.focus()
|
||||||
if(l < from.length){
|
if(l < from.length){
|
||||||
to ??= []
|
to ??= []
|
||||||
to.push(
|
to.push(
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user