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: fix https://github.com/siyuan-note/siyuan/issues/8993
Vanessa45e0303c9bd8
diff --git a/app/src/menus/protyle.ts b/app/src/menus/protyle.tsindex 1a37339cd2..38078c55f4 100644--- a/app/src/menus/protyle.ts+++ b/app/src/menus/protyle.ts@@ -724,33 +724,6 @@ export const imgMenu = (protyle: IProtyle, range: Range, assetElement: HTMLElemecopyPNG(imgElement);}}).element);- /// #if !BROWSER- window.siyuan.menus.menu.append(new MenuItem({- label: "OCR",- submenu: [{- iconHTML: Constants.ZWSP,- label: window.siyuan.languages.reOCR,- click() {- fetchPost("/api/asset/getImageOCRText", {- path: imgElement.getAttribute("src"),- force: true- });- }- }, {- iconHTML: Constants.ZWSP,- label: `<textarea data-type="ocr" style="margin: 4px 0" rows="1" class="b3-text-field fn__size200" placeholder="${window.siyuan.languages.ocrResult}"></textarea>`,- bind(element) {- fetchPost("/api/asset/getImageOCRText", {- path: imgElement.getAttribute("src"),- force: false- }, (response) => {- element.querySelector("textarea").value = response.data.text;- });- }- }],- }).element);- window.siyuan.menus.menu.append(new MenuItem(exportAsset(imgElement.getAttribute("data-src"))).element);- /// #endifwindow.siyuan.menus.menu.append(new MenuItem({icon: "iconCut",accelerator: "⌘X",@@ -784,6 +757,32 @@ export const imgMenu = (protyle: IProtyle, range: Range, assetElement: HTMLEleme}}).element);}+ /// #if !BROWSER+ window.siyuan.menus.menu.append(new MenuItem({+ label: "OCR",+ submenu: [{+ iconHTML: Constants.ZWSP,+ label: window.siyuan.languages.reOCR,+ click() {+ fetchPost("/api/asset/getImageOCRText", {+ path: imgElement.getAttribute("src"),+ force: true+ });+ }+ }, {+ iconHTML: Constants.ZWSP,+ label: `<textarea data-type="ocr" style="margin: 4px 0" rows="1" class="b3-text-field fn__size200" placeholder="${window.siyuan.languages.ocrResult}"></textarea>`,+ bind(element) {+ fetchPost("/api/asset/getImageOCRText", {+ path: imgElement.getAttribute("src"),+ force: false+ }, (response) => {+ element.querySelector("textarea").value = response.data.text;+ });+ }+ }],+ }).element);+ /// #endifwindow.siyuan.menus.menu.append(new MenuItem({icon: "iconAlignCenter",label: window.siyuan.languages.alignCenter,@@ -840,6 +839,9 @@ export const imgMenu = (protyle: IProtyle, range: Range, assetElement: HTMLElemewindow.siyuan.menus.menu.append(new MenuItem({type: "separator"}).element);openMenu(protyle.app, imgSrc, false, false);}+ /// #if !BROWSER+ window.siyuan.menus.menu.append(new MenuItem(exportAsset(imgElement.getAttribute("data-src"))).element);+ /// #endifif (protyle?.app?.plugins) {emitOpenMenu({plugins: protyle.app.plugins,@@ -964,8 +966,33 @@ export const linkMenu = (protyle: IProtyle, linkElement: HTMLElement, focusText});}}).element);- if (linkAddress) {- openMenu(protyle.app, linkAddress, false, true);+ window.siyuan.menus.menu.append(new MenuItem({+ icon: "iconTrashcan",+ label: window.siyuan.languages.remove,+ click() {+ const oldHTML = nodeElement.outerHTML;+ linkElement.insertAdjacentHTML("afterend", "<wbr>");+ linkElement.remove();+ nodeElement.setAttribute("updated", dayjs().format("YYYYMMDDHHmmss"));+ updateTransaction(protyle, id, nodeElement.outerHTML, oldHTML);+ focusByWbr(nodeElement, protyle.toolbar.range);+ }+ }).element);+ window.siyuan.menus.menu.append(new MenuItem({+ label: `${window.siyuan.languages.turnInto} <b>${window.siyuan.languages.text}</b>`,+ icon: "iconRefresh",+ click() {+ removeLink(linkElement, protyle.toolbar.range);+ updateTransaction(protyle, id, nodeElement.outerHTML, html);+ }+ }).element);+ if (linkAddress?.startsWith("assets/")) {+ window.siyuan.menus.menu.append(new MenuItem({+ label: window.siyuan.languages.rename,+ click() {+ renameAsset(linkAddress);+ }+ }).element);}if (linkAddress?.startsWith("siyuan://blocks/")) {window.siyuan.menus.menu.append(new MenuItem({@@ -988,35 +1015,15 @@ export const linkMenu = (protyle: IProtyle, linkElement: HTMLElement, focusText}}).element);}- window.siyuan.menus.menu.append(new MenuItem({- label: `${window.siyuan.languages.turnInto} <b>${window.siyuan.languages.text}</b>`,- icon: "iconRefresh",- click() {- removeLink(linkElement, protyle.toolbar.range);- updateTransaction(protyle, id, nodeElement.outerHTML, html);+ if (linkAddress) {+ window.siyuan.menus.menu.append(new MenuItem({type: "separator"}).element)+ openMenu(protyle.app, linkAddress, false, true);+ /// #if !BROWSER+ if (linkAddress?.startsWith("assets/")) {+ window.siyuan.menus.menu.append(new MenuItem(exportAsset(linkAddress)).element)}- }).element);- if (linkAddress?.startsWith("assets/")) {- window.siyuan.menus.menu.append(new MenuItem({- label: window.siyuan.languages.rename,- click() {- renameAsset(linkAddress);- }- }).element);+ /// #endif}- window.siyuan.menus.menu.append(new MenuItem({- icon: "iconTrashcan",- label: window.siyuan.languages.remove,- click() {- const oldHTML = nodeElement.outerHTML;- linkElement.insertAdjacentHTML("afterend", "<wbr>");- linkElement.remove();- nodeElement.setAttribute("updated", dayjs().format("YYYYMMDDHHmmss"));- updateTransaction(protyle, id, nodeElement.outerHTML, oldHTML);- focusByWbr(nodeElement, protyle.toolbar.range);- }- }).element);-if (protyle?.app?.plugins) {emitOpenMenu({plugins: protyle.app.plugins,@@ -1286,13 +1293,16 @@ export const videoMenu = (protyle: IProtyle, nodeElement: Element, type: string)}});}- /// #if !BROWSER- subMenus.push(exportAsset(src));- /// #endifconst VideoSrc = videoElement.getAttribute("src");if (VideoSrc) {- return subMenus.concat(openMenu(protyle.app, VideoSrc, true, false) as IMenu[]);+ subMenus.push({+ label: window.siyuan.languages.openBy,+ submenu: openMenu(protyle.app, VideoSrc, true, false) as IMenu[]+ });}+ /// #if !BROWSER+ subMenus.push(exportAsset(src));+ /// #endifreturn subMenus;};