mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 22:50:13 +01:00
Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
0bec8594a1
4 changed files with 36 additions and 38 deletions
|
|
@ -228,7 +228,8 @@ export abstract class Constants {
|
||||||
public static readonly MENU_BAR_WORKSPACE = "barWorkspace"; // 顶栏主菜单
|
public static readonly MENU_BAR_WORKSPACE = "barWorkspace"; // 顶栏主菜单
|
||||||
public static readonly MENU_BAR_PLUGIN = "topBarPlugin"; // 顶栏插件菜单
|
public static readonly MENU_BAR_PLUGIN = "topBarPlugin"; // 顶栏插件菜单
|
||||||
public static readonly MENU_BAR_ZOOM = "barZoom"; // 顶栏缩放菜单
|
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_HELP = "statusHelp"; // 状态栏帮助菜单
|
||||||
public static readonly MENU_STATUS_BACKGROUND_TASK = "statusBackgroundTask"; // 状态栏后台任务菜单
|
public static readonly MENU_STATUS_BACKGROUND_TASK = "statusBackgroundTask"; // 状态栏后台任务菜单
|
||||||
public static readonly MENU_DOCK_MOBILE = "dockMobileMenu"; // 移动端侧栏插件选项菜单
|
public static readonly MENU_DOCK_MOBILE = "dockMobileMenu"; // 移动端侧栏插件选项菜单
|
||||||
|
|
|
||||||
|
|
@ -127,12 +127,12 @@ export const initBar = (app: App) => {
|
||||||
break;
|
break;
|
||||||
} else if (targetId === "barMode") {
|
} else if (targetId === "barMode") {
|
||||||
if (!window.siyuan.menus.menu.element.classList.contains("fn__none") &&
|
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();
|
window.siyuan.menus.menu.remove();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
window.siyuan.menus.menu.remove();
|
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({
|
window.siyuan.menus.menu.append(new MenuItem({
|
||||||
id: "themeLight",
|
id: "themeLight",
|
||||||
label: window.siyuan.languages.themeLight,
|
label: window.siyuan.languages.themeLight,
|
||||||
|
|
|
||||||
|
|
@ -1008,35 +1008,30 @@ func prepareExportTree(bt *treenode.BlockTree) (ret *parse.Tree) {
|
||||||
|
|
||||||
func processIFrame(tree *parse.Tree) {
|
func processIFrame(tree *parse.Tree) {
|
||||||
// 导出 PDF/Word 时 IFrame 块使用超链接 https://github.com/siyuan-note/siyuan/issues/4035
|
// 导出 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 {
|
ast.Walk(tree.Root, func(n *ast.Node, entering bool) ast.WalkStatus {
|
||||||
if !entering {
|
if !entering || ast.NodeIFrame != n.Type {
|
||||||
return ast.WalkContinue
|
return ast.WalkContinue
|
||||||
}
|
}
|
||||||
if ast.NodeIFrame == n.Type {
|
|
||||||
index := bytes.Index(n.Tokens, []byte("src=\""))
|
n.Type = ast.NodeParagraph
|
||||||
if 0 > index {
|
index := bytes.Index(n.Tokens, []byte("src=\""))
|
||||||
n.InsertBefore(&ast.Node{Type: ast.NodeText, Tokens: n.Tokens})
|
if 0 > index {
|
||||||
} else {
|
n.AppendChild(&ast.Node{Type: ast.NodeText, Tokens: n.Tokens})
|
||||||
src := n.Tokens[index+len("src=\""):]
|
} else {
|
||||||
src = src[:bytes.Index(src, []byte("\""))]
|
src := n.Tokens[index+len("src=\""):]
|
||||||
src = html.UnescapeHTML(src)
|
src = src[:bytes.Index(src, []byte("\""))]
|
||||||
link := &ast.Node{Type: ast.NodeLink}
|
src = html.UnescapeHTML(src)
|
||||||
link.AppendChild(&ast.Node{Type: ast.NodeOpenBracket})
|
link := &ast.Node{Type: ast.NodeLink}
|
||||||
link.AppendChild(&ast.Node{Type: ast.NodeText, Tokens: src})
|
link.AppendChild(&ast.Node{Type: ast.NodeOpenBracket})
|
||||||
link.AppendChild(&ast.Node{Type: ast.NodeCloseBracket})
|
link.AppendChild(&ast.Node{Type: ast.NodeText, Tokens: src})
|
||||||
link.AppendChild(&ast.Node{Type: ast.NodeOpenParen})
|
link.AppendChild(&ast.Node{Type: ast.NodeCloseBracket})
|
||||||
link.AppendChild(&ast.Node{Type: ast.NodeLinkDest, Tokens: src})
|
link.AppendChild(&ast.Node{Type: ast.NodeOpenParen})
|
||||||
link.AppendChild(&ast.Node{Type: ast.NodeCloseParen})
|
link.AppendChild(&ast.Node{Type: ast.NodeLinkDest, Tokens: src})
|
||||||
n.InsertBefore(link)
|
link.AppendChild(&ast.Node{Type: ast.NodeCloseParen})
|
||||||
}
|
n.AppendChild(link)
|
||||||
unlinks = append(unlinks, n)
|
|
||||||
}
|
}
|
||||||
return ast.WalkContinue
|
return ast.WalkContinue
|
||||||
})
|
})
|
||||||
for _, n := range unlinks {
|
|
||||||
n.Unlink()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func ProcessPDF(id, p string, merge, removeAssets, watermark bool) (err error) {
|
func ProcessPDF(id, p string, merge, removeAssets, watermark bool) (err error) {
|
||||||
|
|
|
||||||
|
|
@ -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) {
|
func batchUpdatePath(tx *sql.Tx, tree *parse.Tree, context map[string]interface{}) (err error) {
|
||||||
stmt := "UPDATE blocks SET box = ?, path = ?, hpath = ? WHERE root_id = ?"
|
ialContent := treenode.IALStr(tree.Root)
|
||||||
if err = execStmtTx(tx, stmt, tree.Box, tree.Path, tree.HPath, tree.ID); err != nil {
|
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
|
return
|
||||||
}
|
}
|
||||||
stmt = "UPDATE blocks_fts SET box = ?, path = ?, hpath = ? WHERE root_id = ?"
|
stmt = "UPDATE blocks_fts SET box = ?, path = ?, hpath = ?, ial = ? WHERE root_id = ?"
|
||||||
if err = execStmtTx(tx, stmt, tree.Box, tree.Path, tree.HPath, tree.ID); err != nil {
|
if err = execStmtTx(tx, stmt, tree.Box, tree.Path, tree.HPath, ialContent, tree.ID); err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if !caseSensitive {
|
if !caseSensitive {
|
||||||
stmt = "UPDATE blocks_fts_case_insensitive SET box = ?, path = ?, hpath = ? WHERE root_id = ?"
|
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, tree.ID); err != nil {
|
if err = execStmtTx(tx, stmt, tree.Box, tree.Path, tree.HPath, ialContent, tree.ID); err != nil {
|
||||||
return
|
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) {
|
func batchUpdateHPath(tx *sql.Tx, tree *parse.Tree, context map[string]interface{}) (err error) {
|
||||||
stmt := "UPDATE blocks SET hpath = ? WHERE root_id = ?"
|
ialContent := treenode.IALStr(tree.Root)
|
||||||
if err = execStmtTx(tx, stmt, tree.HPath, tree.ID); err != nil {
|
stmt := "UPDATE blocks SET hpath = ?, ial = ? WHERE root_id = ?"
|
||||||
|
if err = execStmtTx(tx, stmt, tree.HPath, ialContent, tree.ID); err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
stmt = "UPDATE blocks_fts SET hpath = ? WHERE root_id = ?"
|
stmt = "UPDATE blocks_fts SET hpath = ?, ial = ? WHERE root_id = ?"
|
||||||
if err = execStmtTx(tx, stmt, tree.HPath, tree.ID); err != nil {
|
if err = execStmtTx(tx, stmt, tree.HPath, ialContent, tree.ID); err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if !caseSensitive {
|
if !caseSensitive {
|
||||||
stmt = "UPDATE blocks_fts_case_insensitive SET hpath = ? WHERE root_id = ?"
|
stmt = "UPDATE blocks_fts_case_insensitive SET hpath = ?, ial = ? WHERE root_id = ?"
|
||||||
if err = execStmtTx(tx, stmt, tree.HPath, tree.ID); err != nil {
|
if err = execStmtTx(tx, stmt, tree.HPath, ialContent, tree.ID); err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue