plugins icon indicating copy to clipboard operation
plugins copied to clipboard

🧩 logseq.Editor.upsertBlockProperty

Open utterances-bot opened this issue 1 year ago • 6 comments
trafficstars

https://plugins-doc.logseq.com/logseq/Editor/upsertBlockProperty

utterances-bot avatar Jun 22 '24 23:06 utterances-bot

There is a bug when updating as page properties. Use updateBlock() and enter property:: value/n directly at the beginning of its content. The \n means a new line.) This will load the value into the database as a page property.

YU000jp avatar Jun 22 '24 23:06 YU000jp

thanks! @YU000jp very useful information!

zhaochunqi avatar Jul 20 '24 17:07 zhaochunqi

There is a bug when updating as page properties. Use updateBlock() and enter property:: value/n directly at the beginning of its content. The \n means a new line.) This will load the value into the database as a page property.

That means I need to create a new block, then update the block, and write the block's content in the form of properties. This way, I can set the page properties, right? I'll try it tonight.

b-yp avatar Aug 07 '24 04:08 b-yp

@b-yp The problem is when you update properties using upsertBlockProperty it will work as expected, but it will not write to the db, you will need to reindex your graph to make it work.

zhaochunqi avatar Aug 07 '24 06:08 zhaochunqi

@b-yp The problem is when you update properties using upsertBlockProperty it will work as expected, but it will not write to the db, you will need to reindex your graph to make it work.

Yes, I am currently stuck at this point. I have many methods to set properties for a page, but these methods do not write to the database; they only look good on the page. When I use the menu (Make it public publishing) to set the public property, it still creates a new block to save the properties, rather than adding them to the original one. Logseq does not have a dedicated API for setting page properties.

b-yp avatar Aug 07 '24 14:08 b-yp

@zhaochunqi, I don't see the change even after reindexing the graph. Do I need to take any other action?

jmbenedetto avatar Nov 19 '24 13:11 jmbenedetto