An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:bug: fix https://github.com/siyuan-note/siyuan/issues/5751
Vanessa107711469b42
diff --git a/app/src/editor/getIcon.ts b/app/src/editor/getIcon.tsindex 96e8c3c7ff..5f67d64eaa 100644--- a/app/src/editor/getIcon.ts+++ b/app/src/editor/getIcon.ts@@ -66,54 +66,3 @@ export const getIconByType = (type: string, sub?: string) => {}return iconName;};--export const getIconByElement = (blockElement: HTMLElement) => {- let iconName = "iconParagraph";- let iconTitle = window.siyuan.languages.paragraph;- if (blockElement.tagName.indexOf("H") > -1) {- iconName = "icon" + blockElement.tagName;- iconTitle = window.siyuan.languages.headings;- } else if (blockElement.tagName === "BLOCKQUOTE") {- iconName = "iconQuote";- iconTitle = window.siyuan.languages.quote;- } else if (blockElement.tagName === "TABLE") {- iconName = "iconTable";- iconTitle = window.siyuan.languages.table;- } else if (blockElement.tagName === "UL" || blockElement.tagName === "OL") {- if (blockElement.firstElementChild.classList.contains("protyle-task")) {- iconName = "iconCheck";- iconTitle = window.siyuan.languages.check;- } else if (blockElement.tagName === "UL") {- iconName = "iconList";- iconTitle = window.siyuan.languages.list;- } else if (blockElement.tagName === "OL") {- iconName = "iconOrderedList";- iconTitle = window.siyuan.languages["ordered-list"];- }- } else if (blockElement.tagName === "LI") {- iconName = "iconMenu";- iconTitle = window.siyuan.languages.listItem;- } else {- switch (blockElement.getAttribute("data-type")) {- case "math-block":- iconName = "iconMath";- iconTitle = window.siyuan.languages.math;- break;- case "block-query-embed":- iconName = "iconSQL";- iconTitle = window.siyuan.languages.blockEmbed;- break;- case "super-block":- iconName = "iconSuper";- iconTitle = window.siyuan.languages.superBlock;- break;- case "html-block":- case "code-block":- case "yaml-front-matter":- iconName = "iconCode";- iconTitle = window.siyuan.languages.code;- break;- }- }- return {iconName, iconTitle};-};diff --git a/app/src/protyle/util/hotKey.ts b/app/src/protyle/util/hotKey.tsindex 8e006ad17d..9408cd7f0b 100644--- a/app/src/protyle/util/hotKey.ts+++ b/app/src/protyle/util/hotKey.ts@@ -56,7 +56,7 @@ export const matchHotKey = (hotKey: string, event: KeyboardEvent) => {const keyCode = hotKeys.length === 3 ? hotKeys[2] : hotKeys[1];if ((hotKeys.length === 3 ? isCtrl(event) : !isCtrl(event)) && event.altKey && !event.shiftKey &&(- (/^[0-9]$/.test(keyCode) ? (event.code === "Digit" + keyCode || event.code === "Numpad" + keyCode) : event.code === "Key" + keyCode) ||+ (/^[0-9]$/.test(keyCode) ? (event.code === "Digit" + keyCode || event.code === "Numpad" + keyCode) : event.code === "Key" + keyCode) ||event.code === keyCode ||(event.code === "Period" && keyCode === ".") ||(event.code === "BracketLeft" && keyCode === "[") || (event.code === "BracketRight" && keyCode === "]")@@ -69,7 +69,8 @@ export const matchHotKey = (hotKey: string, event: KeyboardEvent) => {// 是否匹配 ⇧⌘[] / ⌘[]const hasShift = hotKeys.length > 2 && (hotKeys[0] === "⇧");let key = (hasShift ? hotKeys[2] : hotKeys[1]);- if (hasShift && !/Mac/.test(navigator.platform)) {+ if (hasShift // 更新 electron 后不需要判断 mac && !/Mac/.test(navigator.platform)+ ) {if (key === "-") {key = "_";} else if (key === "=") {diff --git a/app/src/protyle/util/paste.ts b/app/src/protyle/util/paste.tsindex 64103e2698..8e6a711588 100644--- a/app/src/protyle/util/paste.ts+++ b/app/src/protyle/util/paste.ts@@ -208,7 +208,8 @@ export const paste = async (protyle: IProtyle, event: (ClipboardEvent | DragEvenconst tempElement = document.createElement("div");if (textHTML.startsWith(Constants.ZWSP)) {// 剪切块内容后粘贴- tempElement.innerHTML = textHTML.substr(1);+ // mac 复制后会带有 <meta charset="utf-8"> https://github.com/siyuan-note/siyuan/issues/5751+ tempElement.innerHTML = textHTML.substr(1).replace('<meta charset="utf-8">', "");let isBlock = false;tempElement.querySelectorAll("[data-node-id]").forEach((e) => {e.classList.remove("protyle-wysiwyg--select", "protyle-wysiwyg--hl");@@ -224,7 +225,7 @@ export const paste = async (protyle: IProtyle, event: (ClipboardEvent | DragEvenfilterClipboardHint(protyle, tempMd);} else if (textHTML.endsWith(Constants.ZWSP)) {// 编辑器内部粘贴- tempElement.innerHTML = textHTML.substr(0, textHTML.length - 1);+ tempElement.innerHTML = textHTML.substr(0, textHTML.length - 1).replace('<meta charset="utf-8">', "");tempElement.querySelectorAll("[data-node-id]").forEach((e) => {const newId = Lute.NewNodeID();e.setAttribute("data-node-id", newId);