Gutenberg default initial values for FocalPointPicker

Ok, I found the solution by myself. Inside withSelect it is needed to assign default value if getEditedPostAttribute is empty. // Helper function to check if received meta object is empty or not function isEmpty(obj) { for(var key in obj) { if(obj.hasOwnProperty(key)) return false; } return true; } PhotoControl = withSelect( (select) => { let … Read more

Saving data from block editor to the database

I’ve found a solution using Ajax with native Javascript as follows: // Filename send2server.js const sendToServer = function() { /* Prepare the object to be sent: ********************************************************************/ var params = new FormData(); params.append(‘action’, ‘update_sql’); // update_sql is implemented in PHP (see below) params.append(‘quoteAtt’, props.attributes.quoteAtt); // The actual data /* Create the Ajax connection object: ****************************************************************/ … Read more