Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
Vanessa 2023-12-06 12:30:50 +08:00
commit 450e862f92
21 changed files with 361 additions and 253 deletions

View file

@ -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",

View file

@ -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",

View file

@ -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",

View file

@ -450,6 +450,7 @@
"searchBackmention": "反連提及(反連提及搜索關鍵字從以下方式獲得)",
"searchVirtualRef": "虛擬引用(虛擬引用搜索關鍵字從以下方式獲得)",
"netImg2LocalAsset": "網絡圖片轉換為本地圖片",
"netAssets2LocalAssets": "網路資源檔案轉換本地",
"releaseDate": "發布日期",
"pkgSize": "檔大小",
"installSize": "安裝大小",

View file

@ -450,6 +450,7 @@
"searchBackmention": "反链提及(反链提及搜索关键字从以下方式获得)",
"searchVirtualRef": "虚拟引用(虚拟引用搜索关键字从以下方式获得)",
"netImg2LocalAsset": "网络图片转换为本地图片",
"netAssets2LocalAssets": "网络资源文件转换本地",
"releaseDate": "发布日期",
"pkgSize": "包大小",
"installSize": "安装大小",

View file

@ -6,7 +6,7 @@
"id": "20200924100635-ms0p9lb",
"title": "Bookmark and Tag",
"type": "doc",
"updated": "20230928114919"
"updated": "20231205225745"
},
"Children": [
{
@ -208,12 +208,12 @@
"Type": "NodeParagraph",
"Properties": {
"id": "20230928113959-ebzf9zy",
"updated": "20230928114919"
"updated": "20231205225745"
},
"Children": [
{
"Type": "NodeText",
"Data": "Do not use special symbols in bookmarks or tags, otherwise renaming in the bookmark or tag panel will not be possible. The \"special symbols\" here include: "
"Data": "Please do not use special symbols in bookmarks or tags, otherwise you will not be able to search globally, and you will not be able to rename and delete them in the bookmarks/tags panel. The \"special symbols\" here include: "
},
{
"Type": "NodeTextMark",

View file

@ -7,7 +7,7 @@
"id": "20200924100950-9op5xi1",
"title": "Shortcuts",
"type": "doc",
"updated": "20231030111814"
"updated": "20231206093810"
},
"Children": [
{
@ -21,7 +21,7 @@
"Properties": {
"colgroup": "||",
"id": "20210106154319-yozlufs",
"updated": "20231030105632"
"updated": "20231206093810"
},
"Children": [
{
@ -3769,6 +3769,51 @@
}
]
},
{
"Type": "NodeTableRow",
"Data": "tr",
"Children": [
{
"Type": "NodeTableCell",
"Data": "td",
"Children": [
{
"Type": "NodeText",
"Data": "Convert network assets to local"
}
]
},
{
"Type": "NodeTableCell",
"Data": "td",
"Children": [
{
"Type": "NodeText",
"Data": "-"
}
]
},
{
"Type": "NodeTableCell",
"Data": "td",
"Children": [
{
"Type": "NodeText",
"Data": "Go to "
},
{
"Type": "NodeTextMark",
"TextMarkType": "kbd",
"TextMarkTextContent": "Settings - Shortcuts"
},
{
"Type": "NodeText",
"Data": " to configure"
}
]
}
]
},
{
"Type": "NodeTableRow",
"Data": "tr",
@ -12395,4 +12440,4 @@
]
}
]
}
}

View file

@ -7,7 +7,7 @@
"id": "20200813004551-gm0pbn1",
"title": "快捷键",
"type": "doc",
"updated": "20231116104159"
"updated": "20231206093707"
},
"Children": [
{
@ -2977,7 +2977,7 @@
"Properties": {
"colgroup": "||",
"id": "20201227133317-vopotjc",
"updated": "20231030105449"
"updated": "20231206093707"
},
"Children": [
{
@ -6777,6 +6777,51 @@
}
]
},
{
"Type": "NodeTableRow",
"Data": "tr",
"Children": [
{
"Type": "NodeTableCell",
"Data": "td",
"Children": [
{
"Type": "NodeText",
"Data": "网络资源文件转换本地"
}
]
},
{
"Type": "NodeTableCell",
"Data": "td",
"Children": [
{
"Type": "NodeText",
"Data": "-"
}
]
},
{
"Type": "NodeTableCell",
"Data": "td",
"Children": [
{
"Type": "NodeText",
"Data": "可前往 "
},
{
"Type": "NodeTextMark",
"TextMarkType": "kbd",
"TextMarkTextContent": "设置- 快捷键"
},
{
"Type": "NodeText",
"Data": " 中配置"
}
]
}
]
},
{
"Type": "NodeTableRow",
"Data": "tr",

View file

@ -6,7 +6,7 @@
"id": "20200910201551-h4twhas",
"title": "书签和标签",
"type": "doc",
"updated": "20230928114656"
"updated": "20231205225717"
},
"Children": [
{
@ -208,12 +208,12 @@
"Type": "NodeParagraph",
"Properties": {
"id": "20230928114129-dirvllf",
"updated": "20230928114656"
"updated": "20231205225717"
},
"Children": [
{
"Type": "NodeText",
"Data": "请勿在书签或者标签中使用特殊符号,否则会导致无法在书签或标签面板中重命名。这里的“特殊符号”包括:"
"Data": "请勿在书签或者标签中使用特殊符号,否则会导致无法全局搜索,也无法在书签/标签面板中重命名和删除。这里的“特殊符号”包括:"
},
{
"Type": "NodeTextMark",

View file

@ -5,7 +5,7 @@
"Properties": {
"id": "20211226123130-jpeg5b2",
"title": "書籤和標籤",
"updated": "20230928114931"
"updated": "20231205225753"
},
"Children": [
{
@ -209,12 +209,12 @@
"Type": "NodeParagraph",
"Properties": {
"id": "20230928114731-0nurd8j",
"updated": "20230928114931"
"updated": "20231205225753"
},
"Children": [
{
"Type": "NodeText",
"Data": "請勿在書籤或標籤中使用特殊符號,否則會導致無法在書籤或標籤面板中重新命名。 這裡的「特殊符號」包括:"
"Data": "請勿在書籤或標籤中使用特殊符號,否則會導致無法全域搜索,也無法在書籤/標籤面板中重新命名和刪除。 這裡的「特殊符號」包括:"
},
{
"Type": "NodeTextMark",

View file

@ -335,7 +335,6 @@ ${data.shorthandContent}
md: response.data.shorthandMd,
}, (docResponse) => {
this.remove(item);
fetchPost("/api/format/netAssets2LocalAssets", {id: docResponse.data.id});
});
});
});

View file

@ -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;

View file

@ -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",

File diff suppressed because one or more lines are too long

View file

@ -9,7 +9,7 @@ require (
github.com/88250/clipboard v0.1.5
github.com/88250/epub v0.0.0-20230830085737-c19055cd1f48
github.com/88250/gulu v1.2.3-0.20231205093500-bcc43ee27cba
github.com/88250/lute v1.7.6-0.20231202134329-1e21d618bebc
github.com/88250/lute v1.7.6-0.20231205144411-36eb02d113a6
github.com/88250/pdfcpu v0.3.14-0.20230401044135-c7369a99720c
github.com/88250/vitess-sqlparser v0.0.0-20210205111146-56a2ded2aba1
github.com/ClarkThan/ahocorasick v0.0.0-20231011042242-30d1ef1347f4

View file

@ -10,8 +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.20231202134329-1e21d618bebc h1:+ZB/qnOSevdt4beKpALW5d4sA6Zd+eado03Gbz04Os4=
github.com/88250/lute v1.7.6-0.20231202134329-1e21d618bebc/go.mod h1:+wUqx/1kdFDbWtxn9LYJlaCOAeol2pjSO6w+WJTVQsg=
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=

View file

@ -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
}

View file

@ -1102,7 +1102,12 @@ func stringQuery(query string) string {
func markReplaceSpan(n *ast.Node, unlinks *[]*ast.Node, keywords []string, markSpanDataType string, luteEngine *lute.Lute) bool {
text := n.Content()
if ast.NodeText == n.Type {
text = search.EncloseHighlighting(text, keywords, search.GetMarkSpanStart(markSpanDataType), search.GetMarkSpanEnd(), Conf.Search.CaseSensitive, false)
text = util.EscapeHTML(text)
escapedKeywords := make([]string, len(keywords))
for i, keyword := range keywords {
escapedKeywords[i] = util.EscapeHTML(keyword)
}
text = search.EncloseHighlighting(text, escapedKeywords, search.GetMarkSpanStart(markSpanDataType), search.GetMarkSpanEnd(), Conf.Search.CaseSensitive, false)
n.Tokens = gulu.Str.ToBytes(text)
if bytes.Contains(n.Tokens, []byte(search.MarkDataType)) {
linkTree := parse.Inline("", n.Tokens, luteEngine.ParseOptions)

View file

@ -49,6 +49,7 @@ func RenderGoTemplate(templateContent string) (ret string, err error) {
tmpl = tmpl.Funcs(template.FuncMap{
"Weekday": util.Weekday,
"WeekdayCN": util.WeekdayCN,
"WeekdayCN2": util.WeekdayCN2,
"ISOWeek": util.ISOWeek,
})
tpl, err := tmpl.Parse(templateContent)
@ -249,6 +250,7 @@ func renderTemplate(p, id string, preview bool) (string, error) {
}
funcMap["Weekday"] = util.Weekday
funcMap["WeekdayCN"] = util.WeekdayCN
funcMap["WeekdayCN2"] = util.WeekdayCN2
funcMap["ISOWeek"] = util.ISOWeek
goTpl := template.New("").Delims(".action{", "}")

View file

@ -40,6 +40,14 @@ func WeekdayCN(date time.Time) string {
return weekdayCN[week]
}
// WeekdayCN2 returns the day of the week specified by date.
// Sunday=天, Monday=一, ..., Saturday=六.
func WeekdayCN2(date time.Time) string {
week := Weekday(date)
weekdayCN2 := []string{"天", "一", "二", "三", "四", "五", "六"}
return weekdayCN2[week]
}
// ISOWeek returns the ISO 8601 year and week number in which date occurs.
// Week ranges from 1 to 53. Jan 01 to Jan 03 of year n might belong to week 52 or 53 of year n-1,
// and Dec 29 to Dec 31 might belong to week 1 of year n+1.