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

This commit is contained in:
Vanessa 2024-04-02 15:46:14 +08:00
commit 4a7b21f8ad
6 changed files with 30 additions and 7 deletions

View file

@ -1461,6 +1461,7 @@
"236": "[%d/%d] is updating the marketplace package [%s]...",
"237": "[%d] marketplace packages have all been updated successfully",
"238": "Marketplace package [%s] update failed, please try again later",
"239": "Related operations are being processed, please try again later"
"239": "Related operations are being processed, please try again later",
"240": "The heading under the container block in the doc does not support dragging"
}
}

View file

@ -1461,6 +1461,7 @@
"236": "[%d/%d] está actualizando el paquete del mercado [%s]...",
"237": "[%d] todos los paquetes del mercado se han actualizado correctamente",
"238": "Error en la actualización del paquete Marketplace [%s], inténtalo de nuevo más tarde",
"239": "Las operaciones relacionadas se están procesando, inténtalo de nuevo más tarde"
"239": "Las operaciones relacionadas se están procesando, inténtalo de nuevo más tarde",
"240": "El encabezado debajo del bloque contenedor en el documento no admite el arrastre"
}
}

View file

@ -1461,6 +1461,7 @@
"236": "[%d/%d] met à jour le package Marketplace [%s]...",
"237": "[%d] packages Marketplace ont tous été mis à jour avec succès",
"238": "La mise à jour du package Marketplace [%s] a échoué, veuillez réessayer plus tard",
"239": "Les opérations associées sont en cours de traitement, veuillez réessayer plus tard"
"239": "Les opérations associées sont en cours de traitement, veuillez réessayer plus tard",
"240": "Le titre sous le bloc conteneur dans la doc ne prend pas en charge le glisser"
}
}

View file

@ -1461,6 +1461,7 @@
"236": "[%d/%d] 正在更新市集包 [%s]...",
"237": "[%d] 個市集包已經全部更新成功",
"238": "市集包 [%s] 更新失敗,請稍後再試",
"239": "相關操作正在處理中,請稍後再試"
"239": "相關操作正在處理中,請稍後再試",
"240": "文件中容器區塊下的標題不支援拖曳"
}
}

View file

@ -1461,6 +1461,7 @@
"236": "[%d/%d] 正在更新集市包 [%s]...",
"237": "[%d] 个集市包已经全部更新成功",
"238": "集市包 [%s] 更新失败,请稍后再试",
"239": "相关操作正在处理中,请稍后再试"
"239": "相关操作正在处理中,请稍后再试",
"240": "文档中容器块下的标题不支持拖拽"
}
}

View file

@ -40,11 +40,19 @@ func (tx *Transaction) doMoveOutlineHeading(operation *Operation) (ret *TxErr) {
return &TxErr{code: TxErrCodeBlockNotFound, id: headingID}
}
operation.RetData = tree.Root.ID
heading := treenode.GetNodeInTree(tree, headingID)
if nil == heading {
return &TxErr{code: TxErrCodeBlockNotFound, id: headingID}
}
if ast.NodeDocument != heading.Parent.Type {
// 仅支持文档根节点下第一层标题,不支持容器块内标题
util.PushMsg(Conf.language(240), 5000)
return
}
headings := []*ast.Node{}
ast.Walk(tree.Root, func(n *ast.Node, entering bool) ast.WalkStatus {
if entering && ast.NodeHeading == n.Type && !n.ParentIs(ast.NodeBlockquote) {
@ -71,6 +79,12 @@ func (tx *Transaction) doMoveOutlineHeading(operation *Operation) (ret *TxErr) {
return &TxErr{code: TxErrCodeBlockNotFound, id: previousID}
}
if ast.NodeDocument != previousHeading.Parent.Type {
// 仅支持文档根节点下第一层标题,不支持容器块内标题
util.PushMsg(Conf.language(240), 5000)
return
}
targetNode := previousHeading
previousHeadingChildren := treenode.HeadingChildren(previousHeading)
if 0 < len(previousHeadingChildren) {
@ -102,6 +116,12 @@ func (tx *Transaction) doMoveOutlineHeading(operation *Operation) (ret *TxErr) {
return &TxErr{code: TxErrCodeBlockNotFound, id: parentID}
}
if ast.NodeDocument != parentHeading.Parent.Type {
// 仅支持文档根节点下第一层标题,不支持容器块内标题
util.PushMsg(Conf.language(240), 5000)
return
}
targetNode := parentHeading
parentHeadingChildren := treenode.HeadingChildren(parentHeading)
@ -153,8 +173,6 @@ func (tx *Transaction) doMoveOutlineHeading(operation *Operation) (ret *TxErr) {
if err = tx.writeTree(tree); nil != err {
return
}
operation.RetData = tree.Root.ID
return
}