diff --git a/app/src/layout/dock/Files.ts b/app/src/layout/dock/Files.ts index b6447b87a..32ac4b992 100644 --- a/app/src/layout/dock/Files.ts +++ b/app/src/layout/dock/Files.ts @@ -1,4 +1,4 @@ -import {escapeHtml} from "../../util/escape"; +import {escapeAriaLabel, escapeGreat, escapeHtml} from "../../util/escape"; import {Tab} from "../Tab"; import {Model} from "../Model"; import {getInstanceById, setPanelFocus} from "../util"; @@ -42,7 +42,7 @@ export class Files extends Model { if (data) { switch (data.cmd) { case "reloadDocInfo": - this.element.querySelector(`li[data-node-id="${data.data.rootID}"] .ariaLabel`)?.setAttribute("aria-label", this.genDocAriaLabel(data.data)); + this.element.querySelector(`li[data-node-id="${data.data.rootID}"] .ariaLabel`)?.setAttribute("aria-label", this.genDocAriaLabel(data.data, false)); break; case "moveDoc": this.onMove(data); @@ -1140,8 +1140,8 @@ export class Files extends Model { setStorageVal(Constants.LOCAL_FILESPATHS, filesPaths); } - private genDocAriaLabel(item: IFile) { - return `${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}`; + private genDocAriaLabel(item: IFile, escape = true) { + return `${escape ? escapeAriaLabel(getDisplayName(item.name, true, true)) : escapeGreat(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}`; } private genFileHTML(item: IFile) { @@ -1159,7 +1159,7 @@ class="b3-list-item b3-list-item--hide-action" data-path="${item.path}"> ${unicode2Emoji(item.icon || (item.subFileCount === 0 ? window.siyuan.storage[Constants.LOCAL_IMAGES].file : window.siyuan.storage[Constants.LOCAL_IMAGES].folder))} ${getDisplayName(item.name, true, true)} +aria-label="${ariaLabel}">${getDisplayName(item.name, true, true)}