REFACTOR: composer to use flexbox
This commit is contained in:
@@ -2,7 +2,7 @@ import DiscourseURL from 'discourse/lib/url';
|
||||
import Quote from 'discourse/lib/quote';
|
||||
import Draft from 'discourse/models/draft';
|
||||
import Composer from 'discourse/models/composer';
|
||||
import { default as computed, observes } from 'ember-addons/ember-computed-decorators';
|
||||
import { default as computed, observes, on } from 'ember-addons/ember-computed-decorators';
|
||||
import InputValidation from 'discourse/models/input-validation';
|
||||
import { getOwner } from 'discourse-common/lib/get-owner';
|
||||
import { escapeExpression } from 'discourse/lib/utilities';
|
||||
@@ -68,9 +68,27 @@ export default Ember.Controller.extend({
|
||||
isUploading: false,
|
||||
topic: null,
|
||||
linkLookup: null,
|
||||
showPreview: true,
|
||||
forcePreview: Ember.computed.and('site.mobileView', 'showPreview'),
|
||||
whisperOrUnlistTopic: Ember.computed.or('model.whisper', 'model.unlistTopic'),
|
||||
categories: Ember.computed.alias('site.categoriesList'),
|
||||
|
||||
@on('init')
|
||||
_setupPreview() {
|
||||
const val = (this.site.mobileView ? false : (this.keyValueStore.get('composer.showPreview') || 'true'));
|
||||
this.set('showPreview', val === 'true');
|
||||
},
|
||||
|
||||
@computed('showPreview')
|
||||
toggleText: function(showPreview) {
|
||||
return showPreview ? I18n.t('composer.hide_preview') : I18n.t('composer.show_preview');
|
||||
},
|
||||
|
||||
@observes('showPreview')
|
||||
showPreviewChanged() {
|
||||
this.keyValueStore.set({ key: 'composer.showPreview', value: this.get('showPreview') });
|
||||
},
|
||||
|
||||
@computed('model.replyingToTopic', 'model.creatingPrivateMessage', 'model.targetUsernames')
|
||||
focusTarget(replyingToTopic, creatingPM, usernames) {
|
||||
if (this.capabilities.isIOS) { return "none"; }
|
||||
@@ -206,6 +224,10 @@ export default Ember.Controller.extend({
|
||||
|
||||
actions: {
|
||||
|
||||
togglePreview() {
|
||||
this.toggleProperty('showPreview');
|
||||
},
|
||||
|
||||
typed() {
|
||||
this.checkReplyLength();
|
||||
this.get('model').typing();
|
||||
@@ -291,10 +313,6 @@ export default Ember.Controller.extend({
|
||||
return false;
|
||||
},
|
||||
|
||||
togglePreview() {
|
||||
this.get('model').togglePreview();
|
||||
},
|
||||
|
||||
// Import a quote from the post
|
||||
importQuote(toolbarEvent) {
|
||||
const postStream = this.get('topic.postStream');
|
||||
|
||||
Reference in New Issue
Block a user