Wednesday, February 8, 2023
HomeWordPress Developmentplugin improvement - Reinitiate Gutenburg's blocks utilizing javascript

plugin improvement – Reinitiate Gutenburg’s blocks utilizing javascript


I am growing a WordPress plugin that manipulates some Gutenberg blocks utilizing javascript.

For higher understanding, create a desk in a publish and run the code beneath within the console:

let tableHtml = doc.querySelector(".wp-block-table").innerHTML;
doc.querySelector(".wp-block-table").innerHTML = tableHtml;

I am changing the innerHTML of a block, after which if I attempt to change the desk caption or delete the desk, it will not work.

and I feel it is as a result of the desk is modified and the eventListeners are all gone so I must initialize them once more, however I do not understand how.

I feel I discovered the operate chargeable for that, it is table_init situated on wp-includes/js/dist/block-library.js however I do not know find out how to use it.

Any concepts?

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments