Skip to content

Commit

Permalink
🎨 misc: 改进 reservation dock
Browse files Browse the repository at this point in the history
  • Loading branch information
frostime committed Jun 8, 2024
1 parent 0c73e9c commit c1016c8
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 44 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## [2024-06-08] v1.6.6

- ✨ feat: 为 Reservation Tree Item 添加 popover icon
- 🐛 fix: 修复「查看预约块列表的弹窗」呈现位置异常的 bug


## [2024-05-15] v1.6.4

- 增加设置,允许插件覆盖 Alt+5 快捷键,启用后只打开默认笔记本的日记
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "siyuan-dailynote-today",
"version": "1.6.5",
"version": "1.6.6",
"description": "",
"main": ".src/index.js",
"keywords": [],
Expand Down
2 changes: 1 addition & 1 deletion plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"en_US": "Daily Note Today"
},
"url": "https://github.com/frostime/siyuan-dailynote-today",
"version": "1.6.5",
"version": "1.6.6",
"minAppVersion": "3.0.0",
"description": {
"zh_CN": "自动创建日记 + 快速打开日记 + 日程 TODO 管理 + 移动块功能",
Expand Down
25 changes: 12 additions & 13 deletions src/components/list-item.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -59,26 +59,22 @@
const atRight = rect.right > width / 2; // list-item 是否在页面右侧
const panelWidth = 750;
let x = 10;
if (atRight) {
x = width - panelWidth - 10;
}
plugin.addFloatLayer({
ids: blocks.map((block) => block.id),
x: 0,
y: 0
x: x,
y: rect.bottom + 10
});
//@ts-ignore
const blockPanels: any[] = window.siyuan.blockPanels;
const panel = blockPanels[blockPanels.length - 1];
const ele: HTMLElement = panel?.element;
if (atRight) {
//将弹出框移动到 list-item 的下方
ele.style.top = `${rect.bottom + 10}px`; // 将 y 坐标设为 list-item 下方
ele.style.left = '';
ele.style.right = `${width - rect.right}px`;
} else {
ele.style.top = `${rect.bottom + 10}px`;
}
ele.style.width = `${panelWidth}px`;
}
</script>

Expand Down Expand Up @@ -142,6 +138,9 @@
><use xlink:href="#iconRight" /></svg
>
</span>
<span data-defids="[&quot;&quot;]" class="b3-list-item__graphic popover__block" data-id={block.id}>
<svg class="b3-list-item__graphic"><use xlink:href="#iconSparkles" /></svg>
</span>
<span class="b3-list-item__text">{block.content}</span>

<!-- <span class="b3-list-item__action"
Expand Down
29 changes: 0 additions & 29 deletions src/func/reserve/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,39 +4,10 @@ import * as serverApi from '@/serverApi';
import { reservation, settings } from '@/global-status';
import { Retrieve, RetvFactory } from './retrieve';

// import { getDocsByHpath } from '../misc';

export * from './retrieve';
export * from './reserve';


/**
* @Deprecated 目前不再使用, 只使用 updateTodayReservation
*/
// export async function initTodayReservation(notebook: Notebook) {
// let todayDiaryPath = notebook.dailynoteHpath;
// let docId;
// let retry = 0;
// const MAX_RETRY = 5;
// const INTERVAL = 2500;
// while (retry < MAX_RETRY) {
// //插件自动创建日记的情况下可能会出现第一次拿不到的情况, 需要重试几次
// let docs = await getDocsByHpath(todayDiaryPath!, notebook);
// console.debug(`In initResrv, retry: ${retry}`);
// if (docs[0]?.id !== undefined) {
// docId = docs[0].id;
// break;
// }
// await new Promise(resolve => setTimeout(resolve, INTERVAL));
// retry++;
// }
// if (docId === undefined) {
// console.error(`无法获取今日日记的 docId`);
// return;
// }
// updateDocReservation(docId, false);
// }

/**
* 给定笔记本,将今日的预约块插入笔记本的 daily note 中
* @param notebook
Expand Down

0 comments on commit c1016c8

Please sign in to comment.