Closed PsagnatAF closed 4 years ago
Hello! Can you rephrase the question? I don't understand what it is you're trying to achieve. _call tomjneditor by wp.data.select doesn't make sense.
If you have access to the core editor, then you have no need for any of the code in this repo, and should not be looking here. I'm pretty certain you're running into a dead end, or at least doing something terribly wrong.
If you need to put blocks inside another block, just use the official nested blocks API
Hi I try to insert blocks manually to editor
In native guttenberg
var content = "Test content"; var name = 'core/paragraph'; insertedBlock = wp.blocks.createBlock(name, { content: content, }); wp.data.dispatch('core/editor').insertBlocks(insertedBlock);
but in tomjn/block-comments this doesn't work.
@PsagnatAF that's not how this works. tomjn_editor
works the same was as the wp_editor
function. If you want to do more you should look at the blog post I wrote about it, or the talks I've given, eitherway there is no data store here to insert blocks into. It just takes saved content as a string and presents a block editor.
If you're trying to manipulate those blocks at runtime programmatically, then you're going to have to make your own modifications. That function is too simple for what you're wanting to do, and you will need to understand how it works to do what you want to do.
How can I call tomjn_editor by wp.data.select()?
example: wp.data.select('core/block-editor').getBlocks()