An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:sparkles: fix https://github.com/siyuan-note/siyuan/issues/5407
Vanessa9e55cc6c374d
diff --git a/app/appearance/langs/en_US.json b/app/appearance/langs/en_US.jsonindex f9831e6030..0fb2855915 100644--- a/app/appearance/langs/en_US.json+++ b/app/appearance/langs/en_US.json@@ -1,4 +1,5 @@{+ "jumpToParentNext": "Jump to the next block in the previous level","initRepoKeyTip": "If the key has been initialized on other devices, please use [Import Key] or generate the key with the same passphrase, otherwise the data cannot be synced to the cloud, so be sure to use the same key on all devices","crossKeepLazyLoad": "Cross-page multi-selection needs to select [Keep Loaded Content] in the more menu","keepLazyLoad": "Keep loaded content",diff --git a/app/appearance/langs/es_ES.json b/app/appearance/langs/es_ES.jsonindex 7fa3dbd5f8..307d69b061 100644--- a/app/appearance/langs/es_ES.json+++ b/app/appearance/langs/es_ES.json@@ -1,4 +1,5 @@{+ "jumpToParentNext": "Saltar al siguiente bloque en el nivel anterior","initRepoKeyTip": "Si la clave se ha inicializado en otros dispositivos, use [Importar la clave] o genere la clave con la misma contraseña; de lo contrario, los datos no se pueden sincronizar con la nube, así que asegúrese de usar la misma clave en todos los dispositivos.","crossKeepLazyLoad": "La selección múltiple entre páginas debe seleccionar [Mantener contenido cargado] en el menú más","keepLazyLoad": "Mantener el contenido cargado",diff --git a/app/appearance/langs/fr_FR.json b/app/appearance/langs/fr_FR.jsonindex d4cc883e28..ed5d22b5f2 100644--- a/app/appearance/langs/fr_FR.json+++ b/app/appearance/langs/fr_FR.json@@ -1,4 +1,5 @@{+ "jumpToParentNext": "Aller au bloc suivant du niveau précédent","initRepoKeyTip": "Si la clé a été initialisée sur d'autres appareils, veuillez utiliser [Importer la clé] ou générer la clé avec le même mot de passe, sinon les données ne peuvent pas être synchronisées avec le cloud, alors assurez-vous d'utiliser la même clé sur tous les appareils","crossKeepLazyLoad": "La multi-sélection sur plusieurs pages doit sélectionner [Conserver le contenu chargé] dans le menu plus","keepLazyLoad": "Conserver le contenu chargé",diff --git a/app/appearance/langs/zh_CHT.json b/app/appearance/langs/zh_CHT.jsonindex f2b3ff080b..cca17b3926 100644--- a/app/appearance/langs/zh_CHT.json+++ b/app/appearance/langs/zh_CHT.json@@ -1,4 +1,5 @@{+ "jumpToParentNext": "跳轉到上一層級的下一個塊","initRepoKeyTip": "如果其他設備上已經初始化過密鑰,請使用 [導入密鑰] 或者通過相同的密碼生成密鑰,否則無法雲端同步數據,所以請務必在所有設備上使用相同的密鑰","crossKeepLazyLoad": "跨頁多選需在更多菜單中選中【保持已加載內容】","keepLazyLoad": "保持已加載的內容",diff --git a/app/appearance/langs/zh_CN.json b/app/appearance/langs/zh_CN.jsonindex ea07a5cb69..11b5ab70cb 100644--- a/app/appearance/langs/zh_CN.json+++ b/app/appearance/langs/zh_CN.json@@ -1,4 +1,5 @@{+ "jumpToParentNext": "跳转到上一层级的下一个块","initRepoKeyTip": "如果其他设备上已经初始化过密钥,请使用 [导入密钥] 或者通过相同的密码生成密钥,否则无法云端同步数据,所以请务必在所有设备上使用相同的密钥","crossKeepLazyLoad": "跨页多选需在更多菜单中选中 [保持已加载内容]","keepLazyLoad": "保持已加载的内容",diff --git a/app/src/block/util.ts b/app/src/block/util.tsindex 904151b187..9178685a9a 100644--- a/app/src/block/util.ts+++ b/app/src/block/util.ts@@ -1,6 +1,6 @@-import {focusByWbr, getEditorRange} from "../protyle/util/selection";-import {hasClosestBlock} from "../protyle/util/hasClosest";-import {getTopAloneElement} from "../protyle/wysiwyg/getBlock";+import {focusBlock, focusByWbr, getEditorRange} from "../protyle/util/selection";+import {hasClosestBlock, hasClosestByClassName} from "../protyle/util/hasClosest";+import {getNextBlock, getTopAloneElement} from "../protyle/wysiwyg/getBlock";import {genListItemElement, updateListOrder} from "../protyle/wysiwyg/list";import {transaction, updateTransaction} from "../protyle/wysiwyg/transaction";import {scrollCenter} from "../util/highlightById";@@ -60,6 +60,18 @@ export const genSBElement = (layout: string, id?: string, attrHTML?: string) =>return sbElement;};+export const jumpToParentNext = (protyle:IProtyle,nodeElement: Element) => {+ const topElement = getTopAloneElement(nodeElement);+ if (topElement) {+ const topParentElement = hasClosestByClassName(topElement, "list") || hasClosestByClassName(topElement, "bq") || hasClosestByClassName(topElement, "sb") || topElement+ const nextElement = getNextBlock(topParentElement)+ if (nextElement) {+ focusBlock(nextElement)+ scrollCenter(protyle, nextElement);+ }+ }+}+export const insertEmptyBlock = (protyle: IProtyle, position: InsertPosition, id?: string) => {const range = getEditorRange(protyle.wysiwyg.element);let blockElement: Element;diff --git a/app/src/constants.ts b/app/src/constants.tsindex 163b23e740..91bd3bd05e 100644--- a/app/src/constants.ts+++ b/app/src/constants.ts@@ -146,6 +146,7 @@ export abstract class Constants {preview: {default: "⌥⌘9", custom: "⌥⌘9"},insertBefore: {default: "⇧⌘B", custom: "⇧⌘B"},insertAfter: {default: "⇧⌘A", custom: "⇧⌘A"},+ jumpToParentNext: {default: "⇧⌘N", custom: "⇧⌘N"},moveToUp: {default: "⇧⌘↑", custom: "⇧⌘↑"},moveToDown: {default: "⇧⌘↓", custom: "⇧⌘↓"},},diff --git a/app/src/protyle/gutter/index.ts b/app/src/protyle/gutter/index.tsindex a945189c71..a6d4af8a96 100644--- a/app/src/protyle/gutter/index.ts+++ b/app/src/protyle/gutter/index.ts@@ -16,7 +16,7 @@ import {removeEmbed} from "../wysiwyg/removeEmbed";import {getContenteditableElement, getTopAloneElement, isNotEditBlock} from "../wysiwyg/getBlock";import * as dayjs from "dayjs";import {fetchPost} from "../../util/fetch";-import {cancelSB, insertEmptyBlock} from "../../block/util";+import {cancelSB, insertEmptyBlock, jumpToParentNext} from "../../block/util";import {scrollCenter} from "../../util/highlightById";import {isMobile} from "../../util/functions";import {confirmDialog} from "../../dialog/confirmDialog";@@ -1094,6 +1094,14 @@ export class Gutter {insertEmptyBlock(protyle, "afterend", id);}}).element);+ window.siyuan.menus.menu.append(new MenuItem({+ label: window.siyuan.languages.jumpToParentNext,+ accelerator: window.siyuan.config.keymap.editor.general.jumpToParentNext.custom,+ click() {+ nodeElement.classList.remove("protyle-wysiwyg--select");+ jumpToParentNext(protyle, nodeElement)+ }+ }).element);window.siyuan.menus.menu.append(new MenuItem({type: "separator"}).element);window.siyuan.menus.menu.append(new MenuItem({diff --git a/app/src/protyle/wysiwyg/keydown.ts b/app/src/protyle/wysiwyg/keydown.tsindex ddab883598..e21e26e8a1 100644--- a/app/src/protyle/wysiwyg/keydown.ts+++ b/app/src/protyle/wysiwyg/keydown.ts@@ -32,7 +32,7 @@ import {phTransaction, transaction, turnsIntoTransaction, updateTransaction} froimport {fontEvent} from "../toolbar/Font";import {listIndent, listOutdent, updateListOrder} from "./list";import {newFileBySelect, newFileContentBySelect, rename, replaceFileName} from "../../editor/rename";-import {insertEmptyBlock} from "../../block/util";+import {insertEmptyBlock, jumpToParentNext} from "../../block/util";import {isLocalPath} from "../../util/pathName";/// #if !BROWSERimport {clipboard} from "electron";@@ -1189,6 +1189,12 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {event.stopPropagation();return true;}+ if (matchHotKey(window.siyuan.config.keymap.editor.general.jumpToParentNext.custom, event)) {+ jumpToParentNext(protyle, nodeElement)+ event.preventDefault();+ event.stopPropagation();+ return true;+ }if (matchHotKey(window.siyuan.config.keymap.editor.general.moveToUp.custom, event)) {event.preventDefault();