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

This commit is contained in:
Vanessa 2025-10-21 20:22:04 +08:00
commit 0bec8594a1
4 changed files with 36 additions and 38 deletions

View file

@ -228,7 +228,8 @@ export abstract class Constants {
public static readonly MENU_BAR_WORKSPACE = "barWorkspace"; // 顶栏主菜单
public static readonly MENU_BAR_PLUGIN = "topBarPlugin"; // 顶栏插件菜单
public static readonly MENU_BAR_ZOOM = "barZoom"; // 顶栏缩放菜单
public static readonly MENU_BAR_MORE = "barmore"; // 顶栏外观菜单
public static readonly MENU_BAR_MODE = "barmode"; // 顶栏外观菜单
public static readonly MENU_BAR_MORE = "barmore"; // 顶栏更多菜单
public static readonly MENU_STATUS_HELP = "statusHelp"; // 状态栏帮助菜单
public static readonly MENU_STATUS_BACKGROUND_TASK = "statusBackgroundTask"; // 状态栏后台任务菜单
public static readonly MENU_DOCK_MOBILE = "dockMobileMenu"; // 移动端侧栏插件选项菜单

View file

@ -127,12 +127,12 @@ export const initBar = (app: App) => {
break;
} else if (targetId === "barMode") {
if (!window.siyuan.menus.menu.element.classList.contains("fn__none") &&
window.siyuan.menus.menu.element.getAttribute("data-name") === Constants.MENU_BAR_MORE) {
window.siyuan.menus.menu.element.getAttribute("data-name") === Constants.MENU_BAR_MODE) {
window.siyuan.menus.menu.remove();
return;
}
window.siyuan.menus.menu.remove();
window.siyuan.menus.menu.element.setAttribute("data-name", Constants.MENU_BAR_MORE);
window.siyuan.menus.menu.element.setAttribute("data-name", Constants.MENU_BAR_MODE);
window.siyuan.menus.menu.append(new MenuItem({
id: "themeLight",
label: window.siyuan.languages.themeLight,

View file

@ -1008,15 +1008,15 @@ func prepareExportTree(bt *treenode.BlockTree) (ret *parse.Tree) {
func processIFrame(tree *parse.Tree) {
// 导出 PDF/Word 时 IFrame 块使用超链接 https://github.com/siyuan-note/siyuan/issues/4035
var unlinks []*ast.Node
ast.Walk(tree.Root, func(n *ast.Node, entering bool) ast.WalkStatus {
if !entering {
if !entering || ast.NodeIFrame != n.Type {
return ast.WalkContinue
}
if ast.NodeIFrame == n.Type {
n.Type = ast.NodeParagraph
index := bytes.Index(n.Tokens, []byte("src=\""))
if 0 > index {
n.InsertBefore(&ast.Node{Type: ast.NodeText, Tokens: n.Tokens})
n.AppendChild(&ast.Node{Type: ast.NodeText, Tokens: n.Tokens})
} else {
src := n.Tokens[index+len("src=\""):]
src = src[:bytes.Index(src, []byte("\""))]
@ -1028,15 +1028,10 @@ func processIFrame(tree *parse.Tree) {
link.AppendChild(&ast.Node{Type: ast.NodeOpenParen})
link.AppendChild(&ast.Node{Type: ast.NodeLinkDest, Tokens: src})
link.AppendChild(&ast.Node{Type: ast.NodeCloseParen})
n.InsertBefore(link)
}
unlinks = append(unlinks, n)
n.AppendChild(link)
}
return ast.WalkContinue
})
for _, n := range unlinks {
n.Unlink()
}
}
func ProcessPDF(id, p string, merge, removeAssets, watermark bool) (err error) {

View file

@ -1256,17 +1256,18 @@ func batchDeleteByPathPrefix(tx *sql.Tx, boxID, pathPrefix string) (err error) {
}
func batchUpdatePath(tx *sql.Tx, tree *parse.Tree, context map[string]interface{}) (err error) {
stmt := "UPDATE blocks SET box = ?, path = ?, hpath = ? WHERE root_id = ?"
if err = execStmtTx(tx, stmt, tree.Box, tree.Path, tree.HPath, tree.ID); err != nil {
ialContent := treenode.IALStr(tree.Root)
stmt := "UPDATE blocks SET box = ?, path = ?, hpath = ?, ial = ? WHERE root_id = ?"
if err = execStmtTx(tx, stmt, tree.Box, tree.Path, tree.HPath, ialContent, tree.ID); err != nil {
return
}
stmt = "UPDATE blocks_fts SET box = ?, path = ?, hpath = ? WHERE root_id = ?"
if err = execStmtTx(tx, stmt, tree.Box, tree.Path, tree.HPath, tree.ID); err != nil {
stmt = "UPDATE blocks_fts SET box = ?, path = ?, hpath = ?, ial = ? WHERE root_id = ?"
if err = execStmtTx(tx, stmt, tree.Box, tree.Path, tree.HPath, ialContent, tree.ID); err != nil {
return
}
if !caseSensitive {
stmt = "UPDATE blocks_fts_case_insensitive SET box = ?, path = ?, hpath = ? WHERE root_id = ?"
if err = execStmtTx(tx, stmt, tree.Box, tree.Path, tree.HPath, tree.ID); err != nil {
stmt = "UPDATE blocks_fts_case_insensitive SET box = ?, path = ?, hpath = ?, ial = ? WHERE root_id = ?"
if err = execStmtTx(tx, stmt, tree.Box, tree.Path, tree.HPath, ialContent, tree.ID); err != nil {
return
}
}
@ -1277,17 +1278,18 @@ func batchUpdatePath(tx *sql.Tx, tree *parse.Tree, context map[string]interface{
}
func batchUpdateHPath(tx *sql.Tx, tree *parse.Tree, context map[string]interface{}) (err error) {
stmt := "UPDATE blocks SET hpath = ? WHERE root_id = ?"
if err = execStmtTx(tx, stmt, tree.HPath, tree.ID); err != nil {
ialContent := treenode.IALStr(tree.Root)
stmt := "UPDATE blocks SET hpath = ?, ial = ? WHERE root_id = ?"
if err = execStmtTx(tx, stmt, tree.HPath, ialContent, tree.ID); err != nil {
return
}
stmt = "UPDATE blocks_fts SET hpath = ? WHERE root_id = ?"
if err = execStmtTx(tx, stmt, tree.HPath, tree.ID); err != nil {
stmt = "UPDATE blocks_fts SET hpath = ?, ial = ? WHERE root_id = ?"
if err = execStmtTx(tx, stmt, tree.HPath, ialContent, tree.ID); err != nil {
return
}
if !caseSensitive {
stmt = "UPDATE blocks_fts_case_insensitive SET hpath = ? WHERE root_id = ?"
if err = execStmtTx(tx, stmt, tree.HPath, tree.ID); err != nil {
stmt = "UPDATE blocks_fts_case_insensitive SET hpath = ?, ial = ? WHERE root_id = ?"
if err = execStmtTx(tx, stmt, tree.HPath, ialContent, tree.ID); err != nil {
return
}
}