Live Preview (#119)

Live preview mode is here
This commit is contained in:
Zef Hemel
2022-11-18 16:04:37 +01:00
committed by GitHub
parent c9713bf52b
commit 24c17a793f
42 changed files with 1502 additions and 183 deletions
-5
View File
@@ -91,7 +91,6 @@ export function taskToggle(event: ClickEvent) {
export function previewTaskToggle(eventString: string) {
const [eventName, pos] = JSON.parse(eventString);
if (eventName === "task") {
console.log("Gotta toggle a task at", pos);
return taskToggleAtPos(+pos);
}
}
@@ -107,9 +106,6 @@ async function toggleTaskMarker(node: ParseTree, moveToPos: number) {
to: node.to,
insert: changeTo,
},
selection: {
anchor: moveToPos,
},
});
const parentWikiLinks = collectNodesMatching(
@@ -147,7 +143,6 @@ export async function taskToggleAtPos(pos: number) {
addParentPointers(mdTree);
const node = nodeAtPos(mdTree, pos);
// console.log("Got this node", node?.type);
if (node && node.type === "TaskMarker") {
await toggleTaskMarker(node, pos);
}
+8
View File
@@ -21,6 +21,14 @@ syntax:
styles:
backgroundColor: "rgba(22,22,22,0.07)"
functions:
turnIntoTask:
redirect: core.applyLineReplace
slashCommand:
name: task
description: Turn into task
match: "^(\\s*)[\\-\\*]?\\s*(\\[[ xX]\\])?\\s*"
replace: "$1* [ ] "
indexTasks:
path: "./task.ts:indexTasks"
events: