Skip to content

Commit

Permalink
更新版本为 0.0.5
Browse files Browse the repository at this point in the history
二级文档列表中的文档添加 data-count 属性
  • Loading branch information
Misuzu2027 committed Oct 7, 2024
1 parent e25ec12 commit 4762f8d
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "syplugin-dual-doc-list",
"author": "Misuzu2027",
"url": "https://github.com/Misuzu2027/syplugin-dual-doc-list",
"version": "0.0.4",
"version": "0.0.5",
"minAppVersion": "3.0.12",
"backends": [
"all"
Expand Down
1 change: 1 addition & 0 deletions src/components/doc-list/doc-list.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -1093,6 +1093,7 @@
<li
data-node-id={item.fileBlock.id}
data-name={escapeAttr(item.fileBlock.name)}
data-count={item.fileBlock.subFileCount}
data-type="navigation-file"
style="--file-toggle-width:40px;height:32px;padding:2px 5px;"
class="b3-list-item"
Expand Down
2 changes: 1 addition & 1 deletion src/types/custon.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ type FileBlock = {
ial?: string;

refCount: number;
subFileCount?: number;
subFileCount: number;

sort: number;

Expand Down
6 changes: 5 additions & 1 deletion src/utils/html-util.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import { isArrayEmpty } from "./array-util";
import { isStrBlank } from "./string-util";

export const escapeAttr = (html: string) => {
if (isStrBlank(html)) {
return null;
}
return html.replace(/"/g, "&quot;").replace(/'/g, "&apos;");
};
export async function highlightElementTextByCss(
Expand Down Expand Up @@ -258,4 +262,4 @@ export function convertTextToFirstElement(htmlString: string): HTMLElement {
const template = document.createElement('template');
template.innerHTML = htmlString.trim(); // 去除可能的空白符
return template.content.firstElementChild as HTMLElement;
}
}

0 comments on commit 4762f8d

Please sign in to comment.