Jump direct to preview if no further settings are required woocommerce/woocommerce-blocks#68

This commit is contained in:
claudiulodro 2018-04-03 09:56:00 -07:00
parent 06e76d402a
commit 55054fcd02
2 changed files with 11 additions and 1 deletions

View File

@ -836,10 +836,15 @@ registerBlockType('woocommerce/products', {
function getSettingsEditor() {
var update_display_callback = function update_display_callback(value) {
// These options have setting screens that need further input from the user, so keep edit mode open.
var needsFurtherSettings = ['specific', 'attribute', 'category'];
if (display !== value) {
setAttributes({
display: value,
display_setting: []
display_setting: [],
edit_mode: needsFurtherSettings.includes(value)
});
}
};

View File

@ -572,10 +572,15 @@ registerBlockType( 'woocommerce/products', {
function getSettingsEditor() {
const update_display_callback = ( value ) => {
// These options have setting screens that need further input from the user, so keep edit mode open.
const needsFurtherSettings = [ 'specific', 'attribute', 'category' ];
if ( display !== value ) {
setAttributes( {
display: value,
display_setting: [],
edit_mode: needsFurtherSettings.includes( value ),
} );
}
};