-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathindex.html
101 lines (100 loc) · 3.64 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Markmap Integration For Logseq</title>
<script type="application/javascript">
async function rollTaskStatus(el, event) {
event.stopPropagation()
const config = await logseq.App.getUserConfigs()
const uuid = el.getAttribute('data-uuid')
const block = await logseq.Editor.getBlock(uuid)
if (block) {
if (event.altKey || event.metaKey) {
const tasks = [
'TODO',
'DOING',
'DONE',
'LATER',
'NOW',
'WAITING',
'CANCELLED',
]
const regx = new RegExp(`^${tasks.join('|')}`, 'gm')
let content = regx.test(block.content)
? block.content.replace(regx, '').trimStart()
: block.content
await logseq.Editor.updateBlock(uuid, 'DONE ' + content)
} else {
if (block.content && block.content.startsWith('TODO')) {
await logseq.Editor.updateBlock(
uuid,
block.content.replace(/^TODO/, 'DOING')
)
} else if (block.content && block.content.startsWith('DOING')) {
await logseq.Editor.updateBlock(
uuid,
block.content.replace(/^DOING/, 'DONE')
)
} else if (block.content && block.content.startsWith('NOW')) {
await logseq.Editor.updateBlock(
uuid,
block.content.replace(/^NOW/, 'LATER')
)
} else if (block.content && block.content.startsWith('LATER')) {
await logseq.Editor.updateBlock(
uuid,
block.content.replace(/^LATER/, 'DONE')
)
} else if (block.content && block.content.startsWith('WAITING')) {
if (config.preferredWorkflow === 'todo') {
await logseq.Editor.updateBlock(
uuid,
block.content.replace(/^WAITING/, 'TODO')
)
} else {
await logseq.Editor.updateBlock(
uuid,
block.content.replace(/^WAITING/, 'NOW')
)
}
} else if (block.content && block.content.startsWith('CANCELLED')) {
if (config.preferredWorkflow === 'todo') {
await logseq.Editor.updateBlock(
uuid,
block.content.replace(/^CANCELLED/, 'TODO')
)
} else {
await logseq.Editor.updateBlock(
uuid,
block.content.replace(/^CANCELLED/, 'NOW')
)
}
} else if (block.content && block.content.startsWith('DONE')) {
if (config.preferredWorkflow === 'todo') {
await logseq.Editor.updateBlock(
uuid,
block.content.replace(/^DONE/, 'TODO')
)
} else {
await logseq.Editor.updateBlock(
uuid,
block.content.replace(/^DONE/, 'NOW')
)
}
}
}
logseq.hideMainUI()
logseq.showMainUI()
}
}
</script>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.ts"></script>
<script src="https://cdn.jsdelivr.net/npm/katex@0.12.0/dist/katex.min.js"></script>
</body>
</html>