Use javascript to resize the composer properly rather than using the

type of composer being used.
This commit is contained in:
Robin Ward 2015-01-06 12:05:11 -05:00
parent 4318d6a2bd
commit 8ee0f4d1e7
3 changed files with 65 additions and 62 deletions

View File

@ -18,6 +18,7 @@ so I'm going to stop rendering it until we figure out what's up
{{#if model.viewOpen}} {{#if model.viewOpen}}
<div class='control-row reply-area'> <div class='control-row reply-area'>
<div class='composer-fields'>
{{plugin-outlet "composer-open"}} {{plugin-outlet "composer-open"}}
<div class='reply-to'> <div class='reply-to'>
@ -64,6 +65,7 @@ so I'm going to stop rendering it until we figure out what's up
{{category-chooser valueAttribute="id" value=model.categoryId scopedCategoryId=scopedCategoryId tabindex="3"}} {{category-chooser valueAttribute="id" value=model.categoryId scopedCategoryId=scopedCategoryId tabindex="3"}}
{{popupInputTip validation=view.categoryValidation shownAt=view.showCategoryTip}} {{popupInputTip validation=view.categoryValidation shownAt=view.showCategoryTip}}
</div> </div>
{{plugin-outlet "composer-fields"}}
{{#if model.archetype.hasOptions}} {{#if model.archetype.hasOptions}}
<button class='btn' {{action "showOptions"}}>{{i18n 'topic.options'}}</button> <button class='btn' {{action "showOptions"}}>{{i18n 'topic.options'}}</button>
{{/if}} {{/if}}
@ -71,6 +73,7 @@ so I'm going to stop rendering it until we figure out what's up
{{/unless}} {{/unless}}
</div> </div>
{{/if}} {{/if}}
</div>
<div class='wmd-controls'> <div class='wmd-controls'>
<div class='textarea-wrapper'> <div class='textarea-wrapper'>

View File

@ -63,12 +63,18 @@ var ComposerView = Discourse.View.extend(Ember.Evented, {
resize: function() { resize: function() {
var self = this; var self = this;
Em.run.scheduleOnce('afterRender', function() { Em.run.scheduleOnce('afterRender', function() {
if (self.movePanels) {
var h = $('#reply-control').height() || 0; var h = $('#reply-control').height() || 0;
self.movePanels.apply(self, [h + "px"]); self.movePanels.apply(self, [h + "px"]);
// Figure out the size of the fields
var $fields = self.$('.composer-fields'),
pos = $fields.position();
if (pos) {
self.$('.wmd-controls').css('top', $fields.height() + pos.top + 5);
} }
}); });
}.observes('model.composeState'), }.observes('model.composeState', 'model.action'),
keyUp: function() { keyUp: function() {
var controller = this.get('controller'); var controller = this.get('controller');
@ -103,11 +109,12 @@ var ComposerView = Discourse.View.extend(Ember.Evented, {
_enableResizing: function() { _enableResizing: function() {
var $replyControl = $('#reply-control'), var $replyControl = $('#reply-control'),
self = this; self = this;
$replyControl.DivResizer({ $replyControl.DivResizer({
resize: this.resize, resize: this.resize.bind(self),
onDrag: function (sizePx) { self.movePanels.apply(self, [sizePx]); } onDrag: function (sizePx) { self.movePanels.apply(self, [sizePx]); }
}); });
afterTransition($replyControl, this.resize); afterTransition($replyControl, this.resize.bind(self));
this.ensureMaximumDimensionForImagesInPreview(); this.ensureMaximumDimensionForImagesInPreview();
this.set('controller.view', this); this.set('controller.view', this);
}.on('didInsertElement'), }.on('didInsertElement'),

View File

@ -330,13 +330,6 @@
margin-bottom: 10px; margin-bottom: 10px;
} }
#reply-control.edit-title.private-message {
.wmd-controls {
transition: top 0.3s ease;
top: 140px;
}
}
#reply-control { #reply-control {
&.hide-preview { &.hide-preview {
.wmd-controls { .wmd-controls {