Skip to content

Commit

Permalink
Remove isEditor check and move isBrowser directly to if()
Browse files Browse the repository at this point in the history
  • Loading branch information
simison committed Nov 29, 2018
1 parent 46f81d4 commit 3407901
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions client/gutenberg/extensions/tiled-gallery/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,6 @@ import { getActiveStyleName, getLayout } from './layouts';
*/
import './view.scss';

const isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined';

// @TODO this isn't working; need a reliable canonical way to determine editor vs view?
const isEditor = isBrowser && window.hasOwnProperty( 'wp' ) && window.wp.hasOwnProperty( 'editor' );

const applyNodeSize = ( node, { width, height } ) => {
node.style.width = `${ width }px`;
node.style.height = `${ height }px`;
Expand Down Expand Up @@ -88,11 +83,6 @@ const getGalleries = () => {
* Setup ResizeObserver to follow each gallery on the page
*/
const observeGalleries = () => {
// Do nothing if page loads an editor
if ( isEditor ) {
return;
}

const galleries = getGalleries();

if ( galleries.length === 0 ) {
Expand All @@ -117,7 +107,7 @@ const observeGalleries = () => {
} );
};

if ( isBrowser ) {
if ( typeof window !== 'undefined' && typeof document !== 'undefined' ) {
// `DOMContentLoaded` may fire before the script has a chance to run
if ( document.readyState === 'loading' ) {
document.addEventListener( 'DOMContentLoaded', observeGalleries );
Expand Down

0 comments on commit 3407901

Please sign in to comment.