diff --git a/editor/editor/index.js b/editor/editor/index.js
index cbee5bc237701d..cb7e9731229959 100644
--- a/editor/editor/index.js
+++ b/editor/editor/index.js
@@ -12,7 +12,7 @@ export default class Editor {
render() {
wp.element.render(
- ,
+ ,
document.getElementById( this.id )
);
}
diff --git a/editor/editor/layout.js b/editor/editor/layout.js
index 4dbe2d218a8e88..5ee4136687aa73 100644
--- a/editor/editor/layout.js
+++ b/editor/editor/layout.js
@@ -6,25 +6,18 @@ import EditorText from './mode/text';
import EditorVisual from './mode/visual';
class Layout extends wp.element.Component {
- constructor() {
+ constructor( props ) {
super( ...arguments );
this.switchMode = this.switchMode.bind( this );
this.changeHtml = this.changeHtml.bind( this );
this.changeBlocks = this.changeBlocks.bind( this );
this.state = {
mode: 'visual',
- html: '',
- blocks: []
+ html: props.initialContent,
+ blocks: wp.blocks.parse( this.props.initialContent )
};
}
- componentDidMount() {
- this.setState( {
- html: this.props.content,
- blocks: wp.blocks.parse( this.props.content )
- } );
- }
-
switchMode( newMode ) {
// TODO: we need a serializer from blocks here
const html = this.state.html;
diff --git a/editor/editor/mode-switcher.js b/editor/editor/mode-switcher.js
index 25862cc3fec863..2743d8f7acad1f 100644
--- a/editor/editor/mode-switcher.js
+++ b/editor/editor/mode-switcher.js
@@ -7,8 +7,7 @@ class ModeSwitcher extends wp.element.Component {
};
}
- toggle( event ) {
- event.preventDefault();
+ toggle() {
this.setState( {
opened: ! this.state.opened
} );
@@ -40,7 +39,7 @@ class ModeSwitcher extends wp.element.Component {
{ modes.map( ( mode ) =>
-