diff --git a/app/src/layout/dock/Files.ts b/app/src/layout/dock/Files.ts index 32ac4b992..910906e5e 100644 --- a/app/src/layout/dock/Files.ts +++ b/app/src/layout/dock/Files.ts @@ -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, false)); + this.element.querySelector(`li[data-node-id="${data.data.rootID}"] .ariaLabel`)?.setAttribute("aria-label", this.genDocAriaLabel(data.data, escapeGreat)); break; case "moveDoc": this.onMove(data); @@ -1140,8 +1140,8 @@ export class Files extends Model { setStorageVal(Constants.LOCAL_FILESPATHS, filesPaths); } - 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 genDocAriaLabel(item: IFile, escapeMethod: (text: string) => string) { + return `${escapeMethod(getDisplayName(item.name, true, true))} ${item.hSize}${item.bookmark ? "
" + window.siyuan.languages.bookmark + " " + escapeMethod(item.bookmark) : ""}${item.name1 ? "
" + window.siyuan.languages.name + " " + escapeMethod(item.name1) : ""}${item.alias ? "
" + window.siyuan.languages.alias + " " + escapeMethod(item.alias) : ""}${item.memo ? "
" + window.siyuan.languages.memo + " " + escapeMethod(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) { @@ -1149,7 +1149,7 @@ export class Files extends Model { if (item.count && item.count > 0) { countHTML = `${item.count}`; } - const ariaLabel = this.genDocAriaLabel(item); + const ariaLabel = this.genDocAriaLabel(item, escapeAriaLabel); return `