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: Support converting network assets to local https://github.com/siyuan-note/siyuan/issues/9826
Daniel2e0b2ba967fd
diff --git a/app/appearance/langs/en_US.json b/app/appearance/langs/en_US.jsonindex 43988e20a1..f08b8ec49a 100644--- a/app/appearance/langs/en_US.json+++ b/app/appearance/langs/en_US.json@@ -450,6 +450,7 @@"searchBackmention": "Backlink mentions (backlink mentions search keywords are obtained from)","searchVirtualRef": "Virtual reference (virtual reference search keywords are obtained from)","netImg2LocalAsset": "Convert network images to local images",+ "netAssets2LocalAssets": "Convert network assets to local","releaseDate": "Release Date","pkgSize": "Package size","installSize": "Install Size",diff --git a/app/appearance/langs/es_ES.json b/app/appearance/langs/es_ES.jsonindex 7add10a260..3bc0e906e5 100644--- a/app/appearance/langs/es_ES.json+++ b/app/appearance/langs/es_ES.json@@ -450,6 +450,7 @@"searchBackmention": "Menciones de backlinks (las menciones de backlinks de las que se obtienen las palabras clave de la búsqueda)","searchVirtualRef": "Referencia virtual (las palabras clave de búsqueda de referencias virtuales se obtienen a partir de ellas)","netImg2LocalAsset": "Convertir imágenes de red en imágenes locales",+ "netAssets2LocalAssets": "Convertir activos de red a locales","releaseDate": "Fecha de lanzamiento","pkgSize": "Tamaño del paquete","installSize": "Tamaño de instalación",diff --git a/app/appearance/langs/fr_FR.json b/app/appearance/langs/fr_FR.jsonindex 699f5d4571..abf03aedde 100644--- a/app/appearance/langs/fr_FR.json+++ b/app/appearance/langs/fr_FR.json@@ -450,6 +450,7 @@"searchBackmention": "Mentions de backlink (les mentions de backlink à partir desquelles les mots-clés de recherche sont obtenus)","searchVirtualRef": "Référence virtuelle (les mots-clés de recherche de référence virtuelle sont obtenus à partir de)","netImg2LocalAsset": "Convertir des images réseau en images locales",+ "netAssets2LocalAssets": "Convertir les actifs réseau en local","releaseDate": "Date de sortie","pkgSize": "Taille du package","installSize": "Taille d'installation",diff --git a/app/appearance/langs/zh_CHT.json b/app/appearance/langs/zh_CHT.jsonindex 0b75f3e307..d6a9cf3dad 100644--- a/app/appearance/langs/zh_CHT.json+++ b/app/appearance/langs/zh_CHT.json@@ -450,6 +450,7 @@"searchBackmention": "反連提及(反連提及搜索關鍵字從以下方式獲得)","searchVirtualRef": "虛擬引用(虛擬引用搜索關鍵字從以下方式獲得)","netImg2LocalAsset": "網絡圖片轉換為本地圖片",+ "netAssets2LocalAssets": "網路資源檔案轉換本地","releaseDate": "發布日期","pkgSize": "檔大小","installSize": "安裝大小",diff --git a/app/appearance/langs/zh_CN.json b/app/appearance/langs/zh_CN.jsonindex 72ad87541f..8d7ce494cb 100644--- a/app/appearance/langs/zh_CN.json+++ b/app/appearance/langs/zh_CN.json@@ -450,6 +450,7 @@"searchBackmention": "反链提及(反链提及搜索关键字从以下方式获得)","searchVirtualRef": "虚拟引用(虚拟引用搜索关键字从以下方式获得)","netImg2LocalAsset": "网络图片转换为本地图片",+ "netAssets2LocalAssets": "网络资源文件转换本地","releaseDate": "发布日期","pkgSize": "包大小","installSize": "安装大小",diff --git a/app/src/protyle/breadcrumb/action.ts b/app/src/protyle/breadcrumb/action.tsindex 71c0e71259..d64127922a 100644--- a/app/src/protyle/breadcrumb/action.ts+++ b/app/src/protyle/breadcrumb/action.ts@@ -9,6 +9,27 @@ import {hasClosestByClassName} from "../util/hasClosest";import {reloadProtyle} from "../util/reload";import {resize} from "../util/resize";+export const netAssets2LocalAssets = (protyle: IProtyle) => {+ if (protyle.element.querySelector(".wysiwygLoading")) {+ return;+ }+ addLoading(protyle);+ hideElements(["toolbar"], protyle);+ fetchPost("/api/format/netAssets2LocalAssets", {+ id: protyle.block.rootID+ }, () => {+ /// #if MOBILE+ reloadProtyle(protyle, false);+ /// #else+ getAllModels().editor.forEach(item => {+ if (item.editor.protyle.block.rootID === protyle.block.rootID) {+ reloadProtyle(item.editor.protyle, item.editor.protyle.element.isSameNode(protyle.element));+ }+ });+ /// #endif+ });+};+export const netImg2LocalAssets = (protyle: IProtyle) => {if (protyle.element.querySelector(".wysiwygLoading")) {return;diff --git a/app/src/protyle/breadcrumb/index.ts b/app/src/protyle/breadcrumb/index.tsindex 6db2f0faee..39fe594fc5 100644--- a/app/src/protyle/breadcrumb/index.ts+++ b/app/src/protyle/breadcrumb/index.ts@@ -2,7 +2,7 @@ import {getIconByType} from "../../editor/getIcon";import {fetchPost} from "../../util/fetch";import {Constants} from "../../constants";import {MenuItem} from "../../menus/Menu";-import {fullscreen, netImg2LocalAssets} from "./action";+import {fullscreen, netAssets2LocalAssets, netImg2LocalAssets} from "./action";import {openFileAttr} from "../../menus/commonMenuItem";import {setEditMode} from "../util/setEditMode";import {RecordMedia} from "../util/RecordMedia";@@ -341,6 +341,13 @@ export class Breadcrumb {netImg2LocalAssets(protyle);}}).element);+ window.siyuan.menus.menu.append(new MenuItem({+ label: window.siyuan.languages.netAssets2LocalAssets,+ icon: "iconTransform",+ click() {+ netAssets2LocalAssets(protyle);+ }+ }).element);window.siyuan.menus.menu.append(new MenuItem({label: window.siyuan.languages.uploadAssets2CDN,icon: "iconCloudSucc",diff --git a/kernel/go.sum b/kernel/go.sumindex 532e9a6562..3ebdaf7bb5 100644--- a/kernel/go.sum+++ b/kernel/go.sum@@ -10,6 +10,8 @@ github.com/88250/go-sqlite3 v1.14.13-0.20220714142610-fbbda1ee84f5 h1:8HdZozCsXSgithub.com/88250/go-sqlite3 v1.14.13-0.20220714142610-fbbda1ee84f5/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU=github.com/88250/gulu v1.2.3-0.20231205093500-bcc43ee27cba h1:ypA1nYRPXm+oac3GnAziPOhMx49nTLtrajePha1CU0g=github.com/88250/gulu v1.2.3-0.20231205093500-bcc43ee27cba/go.mod h1:pTWnjt+6qUqNnP9xltswsJxgCBVu3C7eW09u48LWX0k=+github.com/88250/lute v1.7.6-0.20231205144411-36eb02d113a6 h1:nCZMMQB5XqhX2jJYegnmrlBAYKotE7Cwex17Kz24rko=+github.com/88250/lute v1.7.6-0.20231205144411-36eb02d113a6/go.mod h1:+wUqx/1kdFDbWtxn9LYJlaCOAeol2pjSO6w+WJTVQsg=github.com/88250/pdfcpu v0.3.14-0.20230401044135-c7369a99720c h1:Dl/8S9iLyPMTElnWIBxmjaLiWrkI5P4a21ivwAn5pU0=github.com/88250/pdfcpu v0.3.14-0.20230401044135-c7369a99720c/go.mod h1:S5YT38L/GCjVjmB4PB84PymA1qfopjEhfhTNQilLpv4=github.com/88250/vitess-sqlparser v0.0.0-20210205111146-56a2ded2aba1 h1:48T899JQDwyyRu9yXHePYlPdHtpJfrJEUGBMH3SMBWY=diff --git a/kernel/model/assets.go b/kernel/model/assets.goindex da0817852e..85f66aac91 100644--- a/kernel/model/assets.go+++ b/kernel/model/assets.go@@ -386,6 +386,8 @@ func NetAssets2LocalAssets(rootID string) (err error) {return}util.PushUpdateMsg(msgId, fmt.Sprintf(Conf.Language(120), files), 5000)+ } else {+ util.PushUpdateMsg(msgId, Conf.Language(121), 3000)}return}