From b3ae783cbd0937e2b7eb87d145cae5543ea4da22 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Mon, 27 Apr 2026 12:53:45 +0800 Subject: [PATCH] :art: New default appearance icon https://github.com/siyuan-note/siyuan/issues/7976 Signed-off-by: Daniel <845765@qq.com> --- app/appearance/.gitignore | 3 +- app/appearance/icons/index.html | 68 +- app/appearance/icons/material/icon.js | 663 ------------------ app/appearance/icons/material/icon.json | 6 - .../20200924100110-vcg96wy.sy | 4 +- .../20200922101913-d5yitmq.sy | 4 +- .../20211226121633-qa2fjpl.sy | 4 +- .../20240530101000-hq9sn3k.sy | 4 +- app/src/asset/index.ts | 2 +- app/src/menus/commonMenuItem.ts | 2 +- app/src/mobile/util/keyboardToolbar.ts | 2 +- app/src/protyle/export/index.ts | 4 +- app/src/protyle/hint/extend.ts | 2 +- app/src/protyle/toolbar/util.ts | 2 +- app/src/util/assets.ts | 10 +- kernel/conf/appearance.go | 2 +- kernel/model/appearance.go | 2 +- kernel/model/bazaar.go | 2 +- kernel/model/conf.go | 5 +- kernel/model/export.go | 16 +- 20 files changed, 72 insertions(+), 735 deletions(-) delete mode 100644 app/appearance/icons/material/icon.js delete mode 100644 app/appearance/icons/material/icon.json diff --git a/app/appearance/.gitignore b/app/appearance/.gitignore index 567ce1120..d776a96e6 100644 --- a/app/appearance/.gitignore +++ b/app/appearance/.gitignore @@ -4,6 +4,5 @@ themes/* !themes/midnight/ icons/ -!icons/ant/ -!icons/material/ +!icons/litheness/ !icons/index.html diff --git a/app/appearance/icons/index.html b/app/appearance/icons/index.html index aad090d10..493d194b1 100644 --- a/app/appearance/icons/index.html +++ b/app/appearance/icons/index.html @@ -28,6 +28,12 @@

SiYuan

+
+ + + + iconDocx +
@@ -142,6 +148,12 @@ iconSoftWrap
+
+ + + + iconLink +
@@ -202,6 +214,12 @@ iconPaste
+
+ + + + iconCopy +
@@ -814,6 +832,18 @@ iconRight
+
+ + + + iconDown +
+
+ + + + iconUp +
@@ -922,6 +952,12 @@ iconH6
+
+ + + + iconHeadings +
@@ -1036,12 +1072,6 @@ iconInsertRight
-
- - - - iconHeadings -
@@ -1090,12 +1120,6 @@ iconOpenWindow
-
- - - - iconCopy -
@@ -1210,30 +1234,12 @@ iconAlignRight
-
- - - - iconDown -
-
- - - - iconUp -
iconItalic
-
- - - - iconLink -
@@ -1283,6 +1289,6 @@ iconZhihu
- + diff --git a/app/appearance/icons/material/icon.js b/app/appearance/icons/material/icon.js deleted file mode 100644 index 799166d7a..000000000 --- a/app/appearance/icons/material/icon.js +++ /dev/null @@ -1,663 +0,0 @@ -document.body.insertAdjacentHTML('afterbegin', ` - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -`) diff --git a/app/appearance/icons/material/icon.json b/app/appearance/icons/material/icon.json deleted file mode 100644 index 168d04e92..000000000 --- a/app/appearance/icons/material/icon.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "name": "material", - "author": "Vanessa", - "url": "https://github.com/Vanessa219", - "version": "2.0.0" -} diff --git a/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-axh6q1d/20200924100110-vcg96wy.sy b/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-axh6q1d/20200924100110-vcg96wy.sy index 85c0506a7..ff70023a8 100644 --- a/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-axh6q1d/20200924100110-vcg96wy.sy +++ b/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-axh6q1d/20200924100110-vcg96wy.sy @@ -1257,7 +1257,7 @@ { "Type": "NodeTextMark", "TextMarkType": "code", - "TextMarkTextContent": "material" + "TextMarkTextContent": "litheness" }, { "Type": "NodeText", @@ -1302,7 +1302,7 @@ { "ID": "20220307092214-dt7s086", "Type": "NodeCodeBlockCode", - "Data": "\u003cscript src=\"material/icon.js\"\u003e\u003c/script\u003e\n", + "Data": "\u003cscript src=\"litheness/icon.js\"\u003e\u003c/script\u003e\n", "Properties": { "id": "20220307092214-dt7s086" } diff --git a/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180320-qgr0b3q/20200922101913-d5yitmq.sy b/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180320-qgr0b3q/20200922101913-d5yitmq.sy index af148659a..48313b50a 100644 --- a/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180320-qgr0b3q/20200922101913-d5yitmq.sy +++ b/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180320-qgr0b3q/20200922101913-d5yitmq.sy @@ -1284,7 +1284,7 @@ { "Type": "NodeTextMark", "TextMarkType": "code", - "TextMarkTextContent": "material" + "TextMarkTextContent": "litheness" }, { "Type": "NodeText", @@ -1320,7 +1320,7 @@ { "ID": "20220307091943-01zwait", "Type": "NodeCodeBlockCode", - "Data": "\u003cscript src=\"material/icon.js\"\u003e\u003c/script\u003e\n", + "Data": "\u003cscript src=\"litheness/icon.js\"\u003e\u003c/script\u003e\n", "Properties": { "id": "20220307091943-01zwait" } diff --git a/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226121109-f060fkg/20211226121633-qa2fjpl.sy b/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226121109-f060fkg/20211226121633-qa2fjpl.sy index 5f385ed65..18dff3a85 100644 --- a/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226121109-f060fkg/20211226121633-qa2fjpl.sy +++ b/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226121109-f060fkg/20211226121633-qa2fjpl.sy @@ -1228,7 +1228,7 @@ { "Type": "NodeTextMark", "TextMarkType": "code", - "TextMarkTextContent": "material" + "TextMarkTextContent": "litheness" }, { "Type": "NodeText", @@ -1260,7 +1260,7 @@ { "ID": "20220307092237-1akc4ed", "Type": "NodeCodeBlockCode", - "Data": "\u003cscript src=\"material/icon.js\"\u003e\u003c/script\u003e\n", + "Data": "\u003cscript src=\"litheness/icon.js\"\u003e\u003c/script\u003e\n", "Properties": { "id": "20220307092237-1akc4ed" } diff --git a/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-xr22qn8/20240530101000-hq9sn3k.sy b/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-xr22qn8/20240530101000-hq9sn3k.sy index 03318e21a..859455368 100644 --- a/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-xr22qn8/20240530101000-hq9sn3k.sy +++ b/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-xr22qn8/20240530101000-hq9sn3k.sy @@ -1369,7 +1369,7 @@ { "Type": "NodeTextMark", "TextMarkType": "code", - "TextMarkTextContent": "material" + "TextMarkTextContent": "litheness" }, { "Type": "NodeText", @@ -1406,7 +1406,7 @@ { "ID": "20240530101000-6regnhi", "Type": "NodeCodeBlockCode", - "Data": "\u003cscript src=\"material/icon.js\"\u003e\u003c/script\u003e\n", + "Data": "\u003cscript src=\"litheness/icon.js\"\u003e\u003c/script\u003e\n", "Properties": { "ID": "20240530101000-tsvstz0", "id": "20240530101000-6regnhi" diff --git a/app/src/asset/index.ts b/app/src/asset/index.ts index 4b0021def..6eade3e89 100644 --- a/app/src/asset/index.ts +++ b/app/src/asset/index.ts @@ -286,7 +286,7 @@ export class Asset extends Model {
- + diff --git a/app/src/protyle/export/index.ts b/app/src/protyle/export/index.ts index af5f81f85..472054f65 100644 --- a/app/src/protyle/export/index.ts +++ b/app/src/protyle/export/index.ts @@ -25,8 +25,8 @@ const getPluginStyle = async () => { }; const getIconScript = (servePath: string) => { - const isBuiltInIcon = ["material"].includes(window.siyuan.config.appearance.icon); - const html = isBuiltInIcon ? "" : ``; + const isBuiltInIcon = ["litheness"].includes(window.siyuan.config.appearance.icon); + const html = isBuiltInIcon ? "" : ``; return html + ``; }; diff --git a/app/src/protyle/hint/extend.ts b/app/src/protyle/hint/extend.ts index 9c281f0f1..9e861cf52 100644 --- a/app/src/protyle/hint/extend.ts +++ b/app/src/protyle/hint/extend.ts @@ -243,7 +243,7 @@ export const hintSlash = (key: string, protyle: IProtyle) => { filter: [window.siyuan.languages.tag, "tags", "标签", "biaoqian", "bq"], id: "tag", value: "tag", - html: `
${window.siyuan.languages.tag}${updateHotkeyTip((window.siyuan.config.keymap.editor.insert.tag.custom))}
`, + html: `
${window.siyuan.languages.tag}${updateHotkeyTip((window.siyuan.config.keymap.editor.insert.tag.custom))}
`, }, { filter: [window.siyuan.languages["inline-math"], "inline formulas", "inline math", "行级公式", "hangjigongshi", "hjgs", "行级数学公式", "hangjishuxvegongshi", "hangjishuxuegongshi", "hjsxgs"], id: "inlineMath", diff --git a/app/src/protyle/toolbar/util.ts b/app/src/protyle/toolbar/util.ts index 60787b165..4194c03c1 100644 --- a/app/src/protyle/toolbar/util.ts +++ b/app/src/protyle/toolbar/util.ts @@ -156,7 +156,7 @@ export const toolbarKeyToMenu = (toolbar: Array) => { name: "tag", lang: "tag", hotkey: window.siyuan.config.keymap.editor.insert.tag.custom, - icon: "iconTags", + icon: "iconTag", tipPosition: "n", }, { name: "code", diff --git a/app/src/util/assets.ts b/app/src/util/assets.ts index b8c66e2a5..5c8706833 100644 --- a/app/src/util/assets.ts +++ b/app/src/util/assets.ts @@ -109,20 +109,20 @@ export const loadAssets = (data: Config.IAppearance) => { } // load icons - const isBuiltInIcon = data.icon === "material"; + const isBuiltInIcon = data.icon === "lithe"; const iconScriptElement = document.getElementById("iconScript"); const iconDefaultScriptElement = document.getElementById("iconDefaultScript"); // 不能使用 data.iconVer,因为其他主题也需要加载默认图标,此时 data.iconVer 为其他图标的版本号 - const iconDefaultURL = `/appearance/icons/material/icon.js?v=${Constants.SIYUAN_VERSION}`; + const iconDefaultURL = `/appearance/icons/litheness/icon.js?v=${Constants.SIYUAN_VERSION}`; const iconThirdURL = `/appearance/icons/${data.icon}/icon.js?v=${data.iconVer}`; if ((isBuiltInIcon && iconDefaultScriptElement && iconDefaultScriptElement.getAttribute("src").startsWith(iconDefaultURL)) || (!isBuiltInIcon && iconScriptElement && iconScriptElement.getAttribute("src").startsWith(iconThirdURL))) { - // 第三方图标切换到 material + // 第三方图标切换到默认 litheness if (isBuiltInIcon) { iconScriptElement?.remove(); Array.from(document.body.children).forEach((item) => { - if (item.tagName === "svg" && !item.getAttribute("data-name") && "iconsMaterial" !== item.id) { + if (item.tagName === "svg" && !item.getAttribute("data-name") && "iconsLitheness" !== item.id) { item.remove(); } }); @@ -135,7 +135,7 @@ export const loadAssets = (data: Config.IAppearance) => { addScript(iconThirdURL, "iconScript").then(() => { Array.from(document.body.children).forEach((item, index) => { if (item.tagName === "svg" && - index !== 0 && !item.getAttribute("data-name") && "iconsMaterial" !== item.id) { + index !== 0 && !item.getAttribute("data-name") && "iconsLitheness" !== item.id) { item.remove(); } }); diff --git a/kernel/conf/appearance.go b/kernel/conf/appearance.go index 8be9e428a..413178e92 100644 --- a/kernel/conf/appearance.go +++ b/kernel/conf/appearance.go @@ -44,7 +44,7 @@ func NewAppearance() *Appearance { ModeOS: true, ThemeDark: "midnight", ThemeLight: "daylight", - Icon: "material", + Icon: "litheness", CodeBlockThemeLight: "github", CodeBlockThemeDark: "base16/dracula", Lang: "en_US", diff --git a/kernel/model/appearance.go b/kernel/model/appearance.go index 40506bd9b..1fff96d37 100644 --- a/kernel/model/appearance.go +++ b/kernel/model/appearance.go @@ -59,7 +59,7 @@ func InitAppearance() { Conf.Appearance.ThemeJS = false } if !gulu.Str.Contains(Conf.Appearance.Icon, Conf.Appearance.Icons) { - Conf.Appearance.Icon = "material" + Conf.Appearance.Icon = "litheness" } Conf.m.Unlock() diff --git a/kernel/model/bazaar.go b/kernel/model/bazaar.go index 3098ecdc0..ae8393356 100644 --- a/kernel/model/bazaar.go +++ b/kernel/model/bazaar.go @@ -416,5 +416,5 @@ func isBuiltInTheme(name string) bool { // isBuiltInIcon 通过包名或目录名判断是否为内置图标 func isBuiltInIcon(name string) bool { - return "material" == name + return "litheness" == name } diff --git a/kernel/model/conf.go b/kernel/model/conf.go index 7e23ecdbb..4e468a349 100644 --- a/kernel/model/conf.go +++ b/kernel/model/conf.go @@ -198,10 +198,11 @@ func InitConf() { } Conf.Appearance.Lang = Conf.Lang if "ant" == Conf.Appearance.Icon { - // v3.6.6 移除了 ant 图标包,如果用户之前选择了 ant 图标包,升级后改为 material 图标包,避免图标显示异常 https://github.com/siyuan-note/siyuan/issues/7976 - Conf.Appearance.Icon = "material" + // v3.6.6 移除了 ant/material 图标包,如果用户之前选择了这两个其中之一,升级后改为 litheness 图标包,避免图标显示异常 https://github.com/siyuan-note/siyuan/issues/7976 + Conf.Appearance.Icon = "litheness" } os.RemoveAll(filepath.Join(util.IconsPath, "ant")) + os.RemoveAll(filepath.Join(util.IconsPath, "material")) if nil == Conf.UILayout { Conf.UILayout = &conf.UILayout{} } diff --git a/kernel/model/export.go b/kernel/model/export.go index 20eae09ca..55a43a698 100644 --- a/kernel/model/export.go +++ b/kernel/model/export.go @@ -933,10 +933,10 @@ func ExportMarkdownHTML(id, savePath string, docx, merge bool) (name, dom string // 只复制图标文件夹中的 icon.js 文件 iconName := Conf.Appearance.Icon - // 如果使用的不是内建图标(material),需要复制 material 作为后备 - if iconName != "material" && iconName != "" { - srcIconFile := filepath.Join(appearancePath, "icons", "material", "icon.js") - toIconDir := filepath.Join(savePath, "appearance", "icons", "material") + // 如果使用的不是内建图标(litheness),需要复制 litheness 作为后备 + if iconName != "litheness" && iconName != "" { + srcIconFile := filepath.Join(appearancePath, "icons", "litheness", "icon.js") + toIconDir := filepath.Join(savePath, "appearance", "icons", "litheness") if err := os.MkdirAll(toIconDir, 0755); err != nil { logging.LogErrorf("mkdir [%s] failed: %s", toIconDir, err) return @@ -1130,10 +1130,10 @@ func ExportHTML(id, savePath string, pdf, keepFold, merge bool) (name, dom strin // 只复制图标文件夹中的 icon.js 文件 iconName := Conf.Appearance.Icon - // 如果使用的不是内建图标(material),需要复制 material 作为后备 - if iconName != "material" && iconName != "" { - srcIconFile := filepath.Join(appearancePath, "icons", "material", "icon.js") - toIconDir := filepath.Join(savePath, "appearance", "icons", "material") + // 如果使用的不是内建图标(litheness),需要复制 litheness 作为后备 + if iconName != "litheness" && iconName != "" { + srcIconFile := filepath.Join(appearancePath, "icons", "litheness", "icon.js") + toIconDir := filepath.Join(savePath, "appearance", "icons", "litheness") if err := os.MkdirAll(toIconDir, 0755); err != nil { logging.LogErrorf("mkdir [%s] failed: %s", toIconDir, err) return