diff --git a/editor/writing-flow/index.js b/editor/writing-flow/index.js index e3e09a0d24c05..fd9b508076057 100644 --- a/editor/writing-flow/index.js +++ b/editor/writing-flow/index.js @@ -17,13 +17,12 @@ const { UP, DOWN, LEFT, RIGHT } = keycodes; class WritingFlow extends Component { constructor() { super( ...arguments ); - this.zones = []; + this.onKeyDown = this.onKeyDown.bind( this ); this.onKeyUp = this.onKeyUp.bind( this ); this.bindContainer = this.bindContainer.bind( this ); - this.state = { - shouldMove: false, - }; + + this.shouldMove = false; } bindContainer( ref ) { @@ -65,17 +64,18 @@ class WritingFlow extends Component { if ( ( moveUp || moveDown ) && isEdge( target, moveUp ) ) { event.preventDefault(); - this.setState( { shouldMove: true } ); + this.shouldMove = true; } } onKeyUp( event ) { const { keyCode, target } = event; const moveUp = ( keyCode === UP || keyCode === LEFT ); - if ( this.state.shouldMove ) { + + if ( this.shouldMove ) { event.preventDefault(); this.moveFocusInContainer( target, moveUp ? 'UP' : 'DOWN' ); - this.setState( { shouldMove: false } ); + this.shouldMove = false; } }