Skip to content

Commit 66f93b7

Browse files
committed
✨ feat: 逆序展示文档流
建议:提供向上滚动加载更多的交互 #59
1 parent 0ccdcc4 commit 66f93b7

File tree

6 files changed

+45
-21
lines changed

6 files changed

+45
-21
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "sy-docs-flow",
3-
"version": "0.7.0",
3+
"version": "0.7.1",
44
"type": "module",
55
"description": "",
66
"repository": "",

plugin.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "sy-docs-flow",
33
"author": "frostime",
44
"url": "https://github.com/frostime/sy-docs-flow",
5-
"version": "0.7.0",
5+
"version": "0.7.1",
66
"minAppVersion": "3.0.0",
77
"backends": ["all"],
88
"frontends": ["desktop", "desktop-window", "browser-desktop", "browser-mobile"],

src/components/docs-flow/docs-flow.svelte

Lines changed: 33 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Author : Yp Z
44
Date : 2023-07-28 20:49:27
55
FilePath : /src/components/docs-flow/docs-flow.svelte
6-
LastEditTime : 2024-04-28 14:19:16
6+
LastEditTime : 2024-05-08 13:32:03
77
Description :
88
-->
99
<script lang="ts">
@@ -156,13 +156,14 @@
156156
});
157157
}
158158
159-
const refresh = () => {
160-
loadIdList = [];
161-
onConfigChanged();
162-
setTimeout(() => {
163-
updateLoadIdList();
164-
}, 500);
165-
};
159+
//For refresh button
160+
// const refresh = () => {
161+
// loadIdList = [];
162+
// onConfigChanged();
163+
// setTimeout(() => {
164+
// updateLoadIdList();
165+
// }, 500);
166+
// };
166167
167168
const onCopyLink = () => {
168169
const prefix = "siyuan://plugins/sy-docs-flow/open-rule";
@@ -227,8 +228,10 @@
227228
let svgRefresh: SVGElement;
228229
const onClickReload = () => {
229230
svgRefresh.classList.add("fn__rotate");
231+
svgRefresh.style.setProperty("background-color", "unset");
230232
setTimeout(() => {
231233
svgRefresh.classList.remove("fn__rotate");
234+
svgRefresh.style.removeProperty("background-color");
232235
}, 1000);
233236
reInit();
234237
showMessage("Reload completed.");
@@ -250,19 +253,34 @@
250253
in:fly={{ y: -20, duration: 200 }}
251254
out:fly={{ y: -20, duration: 200 }}
252255
>
253-
<div>{i18n.docsCnt}: {listDocumentIds.length}</div>
256+
<div class="toolbar__item toolbar__item--active">
257+
{i18n.docsCnt}: {listDocumentIds.length}
258+
</div>
254259
<span class="fn__space" />
255260
<svg
256261
bind:this={svgRefresh}
257-
class="svg-button"
262+
class="svg-button ariaLabel"
263+
aria-label={i18n.button.reload}
258264
on:click={onClickReload} on:keypress={() => {}}
259265
>
260266
<use xlink:href="#iconRefresh"></use>
261267
</svg>
268+
<span class="fn__space" />
269+
<svg
270+
class="svg-button ariaLabel"
271+
aria-label={i18n.button.reverse}
272+
on:click={() => {
273+
listDocumentIds = listDocumentIds.reverse();
274+
updateLoadIdList();
275+
}}
276+
on:keypress={() => {}}
277+
>
278+
<use xlink:href="#iconScrollVert"></use>
279+
</svg>
262280

263281
<div id="space" />
264282

265-
<label
283+
<!-- <label
266284
class="b3-label__text"
267285
for="enableScroll"
268286
style="margin-top: 0px;"
@@ -276,7 +294,7 @@
276294
type="checkbox"
277295
bind:checked={config.scroll}
278296
on:change={refresh}
279-
/>
297+
/> -->
280298

281299
<span class="fn__space" />
282300

@@ -365,7 +383,7 @@
365383
align-items: start;
366384
367385
> section {
368-
padding: 0.5rem;
386+
padding: 4px 5px;
369387
width: 40rem;
370388
371389
background-color: var(--b3-theme-surface);
@@ -386,9 +404,11 @@
386404
387405
svg.svg-button {
388406
width: 1em; height: 1em;
407+
padding: 2px;
389408
&:hover {
390409
cursor: pointer;
391410
color: var(--b3-theme-primary);
411+
background-color: var(--b3-toolbar-hover);
392412
}
393413
}
394414

src/i18n/en_US.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
"offspringDocument": "Offspring document"
1010
},
1111
"button": {
12+
"reload": "Reload",
13+
"reverse": "Reverse",
1214
"alterSaved": "Alter these",
1315
"saved": "Saved rules",
1416
"openInDocFlow": "Open in docflow",
@@ -28,7 +30,7 @@
2830
"text": "Fixed height for a single document, scroll to load its internal content. It can save memory resources when dealing with large documents."
2931
},
3032
"displayBreadcrumb": {
31-
"title": "Display Collapse Bar",
33+
"title": "Collapse Bar",
3234
"text": "Whether to display the breadcrumb for each document target (collapsed/expanded bar)."
3335
},
3436
"protyleTitle": {
@@ -52,7 +54,7 @@
5254
"text": "When dynamic loading is enabled, the number of documents to load each time when scrolling to the edge (up/down)."
5355
}
5456
},
55-
"docsCnt": "Docs Count",
57+
"docsCnt": "Docs",
5658
"displayBreadcrumb": "Breadcrumb",
5759
"scrollMode": "Scroll Mode",
5860
"dynamicLoading": "Dynamic Loading",

src/i18n/zh_CN.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
"offspringDocument": "文档树"
1010
},
1111
"button": {
12+
"reload": "刷新",
13+
"reverse": "逆序展示",
1214
"alterSaved": "更改上述规则",
1315
"saved": "已保存的规则",
1416
"openInDocFlow": "文档流中打开",
@@ -28,7 +30,7 @@
2830
"text": "单个文档固定高度, 滚动加载其内部内容, 在单个文档较大时, 可以节省内存资源"
2931
},
3032
"displayBreadcrumb": {
31-
"title": "展示折叠栏",
33+
"title": "折叠栏",
3234
"text": "是否展示每个文档目标的地址/折叠/展开栏"
3335
},
3436
"protyleTitle": {

src/utils.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
* @Author : Yp Z
44
* @Date : 2023-07-29 15:41:15
55
* @FilePath : /src/utils.ts
6-
* @LastEditTime : 2024-04-23 11:54:14
6+
* @LastEditTime : 2024-04-29 14:16:17
77
* @Description :
88
*/
99
import { Dialog, getFrontend } from "siyuan";
10-
import { getBlockByID, listDocsByPath, readDir } from "./api";
10+
import { getBlockByID, listDocsByPath } from "./api";
1111
import zh_CN from "./i18n/zh_CN.json";
1212

1313
export let i18n: typeof zh_CN;
@@ -95,6 +95,6 @@ export const confirmDialog = (title: string, content: string | HTMLElement, conf
9595

9696
export const notebooks: { [key: string]: string } = {};
9797
for (let notebook of window.siyuan.notebooks) {
98-
console.log(notebook);
98+
// console.log(notebook);
9999
notebooks[notebook.id] = notebook.name;
100100
}

0 commit comments

Comments
 (0)