Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
frostime
siyuan-dailynote-today
提交
b441991d
S
siyuan-dailynote-today
项目概览
frostime
/
siyuan-dailynote-today
通知
17
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
siyuan-dailynote-today
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
未验证
提交
b441991d
编写于
5月 21, 2023
作者:
frostime
提交者:
GitHub
5月 21, 2023
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #47 from frostime/36-dnapi
36 dnapi
上级
9e0ea635
41a72319
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
30 addition
and
53 deletion
+30
-53
src/components/setting.svelte
src/components/setting.svelte
+1
-0
src/components/toolbar-menu.ts
src/components/toolbar-menu.ts
+1
-1
src/func.ts
src/func.ts
+17
-15
src/global-setting.ts
src/global-setting.ts
+1
-1
src/index.ts
src/index.ts
+5
-3
src/serverApi.ts
src/serverApi.ts
+5
-33
未找到文件。
src/components/setting.svelte
浏览文件 @
b441991d
...
...
@@ -55,6 +55,7 @@
type="button"
content={contents.update}
settingKey="Update"
settingValue={""}
on:click={onClick}
/>
</div>
src/components/toolbar-menu.ts
浏览文件 @
b441991d
...
...
@@ -82,7 +82,7 @@ export class ToolbarMenuItem {
/**
* 初始化的时候,加载所有的笔记本
*/
autoOpenDailyNote
()
{
a
sync
a
utoOpenDailyNote
()
{
info
(
'
自动开启日记
'
);
if
(
notebooks
.
notebooks
.
length
>
0
)
{
if
(
settings
.
settings
.
OpenOnStart
===
true
)
{
...
...
src/func.ts
浏览文件 @
b441991d
...
...
@@ -198,21 +198,23 @@ export async function createDiary(notebook: Notebook, todayDiaryHpath: string) {
* @param notebook_index 笔记本的 index
*/
export
async
function
openDiary
(
notebook
:
Notebook
)
{
let
todayDiaryPath
=
notebook
.
dailynotePath
;
info
(
`打开日记
${
notebook
.
name
}${
todayDiaryPath
}
`
);
//queryNotebooks() 保证了 todayDiaryPath 不为 null
let
docs
=
await
getDocsByHpath
(
todayDiaryPath
!
,
notebook
);
if
(
docs
!=
null
&&
docs
.
length
>
0
)
{
let
doc
=
docs
[
0
];
let
id
=
doc
.
id
;
window
.
open
(
`siyuan://blocks/
${
id
}
`
);
notify
(
`
${
i18n
.
Open
}
:
${
notebook
.
name
}
`
,
'
info
'
,
2500
);
}
else
{
let
id
=
await
createDiary
(
notebook
,
todayDiaryPath
!
);
window
.
open
(
`siyuan://blocks/
${
id
}
`
);
notify
(
`
${
i18n
.
Create
}
:
${
notebook
.
name
}
`
,
'
info
'
,
2500
);
}
// let todayDiaryPath = notebook.dailynotePath;
// info(`打开日记 ${notebook.name}${todayDiaryPath}`);
// let docs = await getDocsByHpath(todayDiaryPath!, notebook);
await
serverApi
.
createDailyNote
(
notebook
.
id
,
""
);
notify
(
`
${
i18n
.
Open
}
:
${
notebook
.
name
}
`
,
'
info
'
,
2000
);
// if (docs != null && docs.length > 0) {
// let doc = docs[0];
// let id = doc.id;
// window.open(`siyuan://blocks/${id}`);
// notify(`${i18n.Open}: ${notebook.name}`, 'info', 2500);
// } else {
// let id = await createDiary(notebook, todayDiaryPath!);
// window.open(`siyuan://blocks/${id}`);
// notify(`${i18n.Create}: ${notebook.name}`, 'info', 2500);
// }
}
export
function
compareVersion
(
v1Str
:
string
,
v2Str
:
string
)
{
...
...
src/global-setting.ts
浏览文件 @
b441991d
...
...
@@ -43,7 +43,7 @@ class SettingManager {
}
set
(
key
:
any
,
value
:
any
)
{
info
(
`Setting update:
${
key
}
=
${
value
}
`
)
//
info(`Setting update: ${key} = ${value}`)
if
(
!
(
key
in
this
.
settings
))
{
error
(
`"
${
key
}
" is not a setting`
);
return
;
...
...
src/index.ts
浏览文件 @
b441991d
...
...
@@ -15,6 +15,7 @@ import * as serverApi from './serverApi';
export
default
class
DailyNoteTodayPlugin
extends
Plugin
{
app
:
any
;
toolbar_item
:
ToolbarMenuItem
;
component_setting
:
Setting
;
...
...
@@ -49,14 +50,15 @@ export default class DailyNoteTodayPlugin extends Plugin {
this
.
initToolbarItem
();
this
.
initUpToDate
();
eventBus
.
subscribe
(
'
UpdateAll
'
,
()
=>
{
this
.
updateAll
()});
// 如果有笔记本,且设置中允许启动时打开,则打开第一个笔记本
this
.
toolbar_item
.
autoOpenDailyNote
();
await
this
.
toolbar_item
.
autoOpenDailyNote
();
// 等日记创建,完成了状态更新后再读取新的状态
setTimeout
(
()
=>
this
.
toolbar_item
.
updateDailyNoteStatus
(),
2
000
()
=>
this
.
toolbar_item
.
updateDailyNoteStatus
(),
1
000
);
eventBus
.
subscribe
(
'
UpdateAll
'
,
()
=>
{
this
.
updateAll
()});
let
end
=
performance
.
now
();
info
(
`启动耗时:
${
end
-
start
}
ms`
);
...
...
src/serverApi.ts
浏览文件 @
b441991d
...
...
@@ -10,39 +10,6 @@ async function request(url: string, data: any) {
return
res
;
}
function
parseBody
(
body
:
any
)
{
return
body
;
}
async
function
test
()
{
let
notebooks
=
await
lsNotebooks
();
console
.
log
(
notebooks
);
let
notebookId
=
notebooks
?.
notebooks
[
0
].
id
;
try
{
let
notebookConf
=
await
getNotebookConf
(
'
20220305173526-4yjl33h
'
);
console
.
log
(
notebookConf
);
}
catch
(
err
)
{
console
.
log
(
err
);
}
try
{
let
block
=
await
getBlockByID
(
'
20220316145830-u0u6srg
'
);
console
.
log
(
block
);
}
catch
(
err
)
{
console
.
log
(
err
);
}
try
{
let
block
=
await
renderSprig
(
'
/daily note/{{now | date "2006/01"}}/{{now | date "2006-01-02"}}
'
);
console
.
log
(
block
);
}
catch
(
err
)
{
console
.
log
(
err
);
}
// try {
// await moveBlock('20230512192002-q5ekmhh', '20230512192017-eyc4dyb', null);
// } catch (err) {
// console.log(err);
// }
}
export
async
function
sql
(
sql
:
string
)
{
let
sqldata
=
{
...
...
@@ -67,6 +34,11 @@ export async function createDocWithMd(notebookId: string, path: string, markdown
return
request
(
url
,
data
);
}
export
async
function
createDailyNote
(
notebookId
:
string
,
app
:
string
)
{
let
url
=
'
/api/filetree/createDailyNote
'
;
return
request
(
url
,
{
notebook
:
notebookId
,
app
:
app
});
}
export
async
function
getNotebookConf
(
notebookId
:
string
)
{
let
data
=
{
notebook
:
notebookId
};
let
url
=
'
/api/notebook/getNotebookConf
'
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录