Skip to content

Commit

Permalink
Update the UI on window resize
Browse files Browse the repository at this point in the history
Fixes #513
  • Loading branch information
ipeychev committed Apr 30, 2016
1 parent 98f297b commit 7cdbddc
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/ui/react/src/adapter/alloy-editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@

nativeEditor.destroy();
}

window.removeEventListener('resize', this._resizeEventListener);
},

/**
Expand Down Expand Up @@ -160,15 +162,23 @@

uiNode.appendChild(editorUIElement);

var eventsDelay = this.get('eventsDelay');

this._mainUI = ReactDOM.render(React.createElement(AlloyEditor.UI, {
editor: this,
eventsDelay: this.get('eventsDelay'),
eventsDelay: eventsDelay,
toolbars: this.get('toolbars')
}), editorUIElement);

this._editorUIElement = editorUIElement;

this.get('nativeEditor').fire('uiReady');

this._resizeEventListener = CKEDITOR.tools.debounce(function() {
this._mainUI.forceUpdate();
}, eventsDelay, this);

window.addEventListener('resize', this._resizeEventListener);
}
},

Expand Down

0 comments on commit 7cdbddc

Please sign in to comment.