From 47c36a5bfce174456691aa4720e474c231e2b246 Mon Sep 17 00:00:00 2001 From: Riad Benguella Date: Fri, 12 Jan 2018 14:41:18 +0100 Subject: [PATCH] Meta Boxes: Allow collapsing/sorting the meta boxes panels --- editor/store/effects.js | 8 +++++++- lib/client-assets.php | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/editor/store/effects.js b/editor/store/effects.js index 333865b956743b..ecc8a12e0ff652 100644 --- a/editor/store/effects.js +++ b/editor/store/effects.js @@ -2,7 +2,7 @@ * External dependencies */ import { BEGIN, COMMIT, REVERT } from 'redux-optimist'; -import { get, includes, map, castArray, uniqueId } from 'lodash'; +import { get, includes, map, castArray, uniqueId, some } from 'lodash'; /** * WordPress dependencies @@ -452,4 +452,10 @@ export default { const message = spokenMessage || content; speak( message, 'assertive' ); }, + INITIALIZE_META_BOX_STATE( action ) { + // Allow toggling metaboxes panels + if ( some( action.metaBoxes ) ) { + window.postboxes.add_postbox_toggles( 'post' ); + } + }, }; diff --git a/lib/client-assets.php b/lib/client-assets.php index 20caf75b0f0151..a4f787ade8954b 100644 --- a/lib/client-assets.php +++ b/lib/client-assets.php @@ -690,7 +690,7 @@ function gutenberg_editor_scripts_and_styles( $hook ) { wp_enqueue_script( 'wp-editor', gutenberg_url( 'editor/build/index.js' ), - array( 'jquery', 'wp-api', 'wp-data', 'wp-date', 'wp-i18n', 'wp-blocks', 'wp-element', 'wp-components', 'wp-utils', 'word-count', 'editor', 'heartbeat' ), + array( 'postbox', 'jquery', 'wp-api', 'wp-data', 'wp-date', 'wp-i18n', 'wp-blocks', 'wp-element', 'wp-components', 'wp-utils', 'word-count', 'editor', 'heartbeat' ), filemtime( gutenberg_dir_path() . 'editor/build/index.js' ), true // enqueue in the footer. );