mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-09-22 00:20:47 +02:00
Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
459a35d0b3
4 changed files with 28 additions and 1 deletions
|
@ -225,6 +225,7 @@ export abstract class Constants {
|
||||||
public static readonly DIALOG_SAVEWORKSPACE = "dialog-saveworkspace"; // 保存工作空间
|
public static readonly DIALOG_SAVEWORKSPACE = "dialog-saveworkspace"; // 保存工作空间
|
||||||
|
|
||||||
// timeout
|
// timeout
|
||||||
|
public static readonly TIMEOUT_OPENDIALOG = 50;
|
||||||
public static readonly TIMEOUT_DBLCLICK = 190;
|
public static readonly TIMEOUT_DBLCLICK = 190;
|
||||||
public static readonly TIMEOUT_INPUT = 256;
|
public static readonly TIMEOUT_INPUT = 256;
|
||||||
public static readonly TIMEOUT_LOAD = 300;
|
public static readonly TIMEOUT_LOAD = 300;
|
||||||
|
|
|
@ -78,7 +78,7 @@ left:${left || "auto"};top:${top || "auto"}">
|
||||||
} else {
|
} else {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.element.classList.add("b3-dialog--open");
|
this.element.classList.add("b3-dialog--open");
|
||||||
});
|
}, Constants.TIMEOUT_OPENDIALOG);
|
||||||
}
|
}
|
||||||
/// #if !MOBILE
|
/// #if !MOBILE
|
||||||
moveResize(this.element.querySelector(".b3-dialog__container"), options.resizeCallback);
|
moveResize(this.element.querySelector(".b3-dialog__container"), options.resizeCallback);
|
||||||
|
|
|
@ -1222,6 +1222,12 @@ func (tx *Transaction) doInsert(operation *Operation) (ret *TxErr) {
|
||||||
node.InsertAfter(remain)
|
node.InsertAfter(remain)
|
||||||
}
|
}
|
||||||
node.InsertAfter(insertedNode)
|
node.InsertAfter(insertedNode)
|
||||||
|
|
||||||
|
if treenode.IsUnderFoldedHeading(insertedNode) {
|
||||||
|
// 保持在标题下的折叠状态
|
||||||
|
insertedNode.SetIALAttr("fold", "1")
|
||||||
|
insertedNode.SetIALAttr("heading-fold", "1")
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
node = treenode.GetNodeInTree(tree, operation.ParentID)
|
node = treenode.GetNodeInTree(tree, operation.ParentID)
|
||||||
if nil == node {
|
if nil == node {
|
||||||
|
@ -1459,6 +1465,12 @@ func (tx *Transaction) doUpdate(operation *Operation) (ret *TxErr) {
|
||||||
oldNode.InsertAfter(updatedNode)
|
oldNode.InsertAfter(updatedNode)
|
||||||
oldNode.Unlink()
|
oldNode.Unlink()
|
||||||
|
|
||||||
|
if treenode.IsUnderFoldedHeading(updatedNode) {
|
||||||
|
// 保持在标题下的折叠状态
|
||||||
|
updatedNode.SetIALAttr("fold", "1")
|
||||||
|
updatedNode.SetIALAttr("heading-fold", "1")
|
||||||
|
}
|
||||||
|
|
||||||
createdUpdated(updatedNode)
|
createdUpdated(updatedNode)
|
||||||
|
|
||||||
tx.nodes[updatedNode.ID] = updatedNode
|
tx.nodes[updatedNode.ID] = updatedNode
|
||||||
|
|
|
@ -85,6 +85,20 @@ func GetHeadingFold(nodes []*ast.Node) (ret []*ast.Node) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func IsUnderFoldedHeading(node *ast.Node) bool {
|
||||||
|
for n := node.Previous; nil != n; n = n.Previous {
|
||||||
|
if ast.NodeHeading == n.Type && "1" == n.IALAttr("fold") {
|
||||||
|
if ast.NodeHeading != node.Type {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
if n.HeadingLevel > node.HeadingLevel {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
func HeadingChildren(heading *ast.Node) (ret []*ast.Node) {
|
func HeadingChildren(heading *ast.Node) (ret []*ast.Node) {
|
||||||
start := heading.Next
|
start := heading.Next
|
||||||
if nil == start {
|
if nil == start {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue