From 08119d3fa2521334279c12b83e740c7af5a4d188 Mon Sep 17 00:00:00 2001 From: iseulde Date: Wed, 20 Feb 2019 13:58:08 +0100 Subject: [PATCH] Add env check --- packages/editor/src/components/rich-text/index.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/editor/src/components/rich-text/index.js b/packages/editor/src/components/rich-text/index.js index 113ea4afa034f..c08b701ca4d61 100644 --- a/packages/editor/src/components/rich-text/index.js +++ b/packages/editor/src/components/rich-text/index.js @@ -137,10 +137,13 @@ export class RichText extends Component { setRef( node ) { if ( node ) { - const computedStyle = getComputedStyle( node ); + if ( process.env.NODE_ENV === 'development' ) { + const computedStyle = getComputedStyle( node ); - if ( computedStyle.display === 'inline' ) { - window.console.warn( 'RichText cannot be used with an inline container. Please use a different tagName.' ); + if ( computedStyle.display === 'inline' ) { + // eslint-disable-next-line no-console + console.warn( 'RichText cannot be used with an inline container. Please use a different tagName.' ); + } } this.editableRef = node;