Skip to content

Commit

Permalink
Exclude child blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
wns3645 committed Mar 12, 2024
1 parent a9f3a01 commit 52557c2
Showing 1 changed file with 3 additions and 17 deletions.
20 changes: 3 additions & 17 deletions src/send-task.ts
Original file line number Diff line number Diff line change
@@ -1,26 +1,12 @@
import { BlockEntity, BlockIdentity } from "@logseq/libs/dist/LSPlugin.user";
import { BlockIdentity } from "@logseq/libs/dist/LSPlugin.user";

export const send = async (uuid: BlockIdentity): Promise<void> => {
try {
const blk = await logseq.Editor.getBlock(uuid, { includeChildren: true });
const blk = await logseq.Editor.getBlock(uuid);
const currGraph = await logseq.App.getCurrentGraph();
if (!blk || !currGraph) throw new Error();

let content: string = "";
if (blk.children!.length > 0) {
const findAllChildBlocks = (blocks: BlockEntity[]) => {
for (const b of blocks) {
content += "- " + b.content + "\n";
if (b.children!.length > 0) {
findAllChildBlocks(b.children as BlockEntity[]);
}
}
};
findAllChildBlocks(blk.children as BlockEntity[]);
}

content += "\n";
content += `Source: logseq://graph/${currGraph.name}`;
const content = `Source: logseq://graph/${currGraph.name}`;

window.open(
`things:///add?title=${encodeURIComponent(
Expand Down

0 comments on commit 52557c2

Please sign in to comment.