Modify an Element after Creation v3.23
To modify an element right after it has been created (i.e. not after it has been duplicated or pasted from somewhere), you can listen for the wpce_before_insert_node event on the document. It triggers after an element is picked in the "Add Element" dialog.
js
document.addEventListener('wpce_before_insert_node', event => {
// Get the document node and the WPCE instance
const { node, instance } = event.detail
// Do something to the node, e.g. add children or modify properties
})