diff --git a/app/assets/javascripts/discourse/components/composer-editor.js.es6 b/app/assets/javascripts/discourse/components/composer-editor.js.es6 index 86a9b02e501..43d33da68fa 100644 --- a/app/assets/javascripts/discourse/components/composer-editor.js.es6 +++ b/app/assets/javascripts/discourse/components/composer-editor.js.es6 @@ -37,10 +37,19 @@ export default Ember.Component.extend({ return `[${I18n.t('uploading')}]() `; }, - @computed() - replyPlaceholder() { - const key = authorizesOneOrMoreImageExtensions() ? "reply_placeholder" : "reply_placeholder_no_images"; - return `composer.${key}`; + @computed('composer.requiredCategoryMissing') + replyPlaceholder(requiredCategoryMissing) { + if (requiredCategoryMissing) { + return 'composer.reply_placeholder_choose_category'; + } else { + const key = authorizesOneOrMoreImageExtensions() ? "reply_placeholder" : "reply_placeholder_no_images"; + return `composer.${key}`; + } + }, + + @computed('composer.requiredCategoryMissing', 'composer.replyLength') + disableTextarea(requiredCategoryMissing, replyLength) { + return requiredCategoryMissing && replyLength === 0; }, @observes('composer.uploadCancelled') diff --git a/app/assets/javascripts/discourse/components/d-editor.js.es6 b/app/assets/javascripts/discourse/components/d-editor.js.es6 index e59ac9d78f1..c2811e5e5a3 100644 --- a/app/assets/javascripts/discourse/components/d-editor.js.es6 +++ b/app/assets/javascripts/discourse/components/d-editor.js.es6 @@ -750,6 +750,8 @@ export default Ember.Component.extend({ }, toolbarButton(button) { + if (this.get('disabled')) { return; } + const selected = this._getSelected(button.trimLeading); const toolbarEvent = { selected, @@ -770,6 +772,8 @@ export default Ember.Component.extend({ }, showLinkModal() { + if (this.get('disabled')) { return; } + this._lastSel = this._getSelected(); if (this._lastSel) { @@ -780,6 +784,8 @@ export default Ember.Component.extend({ }, formatCode() { + if (this.get('disabled')) { return; } + const sel = this._getSelected('', { lineVal: true }); const selValue = sel.value; const hasNewLine = selValue.indexOf("\n") !== -1; @@ -833,6 +839,7 @@ export default Ember.Component.extend({ }, emoji() { + if (this.get('disabled')) { return; } this.set('emojiPickerIsActive', !this.get('emojiPickerIsActive')); } } diff --git a/app/assets/javascripts/discourse/models/composer.js.es6 b/app/assets/javascripts/discourse/models/composer.js.es6 index 52411269e6d..94a3e328001 100644 --- a/app/assets/javascripts/discourse/models/composer.js.es6 +++ b/app/assets/javascripts/discourse/models/composer.js.es6 @@ -265,13 +265,17 @@ const Composer = RestModel.extend({ return this.get('targetUsernames') && (this.get('targetUsernames').trim() + ',').indexOf(',') === 0; } else { // has a category? (when needed) - return this.get('canCategorize') && - !this.siteSettings.allow_uncategorized_topics && - !this.get('categoryId') && - !this.user.get('admin'); + return this.get('requiredCategoryMissing'); } }.property('loading', 'canEditTitle', 'titleLength', 'targetUsernames', 'replyLength', 'categoryId', 'missingReplyCharacters'), + @computed('canCategorize', 'categoryId') + requiredCategoryMissing(canCategorize, categoryId) { + return canCategorize && !categoryId && + !this.siteSettings.allow_uncategorized_topics && + !this.user.get('admin'); + }, + titleLengthValid: function() { if (this.user.get('admin') && this.get('post.static_doc') && this.get('titleLength') > 0) return true; if (this.get('titleLength') < this.get('minimumTitleLength')) return false; diff --git a/app/assets/javascripts/discourse/templates/components/composer-editor.hbs b/app/assets/javascripts/discourse/templates/components/composer-editor.hbs index 511961d8f14..ebf9a3d856f 100644 --- a/app/assets/javascripts/discourse/templates/components/composer-editor.hbs +++ b/app/assets/javascripts/discourse/templates/components/composer-editor.hbs @@ -16,6 +16,7 @@ onExpandPopupMenuOptions="onExpandPopupMenuOptions" onPopupMenuAction=onPopupMenuAction popupMenuOptions=popupMenuOptions + disabled=disableTextarea outletArgs=(hash composer=composer editorType="composer")}} {{#if site.mobileView}} diff --git a/app/assets/javascripts/discourse/templates/components/d-editor.hbs b/app/assets/javascripts/discourse/templates/components/d-editor.hbs index 06c636c2b7c..571285df208 100644 --- a/app/assets/javascripts/discourse/templates/components/d-editor.hbs +++ b/app/assets/javascripts/discourse/templates/components/d-editor.hbs @@ -10,7 +10,7 @@