Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
georgeguimaraes committed Nov 14, 2022
1 parent cf9ab26 commit a58b415
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions index.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
import "@logseq/libs";
async function add_para_properties(property: string) {
const page = logseq.Editor.getCurrentPage() as PageEntity;
const blocks = logseq.Editor.getCurrentPageBlocksTree();
const page = await logseq.Editor.getCurrentPage() as PageEntity;
const blocks = await logseq.Editor.getCurrentPageBlocksTree();
const first_block = blocks[0];
const p = property;
console.log(page);
console.log(p);

if (page.properties) {
await logseq.Editor.upsertBlockProperty(first_block.uuid, p, "");
await logseq.Editor.upsertBlockProperty(first_block.uuid, property, "");
} else {
await logseq.Editor.insertBlock(first_block.uuid, "", { before: true, properties: { p: ""}});
var properties_obj = {};
properties_obj[property] = "";
await logseq.Editor.insertBlock(first_block.uuid, "", { sibling: true, before: true, properties: properties_obj });
}
}

Expand Down

0 comments on commit a58b415

Please sign in to comment.