Site icon Hip-Hop Website Design and Development

Block Editor: get title and submit content material inside the WordPress admin UI in Javascript?

Adapting some previous web optimization module (which was written for TinyMCE) I’ve to entry the present submit title and submit content material by way of JavaScript. I’ve been avoiding Gutenberg up to now, however it looks like this shall be not attainable.

Throughout the previous web optimization module there are the next strains within the admin.js:

var title = $('#title').val().trim();
var content material = $('#content material').val().trim();

These fields don’t exist in Gutenberg anymore. I’ve tried to search out the proper manner to do that within the docs, however no luck thus far. I’ve discovered:

wp.knowledge.choose("core/editor").getBlocks()
wp.knowledge.choose("core")

However each appear to be empty arrays in my case (though this submit has content material). I principally simply want a solution to get the textual contents of all blocks (and possibly seperatly from the principle submit title if that is attainable). Who is aware of how to try this?