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}}
<div class='control-row reply-area'>
<div class='composer-fields'>
{{plugin-outlet "composer-open"}}
<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"}}
{{popupInputTip validation=view.categoryValidation shownAt=view.showCategoryTip}}
</div>
{{plugin-outlet "composer-fields"}}
{{#if model.archetype.hasOptions}}
<button class='btn' {{action "showOptions"}}>{{i18n 'topic.options'}}</button>
{{/if}}
@ -71,6 +73,7 @@ so I'm going to stop rendering it until we figure out what's up
{{/unless}}
</div>
{{/if}}
</div>
<div class='wmd-controls'>
<div class='textarea-wrapper'>

View File

@ -63,12 +63,18 @@ var ComposerView = Discourse.View.extend(Ember.Evented, {
resize: function() {
var self = this;
Em.run.scheduleOnce('afterRender', function() {
if (self.movePanels) {
var h = $('#reply-control').height() || 0;
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() {
var controller = this.get('controller');
@ -103,11 +109,12 @@ var ComposerView = Discourse.View.extend(Ember.Evented, {
_enableResizing: function() {
var $replyControl = $('#reply-control'),
self = this;
$replyControl.DivResizer({
resize: this.resize,
resize: this.resize.bind(self),
onDrag: function (sizePx) { self.movePanels.apply(self, [sizePx]); }
});
afterTransition($replyControl, this.resize);
afterTransition($replyControl, this.resize.bind(self));
this.ensureMaximumDimensionForImagesInPreview();
this.set('controller.view', this);
}.on('didInsertElement'),

View File

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