mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 14:40:12 +01:00
🎨 Support converting network assets to local https://github.com/siyuan-note/siyuan/issues/9826
This commit is contained in:
parent
e4ea32764f
commit
2e0b2ba967
9 changed files with 38 additions and 1 deletions
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -450,6 +450,7 @@
|
|||
"searchBackmention": "反連提及(反連提及搜索關鍵字從以下方式獲得)",
|
||||
"searchVirtualRef": "虛擬引用(虛擬引用搜索關鍵字從以下方式獲得)",
|
||||
"netImg2LocalAsset": "網絡圖片轉換為本地圖片",
|
||||
"netAssets2LocalAssets": "網路資源檔案轉換本地",
|
||||
"releaseDate": "發布日期",
|
||||
"pkgSize": "檔大小",
|
||||
"installSize": "安裝大小",
|
||||
|
|
|
|||
|
|
@ -450,6 +450,7 @@
|
|||
"searchBackmention": "反链提及(反链提及搜索关键字从以下方式获得)",
|
||||
"searchVirtualRef": "虚拟引用(虚拟引用搜索关键字从以下方式获得)",
|
||||
"netImg2LocalAsset": "网络图片转换为本地图片",
|
||||
"netAssets2LocalAssets": "网络资源文件转换本地",
|
||||
"releaseDate": "发布日期",
|
||||
"pkgSize": "包大小",
|
||||
"installSize": "安装大小",
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -10,6 +10,8 @@ github.com/88250/go-sqlite3 v1.14.13-0.20220714142610-fbbda1ee84f5 h1:8HdZozCsXS
|
|||
github.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=
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue