mirror of
https://github.com/discourse/discourse.git
synced 2025-01-18 18:52:45 +08:00
UX: remove live character countdowns from the composer
This commit is contained in:
parent
9c59f77018
commit
5ceb84421e
|
@ -95,11 +95,6 @@ export default DiscourseController.extend({
|
|||
|
||||
},
|
||||
|
||||
updateDraftStatus() {
|
||||
const c = this.get('model');
|
||||
if (c) { c.updateDraftStatus(); }
|
||||
},
|
||||
|
||||
appendText(text, opts) {
|
||||
const c = this.get('model');
|
||||
if (c) {
|
||||
|
|
|
@ -242,31 +242,6 @@ Discourse.Composer = Discourse.Model.extend({
|
|||
return reply.replace(/\s+/img, " ").trim().length;
|
||||
}.property('reply'),
|
||||
|
||||
|
||||
updateDraftStatus: function() {
|
||||
var $title = $('#reply-title'),
|
||||
$reply = $('#wmd-input');
|
||||
|
||||
// 'title' is focused
|
||||
if ($title.is(':focus')) {
|
||||
var titleDiff = this.get('missingTitleCharacters');
|
||||
if (titleDiff > 0) {
|
||||
this.flashDraftStatusForNewUser();
|
||||
return this.set('draftStatus', I18n.t('composer.min_length.need_more_for_title', { n: titleDiff }));
|
||||
}
|
||||
// 'reply' is focused
|
||||
} else if ($reply.is(':focus')) {
|
||||
var replyDiff = this.get('missingReplyCharacters');
|
||||
if (replyDiff > 0) {
|
||||
return this.set('draftStatus', I18n.t('composer.min_length.need_more_for_reply', { n: replyDiff }));
|
||||
}
|
||||
}
|
||||
|
||||
// hide the counters if the currently focused text field is OK
|
||||
this.set('draftStatus', null);
|
||||
|
||||
}.observes('missingTitleCharacters', 'missingReplyCharacters'),
|
||||
|
||||
init: function() {
|
||||
this._super();
|
||||
var val = (Discourse.Mobile.mobileView ? false : (Discourse.KeyValueStore.get('composer.showPreview') || 'true'));
|
||||
|
@ -655,17 +630,9 @@ Discourse.Composer = Discourse.Model.extend({
|
|||
return Discourse.Draft.save(this.get('draftKey'), this.get('draftSequence'), data)
|
||||
.then(function() {
|
||||
composer.set('draftStatus', I18n.t('composer.saved_draft_tip'));
|
||||
}, function() {
|
||||
}).catch(function() {
|
||||
composer.set('draftStatus', I18n.t('composer.drafts_offline'));
|
||||
});
|
||||
},
|
||||
|
||||
flashDraftStatusForNewUser: function() {
|
||||
var $draftStatus = $('#draft-status');
|
||||
if (Discourse.User.currentProp('trust_level') === 0) {
|
||||
$draftStatus.toggleClass('flash', true);
|
||||
setTimeout(function() { $draftStatus.removeClass('flash'); }, 250);
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
|
|
@ -49,11 +49,6 @@ const ComposerView = Discourse.View.extend(Ember.Evented, {
|
|||
Ember.run.scheduleOnce('afterRender', this, 'refreshPreview');
|
||||
}.observes('model.reply', 'model.hidePreview'),
|
||||
|
||||
focusIn() {
|
||||
const controller = this.get('controller');
|
||||
if (controller) controller.updateDraftStatus();
|
||||
},
|
||||
|
||||
movePanels(sizePx) {
|
||||
$('#main-outlet').css('padding-bottom', sizePx);
|
||||
$('.composer-popup').css('bottom', sizePx);
|
||||
|
|
|
@ -93,17 +93,12 @@
|
|||
.toggle-preview {
|
||||
right: 5px;
|
||||
}
|
||||
#file-uploading {
|
||||
left: 51%;
|
||||
font-size: 0.857em;
|
||||
color: $primary;
|
||||
}
|
||||
#draft-status {
|
||||
#draft-status, #file-uploading {
|
||||
right: 51%;
|
||||
color: $primary;
|
||||
&.flash {
|
||||
color: $danger;
|
||||
}
|
||||
}
|
||||
#file-uploading {
|
||||
font-size: 0.857em;
|
||||
}
|
||||
transition: height 0.4s ease;
|
||||
width: 100%;
|
||||
|
|
|
@ -34,9 +34,6 @@ display: none !important; // can be removed if inline JS CSS is removed from com
|
|||
}
|
||||
#draft-status {
|
||||
color: scale-color($primary, $lightness: 75%);
|
||||
&.flash {
|
||||
color: $danger;
|
||||
}
|
||||
}
|
||||
transition: height 0.4s ease;
|
||||
width: 100%;
|
||||
|
|
|
@ -678,10 +678,6 @@ en:
|
|||
similar_topics: "Your topic is similar to..."
|
||||
drafts_offline: "drafts offline"
|
||||
|
||||
min_length:
|
||||
need_more_for_title: "{{n}} to go for the title"
|
||||
need_more_for_reply: "{{n}} to go"
|
||||
|
||||
error:
|
||||
title_missing: "Title is required"
|
||||
title_too_short: "Title must be at least {{min}} characters"
|
||||
|
|
Loading…
Reference in New Issue
Block a user