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/5135
Vanessabdc4428e9969
diff --git a/app/src/constants.ts b/app/src/constants.tsindex a18f11d799..47a929a3bf 100644--- a/app/src/constants.ts+++ b/app/src/constants.ts@@ -339,6 +339,7 @@ export abstract class Constants {</svg>`;public static readonly SIYUAN_IMAGE_FILE: string = "1f4c4";public static readonly SIYUAN_IMAGE_NOTE: string = "1f5c3";+ public static readonly SIYUAN_IMAGE_FOLDER: string = "1f4d1";// assetspublic static readonly SIYUAN_ASSETS_IMAGE: string[] = [".apng", ".ico", ".cur", ".jpg", ".jpe", ".jpeg", ".jfif", ".pjp", ".pjpeg", ".png", ".gif", ".webp", ".bmp", ".svg"];diff --git a/app/src/emoji/index.ts b/app/src/emoji/index.tsindex a31e81b8d0..d18ae98942 100644--- a/app/src/emoji/index.ts+++ b/app/src/emoji/index.ts@@ -414,7 +414,7 @@ export const updateFileTreeEmoji = (unicode: string, id: string, icon = "iconFil}}if (emojiElement) {- emojiElement.innerHTML = unicode2Emoji(unicode || (icon === "iconFile" ? Constants.SIYUAN_IMAGE_FILE : Constants.SIYUAN_IMAGE_NOTE));+ emojiElement.innerHTML = unicode2Emoji(unicode || (icon === "iconFile" ? (emojiElement.previousElementSibling.classList.contains("fn__hidden") ? Constants.SIYUAN_IMAGE_FILE : Constants.SIYUAN_IMAGE_FOLDER) : Constants.SIYUAN_IMAGE_NOTE));}if (icon !== "iconFile") {setNoteBook();diff --git a/app/src/layout/dock/Files.ts b/app/src/layout/dock/Files.tsindex bf3cf1dc69..356bcc62d4 100644--- a/app/src/layout/dock/Files.ts+++ b/app/src/layout/dock/Files.ts@@ -550,6 +550,10 @@ export class Files extends Model {if (targetElement) {targetElement.querySelector(".b3-list-item__arrow").classList.remove("b3-list-item__arrow--open");targetElement.querySelector(".b3-list-item__toggle").classList.remove("fn__hidden");+ const emojiElement = targetElement.querySelector(".b3-list-item__icon");+ if (emojiElement.innerHTML === unicode2Emoji(Constants.SIYUAN_IMAGE_FILE)) {+ emojiElement.innerHTML = unicode2Emoji(Constants.SIYUAN_IMAGE_FOLDER)+ }if (targetElement.nextElementSibling && targetElement.nextElementSibling.tagName === "UL") {targetElement.nextElementSibling.remove();}@@ -593,6 +597,10 @@ export class Files extends Model {const iconElement = parentElement.querySelector("svg");iconElement.classList.remove("b3-list-item__arrow--open");iconElement.parentElement.classList.add("fn__hidden");+ const emojiElement = iconElement.parentElement.nextElementSibling;+ if (emojiElement.innerHTML === unicode2Emoji(Constants.SIYUAN_IMAGE_FOLDER)) {+ emojiElement.innerHTML = unicode2Emoji(Constants.SIYUAN_IMAGE_FILE);+ }}targetElement.parentElement.remove();} else {@@ -667,6 +675,10 @@ export class Files extends Model {if (sourceElement.parentElement.previousElementSibling) {sourceElement.parentElement.previousElementSibling.querySelector(".b3-list-item__toggle").classList.add("fn__hidden");sourceElement.parentElement.previousElementSibling.querySelector(".b3-list-item__arrow").classList.remove("b3-list-item__arrow--open");+ const emojiElement = sourceElement.parentElement.previousElementSibling.querySelector(".b3-list-item__icon");+ if (emojiElement.innerHTML === unicode2Emoji(Constants.SIYUAN_IMAGE_FOLDER)) {+ emojiElement.innerHTML = unicode2Emoji(Constants.SIYUAN_IMAGE_FILE);+ }}sourceElement.parentElement.remove();} else {@@ -677,6 +689,10 @@ export class Files extends Model {// 更新移动到的新文件夹if (newElement) {newElement.querySelector(".b3-list-item__toggle").classList.remove("fn__hidden");+ const emojiElement = newElement.querySelector(".b3-list-item__icon");+ if (emojiElement.innerHTML === unicode2Emoji(Constants.SIYUAN_IMAGE_FILE)) {+ emojiElement.innerHTML = unicode2Emoji(Constants.SIYUAN_IMAGE_FOLDER);+ }const arrowElement = newElement.querySelector(".b3-list-item__arrow");if (arrowElement.classList.contains("b3-list-item__arrow--open")) {arrowElement.classList.remove("b3-list-item__arrow--open");@@ -831,7 +847,7 @@ class="b3-list-item b3-list-item--hide-action" data-path="${item.path}"><span style="padding-left: ${(item.path.split("/").length - 1) * 16}px" class="b3-list-item__toggle b3-list-item__toggle--hl${item.subFileCount === 0 ? " fn__hidden" : ""}"><svg class="b3-list-item__arrow"><use xlink:href="#iconRight"></use></svg></span>- <span class="b3-list-item__icon b3-tooltips b3-tooltips__n" aria-label="${window.siyuan.languages.changeIcon}">${unicode2Emoji(item.icon || Constants.SIYUAN_IMAGE_FILE)}</span>+ <span class="b3-list-item__icon b3-tooltips b3-tooltips__n" aria-label="${window.siyuan.languages.changeIcon}">${unicode2Emoji(item.icon || (item.subFileCount === 0 ? Constants.SIYUAN_IMAGE_FILE : Constants.SIYUAN_IMAGE_FOLDER))}</span><span class="b3-list-item__text">${getDisplayName(item.name, true, true)}</span><span data-type="more-file" class="b3-list-item__action b3-tooltips b3-tooltips__nw" aria-label="${window.siyuan.languages.more}"><svg><use xlink:href="#iconMore"></use></svg>diff --git a/app/src/mobile/util/MobileFiles.ts b/app/src/mobile/util/MobileFiles.tsindex 5d4d14b45a..fae7f3f868 100644--- a/app/src/mobile/util/MobileFiles.ts+++ b/app/src/mobile/util/MobileFiles.ts@@ -383,6 +383,10 @@ export class MobileFiles extends Model {if (sourceElement.parentElement.previousElementSibling) {sourceElement.parentElement.previousElementSibling.querySelector(".b3-list-item__toggle").classList.add("fn__hidden");sourceElement.parentElement.previousElementSibling.querySelector(".b3-list-item__arrow").classList.remove("b3-list-item__arrow--open");+ const emojiElement = sourceElement.parentElement.previousElementSibling.querySelector(".b3-list-item__icon");+ if (emojiElement.innerHTML === unicode2Emoji(Constants.SIYUAN_IMAGE_FOLDER)) {+ emojiElement.innerHTML = unicode2Emoji(Constants.SIYUAN_IMAGE_FILE);+ }}sourceElement.parentElement.remove();} else {@@ -392,6 +396,10 @@ export class MobileFiles extends Model {const newElement = this.element.querySelector(`[data-url="${data.toNotebook}"] li[data-path="${data.toPath}"]`) as HTMLElement;// 重新展开移动到的新文件夹if (newElement) {+ const emojiElement = newElement.querySelector(".b3-list-item__icon");+ if (emojiElement.innerHTML === unicode2Emoji(Constants.SIYUAN_IMAGE_FILE)) {+ emojiElement.innerHTML = unicode2Emoji(Constants.SIYUAN_IMAGE_FOLDER);+ }newElement.querySelector(".b3-list-item__toggle").classList.remove("fn__hidden");newElement.querySelector(".b3-list-item__arrow").classList.remove("b3-list-item__arrow--open");if (newElement.nextElementSibling && newElement.nextElementSibling.tagName === "UL") {@@ -428,6 +436,10 @@ export class MobileFiles extends Model {if (targetElement) {targetElement.querySelector(".b3-list-item__arrow").classList.remove("b3-list-item__arrow--open");targetElement.querySelector(".b3-list-item__toggle").classList.remove("fn__hidden");+ const emojiElement = targetElement.querySelector(".b3-list-item__icon");+ if (emojiElement.innerHTML === unicode2Emoji(Constants.SIYUAN_IMAGE_FILE)) {+ emojiElement.innerHTML = unicode2Emoji(Constants.SIYUAN_IMAGE_FOLDER)+ }if (targetElement.nextElementSibling && targetElement.nextElementSibling.tagName === "UL") {targetElement.nextElementSibling.remove();}@@ -478,6 +490,10 @@ export class MobileFiles extends Model {const iconElement = parentElement.querySelector("svg");iconElement.classList.remove("b3-list-item__arrow--open");iconElement.parentElement.classList.add("fn__hidden");+ const emojiElement = iconElement.parentElement.nextElementSibling;+ if (emojiElement.innerHTML === unicode2Emoji(Constants.SIYUAN_IMAGE_FOLDER)) {+ emojiElement.innerHTML = unicode2Emoji(Constants.SIYUAN_IMAGE_FILE);+ }}targetElement.parentElement.remove();} else {@@ -677,7 +693,7 @@ class="b3-list-item" data-path="${item.path}"><span style="padding-left: ${(item.path.split("/").length - 1) * 16}px" class="b3-list-item__toggle${item.subFileCount === 0 ? " fn__hidden" : ""}"><svg class="b3-list-item__arrow"><use xlink:href="#iconRight"></use></svg></span>- <span class="b3-list-item__icon">${unicode2Emoji(item.icon || Constants.SIYUAN_IMAGE_FILE)}</span>+ <span class="b3-list-item__icon">${unicode2Emoji(item.icon || (item.subFileCount === 0 ? Constants.SIYUAN_IMAGE_FILE : Constants.SIYUAN_IMAGE_FOLDER))}</span><span class="b3-list-item__text">${getDisplayName(item.name, true, true)}</span><span data-type="more-file" class="b3-list-item__action b3-tooltips b3-tooltips__nw" aria-label="${window.siyuan.languages.more}"><svg><use xlink:href="#iconMore"></use></svg>