An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:art: https://github.com/siyuan-note/siyuan/issues/17800
Vanessa0ea6f410c379
diff --git a/app/src/protyle/hint/index.ts b/app/src/protyle/hint/index.tsindex 7b4112f146..32d85c9472 100644--- a/app/src/protyle/hint/index.ts+++ b/app/src/protyle/hint/index.ts@@ -1,5 +1,11 @@import {Constants} from "../../constants";-import {hasClosestBlock, hasClosestByAttribute, hasClosestByClassName, hasClosestByTag} from "../util/hasClosest";+import {+ hasClosestBlock,+ hasClosestByAttribute,+ hasClosestByClassName,+ hasClosestByTag,+ isInEmbedBlock+} from "../util/hasClosest";import {focusBlock,focusByRange,@@ -190,7 +196,8 @@ ${unicode2Emoji(emoji.unicode)}</button>`;// https://github.com/siyuan-note/siyuan/issues/5083if (this.splitChar === "/" || this.splitChar === "、") {clearTimeout(this.timeId);- if (this.enableSlash && !isMobile()) {+ const blockElement = hasClosestBlock(protyle.toolbar.range.startContainer);+ if (this.enableSlash && !isMobile() && blockElement && !isInEmbedBlock(blockElement)) {this.genHTML(hintSlash(key, protyle), protyle, false, "hint");}return;diff --git a/app/src/protyle/wysiwyg/keydown.ts b/app/src/protyle/wysiwyg/keydown.tsindex 6198b23086..349ff71e8a 100644--- a/app/src/protyle/wysiwyg/keydown.ts+++ b/app/src/protyle/wysiwyg/keydown.ts@@ -140,7 +140,8 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {return;}- if (nodeElement.classList.contains("protyle-wysiwyg--select") && isNotCtrl(event) && !event.shiftKey && !event.altKey) {+ if (nodeElement.classList.contains("protyle-wysiwyg--select") && isNotCtrl(event) && !event.shiftKey && !event.altKey &&+ !isInEmbedBlock(nodeElement)) {if (event.key.toLowerCase() === "a") {event.stopPropagation();event.preventDefault();@@ -166,12 +167,11 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {}// https://github.com/siyuan-note/siyuan/issues/2261if (!["⌘", "⇧", "⌥", "⌃"].includes(Constants.KEYCODELIST[event.keyCode])) {- if ((Constants.KEYCODELIST[event.keyCode] === "/" ||- // 德语- event.key === "/" ||- // windows 中文- (event.code === "Slash" && event.key === "Process" && event.keyCode === 229)) &&- !isInEmbedBlock(nodeElement)) {+ if (Constants.KEYCODELIST[event.keyCode] === "/" ||+ // 德语+ event.key === "/" ||+ // windows 中文+ (event.code === "Slash" && event.key === "Process" && event.keyCode === 229)) {protyle.hint.enableSlash = true;} else if (Constants.KEYCODELIST[event.keyCode] === "\\" ||// 德语@@ -1494,7 +1494,8 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {return true;}if (matchHotKey(window.siyuan.config.keymap.editor.insert.code.custom, event) &&- !["NodeCodeBlock", "NodeHeading", "NodeTable"].includes(nodeType)) {+ !["NodeCodeBlock", "NodeHeading", "NodeTable"].includes(nodeType) &&+ !isInEmbedBlock(nodeElement)) {const editElement = getContenteditableElement(nodeElement);if (editElement) {const id = nodeElement.getAttribute("data-node-id");@@ -1610,7 +1611,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {const isMatchCheck = matchHotKey(window.siyuan.config.keymap.editor.insert.check.custom, event);const isMatchOList = matchHotKey(window.siyuan.config.keymap.editor.insert["ordered-list"].custom, event);const isMatchQuote = matchHotKey(window.siyuan.config.keymap.editor.insert.quote.custom, event);- if (isMatchList || isMatchOList || isMatchCheck || isMatchQuote) {+ if ((isMatchList || isMatchOList || isMatchCheck || isMatchQuote) && !isInEmbedBlock(nodeElement)) {const selectsElement: HTMLElement[] = Array.from(protyle.wysiwyg.element.querySelectorAll(".protyle-wysiwyg--select"));if (selectsElement.length === 0) {selectsElement.push(nodeElement);@@ -1696,7 +1697,8 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {return;}- if (matchHotKey(window.siyuan.config.keymap.editor.insert.table.custom, event)) {+ if (matchHotKey(window.siyuan.config.keymap.editor.insert.table.custom, event) &&+ !isInEmbedBlock(nodeElement)) {protyle.hint.splitChar = "/";protyle.hint.lastIndex = -1;protyle.hint.fill(`| ${Lute.Caret} | | |\n| --- | --- | --- |\n| | | |\n| | | |`, protyle);@@ -1724,14 +1726,16 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {event.stopPropagation();return;}- if (matchHotKey(window.siyuan.config.keymap.editor.general.insertBefore.custom, event)) {+ if (matchHotKey(window.siyuan.config.keymap.editor.general.insertBefore.custom, event) &&+ !isInEmbedBlock(nodeElement)) {// https://github.com/siyuan-note/siyuan/issues/14290#issuecomment-2846594701nodeElement.querySelector(".img--select")?.classList.remove("img--select");insertEmptyBlock(protyle, "beforebegin");event.preventDefault();return true;}- if (matchHotKey(window.siyuan.config.keymap.editor.general.insertAfter.custom, event)) {+ if (matchHotKey(window.siyuan.config.keymap.editor.general.insertAfter.custom, event) &&+ !isInEmbedBlock(nodeElement)) {nodeElement.querySelector(".img--select")?.classList.remove("img--select");insertEmptyBlock(protyle, "afterend");event.preventDefault();