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

This commit is contained in:
Vanessa 2024-04-02 17:01:25 +08:00
commit e7fd94046d
8 changed files with 37 additions and 23 deletions

View file

@ -1462,6 +1462,7 @@
"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",
"240": "The heading under the container block in the doc does not support dragging"
"240": "Drag heading under container blocks in the doc is not supported",
"241": "Drag to its subheading is not supported"
}
}

View file

@ -1462,6 +1462,7 @@
"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",
"240": "El encabezado debajo del bloque contenedor en el documento no admite el arrastre"
"240": "No se admite arrastrar encabezado debajo de los bloques contenedores en el documento",
"241": "No se admite arrastrar a su subtítulo"
}
}

View file

@ -1462,6 +1462,7 @@
"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",
"240": "Le titre sous le bloc conteneur dans la doc ne prend pas en charge le glisser"
"240": "Le déplacement du titre sous les blocs conteneurs dans la doc n'est pas pris en charge",
"241": "Le glisser vers son sous-titre n'est pas pris en charge"
}
}

View file

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

View file

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

View file

@ -35,9 +35,11 @@ const updateTitle = (rootID: string, tab: Tab, protyle?: IProtyle) => {
});
};
export const reloadSync = (app: App, data: { upsertRootIDs: string[], removeRootIDs: string[] }) => {
hideMessage();
/// #if MOBILE
export const reloadSync = (app: App, data: { upsertRootIDs: string[], removeRootIDs: string[] }, hideMsg = true) => {
if (hideMsg) {
hideMessage();
}
/// #if MOBILE
if (window.siyuan.mobile.popEditor) {
if (data.removeRootIDs.includes(window.siyuan.mobile.popEditor.protyle.block.rootID)) {
hideElements(["dialog"]);

View file

@ -16,7 +16,8 @@ import {
processSync,
progressBackgroundTask,
progressLoading,
progressStatus, reloadSync,
progressStatus,
reloadSync,
setTitle,
transactionError
} from "./dialog/processSystem";
@ -66,7 +67,7 @@ export class App {
reloadSync(this, data.data);
break;
case "reloaddoc":
reloadSync(this, {upsertRootIDs: [data.data], removeRootIDs: []});
reloadSync(this, {upsertRootIDs: [data.data], removeRootIDs: []}, false);
break;
case "readonly":
window.siyuan.config.editor.readOnly = data.data;

View file

@ -63,16 +63,6 @@ func (tx *Transaction) doMoveOutlineHeading(operation *Operation) (ret *TxErr) {
headingChildren := treenode.HeadingChildren(heading)
// 过滤掉超级块结束节点
var tmp []*ast.Node
for _, child := range headingChildren {
if ast.NodeSuperBlockCloseMarker == child.Type {
continue
}
tmp = append(tmp, child)
}
headingChildren = tmp
if "" != previousID {
previousHeading := treenode.GetNodeInTree(tree, previousID)
if nil == previousHeading {
@ -85,6 +75,14 @@ func (tx *Transaction) doMoveOutlineHeading(operation *Operation) (ret *TxErr) {
return
}
for _, h := range headingChildren {
if h.ID == previousID {
// 不能移动到自己的子标题下
util.PushMsg(Conf.language(241), 5000)
return
}
}
targetNode := previousHeading
previousHeadingChildren := treenode.HeadingChildren(previousHeading)
if 0 < len(previousHeadingChildren) {
@ -122,11 +120,19 @@ func (tx *Transaction) doMoveOutlineHeading(operation *Operation) (ret *TxErr) {
return
}
for _, h := range headingChildren {
if h.ID == parentID {
// 不能移动到自己的子标题下
util.PushMsg(Conf.language(241), 5000)
return
}
}
targetNode := parentHeading
parentHeadingChildren := treenode.HeadingChildren(parentHeading)
// 找到下方第一个非标题节点
tmp = nil
var tmp []*ast.Node
for _, child := range parentHeadingChildren {
if ast.NodeHeading == child.Type {
break
@ -144,7 +150,7 @@ func (tx *Transaction) doMoveOutlineHeading(operation *Operation) (ret *TxErr) {
}
}
diffLevel := 1
diffLevel := heading.HeadingLevel - parentHeading.HeadingLevel - 1
heading.HeadingLevel = parentHeading.HeadingLevel + 1
if 6 < heading.HeadingLevel {
heading.HeadingLevel = 6
@ -153,7 +159,7 @@ func (tx *Transaction) doMoveOutlineHeading(operation *Operation) (ret *TxErr) {
for i := len(headingChildren) - 1; i >= 0; i-- {
child := headingChildren[i]
if ast.NodeHeading == child.Type {
child.HeadingLevel += diffLevel
child.HeadingLevel -= diffLevel
if 6 < child.HeadingLevel {
child.HeadingLevel = 6
}