// Trigger resize event to relayout the React Layout plugin

export default function resizeLayout() {
  return next => action => {
    next(action)
    if (
      action.type === 'ENABLE_PRESENTATION_MODE' ||
      action.type === 'DISABLE_PRESENTATION_MODE'
    ) {
      // Uses longer event object creation method due to IE compatibility.
      const evt = document.createEvent('HTMLEvents')
      evt.initEvent('resize', false, true)
      window.dispatchEvent(evt)
    }
  }
}

// Trigger resize event to relayout the React Layout plugin
import {enablePresentationMode} from '../actions/app'

export default function resizeLayout() {
  return next => action => {
    next(action)
    if (
      action.type === 'ENABLE_PRESENTATION_MODE' ||
      action.type === 'DISABLE_PRESENTATION_MODE'
    ) {
      // Uses longer event object creation method due to IE compatibility.
      const evt = document.createEvent('HTMLEvents')
      evt.initEvent('resize', false, true)
      window.dispatchEvent(evt)
    }
    if (window.location.search.includes('present')) {
      next(enablePresentationMode())
      next(action)
    }
  }
}

Add 'present' url query/search param to presentation mode middleware.
Add 'present' url query/search param to presentation mode middleware.
