Save composer height in localStorage

This commit is contained in:
Toby Zerner 2015-02-06 12:21:34 +10:30
parent 461885c40d
commit 3d6d3192d9

View File

@ -38,7 +38,7 @@ export default Ember.View.extend(Ember.Evented, {
var controller = this.get('controller'); var controller = this.get('controller');
// Hide the composer to begin with. // Hide the composer to begin with.
this.set('height', this.$().height()); this.set('height', localStorage.getItem('composerHeight') || this.$().height());
this.$().hide(); this.$().hide();
// If the composer is minimized, allow the user to click anywhere on // If the composer is minimized, allow the user to click anywhere on
@ -223,9 +223,12 @@ export default Ember.View.extend(Ember.Evented, {
// height so that it fills the height of the composer, and update the // height so that it fills the height of the composer, and update the
// body's padding. // body's padding.
var deltaPixels = event.data.mouseStart - event.clientY; var deltaPixels = event.data.mouseStart - event.clientY;
view.set('height', event.data.heightStart + deltaPixels); var height = event.data.heightStart + deltaPixels;
view.set('height', height);
view.updateContentHeight(); view.updateContentHeight();
view.updateBodyPadding(); view.updateBodyPadding();
localStorage.setItem('composerHeight', height);
}, },
mouseWasReleased: function(event) { mouseWasReleased: function(event) {