From c3aff78364927a789388bce38012f4f60865d46e Mon Sep 17 00:00:00 2001 From: Vanessa Date: Mon, 7 Aug 2023 12:37:43 +0800 Subject: [PATCH] =?UTF-8?q?:bug:=20=E8=BD=AC=E4=B9=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/layout/dock/Files.ts | 3 ++- app/src/layout/dock/index.ts | 16 +++++++++------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/app/src/layout/dock/Files.ts b/app/src/layout/dock/Files.ts index c741b2d00..f1c8d27f3 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 = `${item.count}`; } + const ariaLabel = `${getDisplayName(item.name, true, true)} ${item.hSize}${item.bookmark ? "
" + window.siyuan.languages.bookmark + " " + item.bookmark : ""}${item.name1 ? "
" + window.siyuan.languages.name + " " + item.name1 : ""}${item.alias ? "
" + window.siyuan.languages.alias + " " + item.alias : ""}${item.memo ? "
" + window.siyuan.languages.memo + " " + item.memo : ""}${item.subFileCount !== 0 ? window.siyuan.languages.includeSubFile.replace("x", item.subFileCount) : ""}
${window.siyuan.languages.modifiedAt} ${item.hMtime}
${window.siyuan.languages.createdAt} ${item.hCtime}` return `
  • @@ -1004,7 +1005,7 @@ class="b3-list-item b3-list-item--hide-action" data-path="${item.path}"> ${unicode2Emoji(item.icon || (item.subFileCount === 0 ? Constants.SIYUAN_IMAGE_FILE : Constants.SIYUAN_IMAGE_FOLDER))} " + window.siyuan.languages.bookmark + " " + item.bookmark : ""}${item.name1 ? "
    " + window.siyuan.languages.name + " " + item.name1 : ""}${item.alias ? "
    " + window.siyuan.languages.alias + " " + item.alias : ""}${item.memo ? "
    " + window.siyuan.languages.memo + " " + item.memo : ""}${item.subFileCount !== 0 ? window.siyuan.languages.includeSubFile.replace("x", item.subFileCount) : ""}
    ${window.siyuan.languages.modifiedAt} ${item.hMtime}
    ${window.siyuan.languages.createdAt} ${item.hCtime}">${getDisplayName(item.name, true, true)}
    +aria-label="${escapeHtml(ariaLabel)}">${getDisplayName(item.name, true, true)} diff --git a/app/src/layout/dock/index.ts b/app/src/layout/dock/index.ts index 3daa0e78d..e0a7b9658 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 => {