Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:bug: 转义

Vanessac3aff7836492
diff --git a/app/src/layout/dock/Files.ts b/app/src/layout/dock/Files.ts
index c741b2d006..f1c8d27f37 100644
--- a/app/src/layout/dock/Files.ts
+++ b/app/src/layout/dock/Files.ts
@@ -996,6 +996,7 @@ export class Files extends Model {
if (item.count && item.count > 0) {
countHTML = `<span class="popover__block counter b3-tooltips b3-tooltips__nw" aria-label="${window.siyuan.languages.ref}">${item.count}</span>`;
}
+ const ariaLabel = `${getDisplayName(item.name, true, true)} ${item.hSize}${item.bookmark ? "<br>" + window.siyuan.languages.bookmark + " " + item.bookmark : ""}${item.name1 ? "<br>" + window.siyuan.languages.name + " " + item.name1 : ""}${item.alias ? "<br>" + window.siyuan.languages.alias + " " + item.alias : ""}${item.memo ? "<br>" + window.siyuan.languages.memo + " " + item.memo : ""}${item.subFileCount !== 0 ? window.siyuan.languages.includeSubFile.replace("x", item.subFileCount) : ""}<br>${window.siyuan.languages.modifiedAt} ${item.hMtime}<br>${window.siyuan.languages.createdAt} ${item.hCtime}`
return `<li data-node-id="${item.id}" data-name="${Lute.EscapeHTMLStr(item.name)}" draggable="true" data-count="${item.subFileCount}"
data-type="navigation-file"
class="b3-list-item b3-list-item--hide-action" data-path="${item.path}">
@@ -1004,7 +1005,7 @@ class="b3-list-item b3-list-item--hide-action" data-path="${item.path}">
</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 ariaLabel"
-aria-label="${getDisplayName(item.name, true, true)} ${item.hSize}${item.bookmark ? "<br>" + window.siyuan.languages.bookmark + " " + item.bookmark : ""}${item.name1 ? "<br>" + window.siyuan.languages.name + " " + item.name1 : ""}${item.alias ? "<br>" + window.siyuan.languages.alias + " " + item.alias : ""}${item.memo ? "<br>" + window.siyuan.languages.memo + " " + item.memo : ""}${item.subFileCount !== 0 ? window.siyuan.languages.includeSubFile.replace("x", item.subFileCount) : ""}<br>${window.siyuan.languages.modifiedAt} ${item.hMtime}<br>${window.siyuan.languages.createdAt} ${item.hCtime}">${getDisplayName(item.name, true, true)}</span>
+aria-label="${escapeHtml(ariaLabel)}">${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>
</span>
diff --git a/app/src/layout/dock/index.ts b/app/src/layout/dock/index.ts
index 3daa0e78dd..e0a7b9658f 100644
--- a/app/src/layout/dock/index.ts
+++ b/app/src/layout/dock/index.ts
@@ -336,13 +336,15 @@ export class Dock {
}
// 关闭 dock 后设置光标
if (!document.querySelector(".layout__center .layout__wnd--active")) {
- const currentElement = document.querySelector(".layout__center .layout-tab-bar .item--focus")
- getAllTabs().find(item => {
- if (item.id === currentElement.getAttribute("data-id")) {
- item.parent.switchTab(item.headElement);
- return true;
- }
- });
+ const currentElement = document.querySelector(".layout__center .layout-tab-bar .item--focus");
+ if (currentElement) {
+ getAllTabs().find(item => {
+ if (item.id === currentElement.getAttribute("data-id")) {
+ item.parent.switchTab(item.headElement);
+ return true;
+ }
+ });
+ }
}
} else {
this.element.querySelectorAll(`.dock__item--active[data-index="${index}"]`).forEach(item => {