|
3 | 3 | Author : frostime
|
4 | 4 | Date : 2024-10-01 20:33:19
|
5 | 5 | FilePath : /src/components/docs-flow/docs-list.svelte
|
6 |
| - LastEditTime : 2024-10-01 21:20:02 |
| 6 | + LastEditTime : 2024-10-03 14:26:17 |
7 | 7 | Description :
|
8 | 8 |
|
9 | 9 | 显示所有的文档
|
|
29 | 29 | const blocks: Block[] = await getBlocksByIds(...allDocIds);
|
30 | 30 | blocks.forEach((block: Block) => {
|
31 | 31 | docInfo[block.id] = {
|
32 |
| - title: truncateString(block.fcontent || block.content, 30), |
| 32 | + // title: truncateString(block.fcontent || block.content, 40), |
| 33 | + title: block.fcontent || block.content, |
33 | 34 | hpath: block.hpath,
|
34 | 35 | box: notebooks?.[block.box] || ""
|
35 | 36 | };
|
|
39 | 40 | scrollToFirstLoadedItem();
|
40 | 41 | });
|
41 | 42 |
|
42 |
| - function truncateString(str: string, maxLength: number): string { |
43 |
| - return str.length > maxLength |
44 |
| - ? str.substring(0, maxLength) + "..." |
45 |
| - : str; |
46 |
| - } |
| 43 | + // function truncateString(str: string, maxLength: number): string { |
| 44 | + // return str.length > maxLength |
| 45 | + // ? str.substring(0, maxLength) + "..." |
| 46 | + // : str; |
| 47 | + // } |
47 | 48 |
|
48 | 49 | function isLoaded(id: BlockId): boolean {
|
49 | 50 | return loadedDocIds.includes(id);
|
|
65 | 66 | <h3>Documents List</h3>
|
66 | 67 | <ul>
|
67 | 68 | {#each allDocIds as docId, index}
|
68 |
| - <li class:loaded={isLoaded(docId)}> |
| 69 | + <li class:loaded={isLoaded(docId)} data-node-id={docId}> |
69 | 70 | <span class="doc-number">{index + 1}.</span>
|
70 |
| - <span class="doc-title" |
71 |
| - >{docInfo[docId]?.title || `Document ${index + 1}`}</span |
72 |
| - > |
| 71 | + <span class="doc-title"> |
| 72 | + {docInfo[docId]?.title || `Document ${index + 1}`} |
| 73 | + </span> |
73 | 74 | <span class="doc-hpath">{docInfo[docId]?.box}{docInfo[docId]?.hpath || ""}</span>
|
74 |
| - <button class="jump-button" on:click={() => scrollToDoc(docId)}> |
| 75 | + <button class="jump-button popover__block" data-id={docId} on:click={() => scrollToDoc(docId)}> |
75 | 76 | <svg
|
76 | 77 | xmlns="http://www.w3.org/2000/svg"
|
77 | 78 | width="16"
|
|
123 | 124 | /* border-radius: 4px; */
|
124 | 125 | border-radius: 0px;
|
125 | 126 | transition: background-color 0.3s ease;
|
| 127 | + cursor: default; |
| 128 | +
|
| 129 | + &:hover { |
| 130 | + color: var(--b3-theme-primary); |
| 131 | + } |
126 | 132 | }
|
127 | 133 |
|
128 | 134 | li.loaded {
|
|
147 | 153 | .doc-title {
|
148 | 154 | flex-grow: 1;
|
149 | 155 | margin-right: 10px;
|
| 156 | + /* 隐藏超过限度的文字 */ |
| 157 | + overflow: hidden; |
| 158 | + text-overflow: ellipsis; |
| 159 | + white-space: nowrap; |
150 | 160 | }
|
151 | 161 |
|
152 | 162 | .doc-hpath {
|
153 | 163 | font-size: 12px;
|
154 | 164 | color: var(--b3-theme-on-surface-light);
|
155 | 165 | margin-right: 10px;
|
| 166 | + white-space: nowrap; |
156 | 167 | }
|
157 | 168 |
|
158 | 169 | .jump-button {
|
|
0 commit comments