Browse Source

Merge remote-tracking branch 'origin/dev' into dev

Vanessa 1 năm trước cách đây
mục cha
commit
e38ff69499
2 tập tin đã thay đổi với 23 bổ sung7 xóa
  1. 5 6
      kernel/api/workspace.go
  2. 18 1
      kernel/model/transaction.go

+ 5 - 6
kernel/api/workspace.go

@@ -138,8 +138,11 @@ func removeWorkspaceDir(c *gin.Context) {
 
 	path := arg["path"].(string)
 
-	if util.IsWorkspaceLocked(path) {
-		logging.LogWarnf("skip remove workspace [%s] because it is locked", path)
+	if util.IsWorkspaceLocked(path) || util.WorkspaceDir == path {
+		msg := "Cannot remove current workspace"
+		ret.Code = -1
+		ret.Msg = msg
+		ret.Data = map[string]interface{}{"closeTimeout": 3000}
 		return
 	}
 
@@ -157,10 +160,6 @@ func removeWorkspaceDir(c *gin.Context) {
 		ret.Msg = err.Error()
 		return
 	}
-
-	if util.WorkspaceDir == path && (util.ContainerIOS == util.Container || util.ContainerAndroid == util.Container) {
-		os.Exit(logging.ExitCodeOk)
-	}
 }
 
 func removeWorkspaceDirPhysically(c *gin.Context) {

+ 18 - 1
kernel/model/transaction.go

@@ -577,7 +577,24 @@ func (tx *Transaction) doAppendInsert(operation *Operation) (ret *TxErr) {
 	for i := 0; i < len(toInserts); i++ {
 		toInsert := toInserts[i]
 		if isContainer {
-			if ast.NodeSuperBlock == node.Type {
+			if ast.NodeList == node.Type {
+				// 列表下只能挂列表项,所以这里需要分情况处理 https://github.com/siyuan-note/siyuan/issues/9955
+				if ast.NodeList == toInsert.Type {
+					var childLis []*ast.Node
+					for childLi := toInsert.FirstChild; nil != childLi; childLi = childLi.Next {
+						childLis = append(childLis, childLi)
+					}
+					for _, childLi := range childLis {
+						node.AppendChild(childLi)
+					}
+				} else {
+					newLiID := ast.NewNodeID()
+					newLi := &ast.Node{ID: newLiID, Type: ast.NodeListItem, ListData: &ast.ListData{Typ: node.ListData.Typ}}
+					newLi.SetIALAttr("id", newLiID)
+					node.AppendChild(newLi)
+					newLi.AppendChild(toInsert)
+				}
+			} else if ast.NodeSuperBlock == node.Type {
 				node.LastChild.InsertBefore(toInsert)
 			} else {
 				node.AppendChild(toInsert)