Skip to content

Commit

Permalink
Hide 'hide section' when in fse
Browse files Browse the repository at this point in the history
  • Loading branch information
PatelUtkarsh committed Jan 27, 2022
1 parent bc106fb commit 45d8848
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
13 changes: 8 additions & 5 deletions theme/assets/src/block-editor/plugins/hide-sections/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/* global materialDesignThemeEditorVars */
/**
* Wordpress Dependencies
*/
Expand Down Expand Up @@ -117,7 +117,10 @@ const WrappedSectionControl = compose( [
} ),
] )( HideSection );

registerPlugin( 'material-hide-sections', {
render: WrappedSectionControl,
icon: <Icon icon="admin-customizer" />,
} );
/** @member {{isFse:boolean}} materialDesignThemeEditorVars */
if ( ! materialDesignThemeEditorVars?.isFse ) {
registerPlugin( 'material-hide-sections', {
render: WrappedSectionControl,
icon: <Icon icon="admin-customizer" />,
} );
}
13 changes: 12 additions & 1 deletion theme/inc/block-editor.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@
function setup() {
add_action( 'init', __NAMESPACE__ . '\\register_disable_section_meta' );
add_action( 'enqueue_block_editor_assets', __NAMESPACE__ . '\\enqueue_block_editor_assets' );
add_action( 'body_class', __NAMESPACE__ . '\\filter_body_class' );
if ( ! is_fse() ) {
add_action( 'body_class', __NAMESPACE__ . '\\filter_body_class' );
}

$blocks = new Blocks();
$blocks->init();
Expand Down Expand Up @@ -83,6 +85,15 @@ function enqueue_block_editor_assets() {
$version,
false
);

wp_localize_script(
'material-block-editor-js-theme',
'materialDesignThemeEditorVars',
[
'isFse' => is_fse(),
]
);

if ( ! wp_style_is( 'material-google-fonts-cdn', 'enqueued' ) ) {
wp_enqueue_style(
'material-google-fonts-cdn',
Expand Down

0 comments on commit 45d8848

Please sign in to comment.