diff --git a/client/landing/custom-editor/editor.js b/client/landing/custom-editor/editor.js deleted file mode 100644 index 67c1551e5090c..0000000000000 --- a/client/landing/custom-editor/editor.js +++ /dev/null @@ -1,159 +0,0 @@ -/** - * External dependencies - */ -import memize from 'memize'; -import { size, map, without } from 'lodash'; - -/** - * WordPress dependencies - */ -import { withSelect, withDispatch } from '@wordpress/data'; -import { EditorProvider, ErrorBoundary, PostLockedModal } from '@wordpress/editor'; -import { StrictMode, Component } from '@wordpress/element'; -import { KeyboardShortcuts, SlotFillProvider, DropZoneProvider } from '@wordpress/components'; -import { compose } from '@wordpress/compose'; - -/** - * Internal dependencies - */ -import preventEventDiscovery from '@wordpress/edit-post/build-module/prevent-event-discovery'; -import Layout from '@wordpress/edit-post/build-module/components/layout'; -import EditorInitialization from '@wordpress/edit-post/build-module/components/editor-initialization'; -import EditPostSettings from '@wordpress/edit-post/build-module/components/edit-post-settings'; - -// We need a core/edit-post store -import '@wordpress/edit-post/build-module/store'; - -class Editor extends Component { - constructor() { - super( ...arguments ); - - this.getEditorSettings = memize( this.getEditorSettings, { - maxSize: 1, - } ); - } - - getEditorSettings( - settings, - hasFixedToolbar, - showInserterHelpPanel, - focusMode, - hiddenBlockTypes, - blockTypes, - preferredStyleVariations, - __experimentalLocalAutosaveInterval, - updatePreferredStyleVariations - ) { - settings = { - ...settings, - __experimentalPreferredStyleVariations: { - value: preferredStyleVariations, - onChange: updatePreferredStyleVariations, - }, - hasFixedToolbar, - focusMode, - showInserterHelpPanel, - __experimentalLocalAutosaveInterval, - }; - - // Omit hidden block types if exists and non-empty. - if ( size( hiddenBlockTypes ) > 0 ) { - // Defer to passed setting for `allowedBlockTypes` if provided as - // anything other than `true` (where `true` is equivalent to allow - // all block types). - const defaultAllowedBlockTypes = - true === settings.allowedBlockTypes - ? map( blockTypes, 'name' ) - : settings.allowedBlockTypes || []; - - settings.allowedBlockTypes = without( defaultAllowedBlockTypes, ...hiddenBlockTypes ); - } - - return settings; - } - - render() { - const { - settings, - hasFixedToolbar, - focusMode, - post, - postId, - initialEdits, - onError, - hiddenBlockTypes, - blockTypes, - preferredStyleVariations, - __experimentalLocalAutosaveInterval, - showInserterHelpPanel, - updatePreferredStyleVariations, - ...props - } = this.props; - - if ( ! post ) { - return null; - } - - const editorSettings = this.getEditorSettings( - settings, - hasFixedToolbar, - showInserterHelpPanel, - focusMode, - hiddenBlockTypes, - blockTypes, - preferredStyleVariations, - __experimentalLocalAutosaveInterval, - updatePreferredStyleVariations - ); - - return ( - - - - - - - - - - - - - - - - - ); - } -} - -export default compose( [ - withSelect( ( select, { postId, postType } ) => { - const { isFeatureActive, getPreference } = select( 'core/edit-post' ); - const { getEntityRecord } = select( 'core' ); - const { getBlockTypes } = select( 'core/blocks' ); - - return { - showInserterHelpPanel: isFeatureActive( 'showInserterHelpPanel' ), - hasFixedToolbar: isFeatureActive( 'fixedToolbar' ), - focusMode: isFeatureActive( 'focusMode' ), - post: getEntityRecord( 'postType', postType, postId ), - preferredStyleVariations: getPreference( 'preferredStyleVariations' ), - hiddenBlockTypes: getPreference( 'hiddenBlockTypes' ), - blockTypes: getBlockTypes(), - __experimentalLocalAutosaveInterval: getPreference( 'localAutosaveInterval' ), - }; - } ), - withDispatch( dispatch => { - const { updatePreferredStyleVariations } = dispatch( 'core/edit-post' ); - return { - updatePreferredStyleVariations, - }; - } ), -] )( Editor ); diff --git a/client/landing/custom-editor/index.tsx b/client/landing/custom-editor/index.tsx index b21932966d0c3..0cacb9e1c5ea2 100644 --- a/client/landing/custom-editor/index.tsx +++ b/client/landing/custom-editor/index.tsx @@ -1,38 +1,13 @@ /** * External dependencies */ -import '@automattic/calypso-polyfills'; -import React from 'react'; -import ReactDom from 'react-dom'; -import { BrowserRouter } from 'react-router-dom'; import config from '../../config'; - -/** - * Internal dependencies - */ -import CustomEditor from './editor'; -// import { setupWpDataDebug } from './devtools'; // Currently only available in Gutenboarding -import accessibleFocus from 'lib/accessible-focus'; -/** - * Style dependencies - */ -import 'assets/stylesheets/gutenboarding.scss'; -import 'components/environment-badge/style.scss'; +import { initialize } from '@wordpress/edit-site'; window.AppBoot = () => { if ( ! config.isEnabled( 'custom-editor' ) ) { window.location.href = '/'; } else { - // setupWpDataDebug(); - - // Add accessible-focus listener. - accessibleFocus(); - - ReactDom.render( - - - , - document.getElementById( 'wpcom' ) - ); + initialize( 'wpcom', {} ); } };