From 80e03deba7d7737099eed1cdd02e6cc352792c25 Mon Sep 17 00:00:00 2001 From: Andrew Duthie Date: Fri, 23 Feb 2018 13:33:55 -0500 Subject: [PATCH] Blocks: Disable Reusable elements by Disabled component --- blocks/library/block/index.js | 59 ++++++++++++++++++++--------------- 1 file changed, 33 insertions(+), 26 deletions(-) diff --git a/blocks/library/block/index.js b/blocks/library/block/index.js index 31efe46ad53bf..c358090d79e1b 100644 --- a/blocks/library/block/index.js +++ b/blocks/library/block/index.js @@ -7,8 +7,8 @@ import { connect } from 'react-redux'; /** * WordPress dependencies */ -import { Component } from '@wordpress/element'; -import { Placeholder, Spinner } from '@wordpress/components'; +import { Component, Fragment } from '@wordpress/element'; +import { Placeholder, Spinner, Disabled } from '@wordpress/components'; import { __ } from '@wordpress/i18n'; /** @@ -99,30 +99,37 @@ class ReusableBlockEdit extends Component { const reusableBlockAttributes = { ...reusableBlock.attributes, ...attributes }; - return [ - // We fake the block being read-only by wrapping it with an element that has pointer-events: none -
- -
, - isSelected && ( - - ), - ]; + let element = ( + + ); + + if ( ! isEditing ) { + element = { element }; + } + + return ( + + { element } + { isSelected && ( + + ) } + + ); } }