From cc29f25b87d44daf5da2d3ef702ea29a333630b5 Mon Sep 17 00:00:00 2001 From: Fire Demon Date: Sat, 15 Aug 2020 21:41:55 -0500 Subject: [UI] Non-destructive conversion of reply to non-reply, add clear button --- .../glitch/features/compose/components/compose_form.js | 6 ++++++ .../glitch/features/compose/components/publisher.js | 18 +++++++++++++++++- .../compose/containers/compose_form_container.js | 5 +++++ app/javascript/flavours/glitch/reducers/compose.js | 7 +++++-- .../glitch/styles/monsterfork/components/composer.scss | 11 +++++++++++ .../glitch/styles/monsterfork/components/index.scss | 3 ++- app/javascript/mastodon/locales/en-MP.json | 1 + 7 files changed, 47 insertions(+), 4 deletions(-) create mode 100644 app/javascript/flavours/glitch/styles/monsterfork/components/composer.scss diff --git a/app/javascript/flavours/glitch/features/compose/components/compose_form.js b/app/javascript/flavours/glitch/features/compose/components/compose_form.js index adaf063ee..aa97f864a 100644 --- a/app/javascript/flavours/glitch/features/compose/components/compose_form.js +++ b/app/javascript/flavours/glitch/features/compose/components/compose_form.js @@ -151,6 +151,10 @@ class ComposeForm extends ImmutablePureComponent { this.handleSubmit(sideArm === 'none' ? null : sideArm); } + handleClearAll = () => { + this.props.onClearAll(); + } + // Selects a suggestion from the autofill. onSuggestionSelected = (tokenStart, token, value) => { this.props.onSuggestionSelected(tokenStart, token, value, ['text']); @@ -258,6 +262,7 @@ class ComposeForm extends ImmutablePureComponent { handleSecondarySubmit, handleSelect, handleSubmit, + handleClearAll, handleRefTextarea, } = this; const { @@ -360,6 +365,7 @@ class ComposeForm extends ImmutablePureComponent { disabled={disabledButton} onSecondarySubmit={handleSecondarySubmit} onSubmit={handleSubmit} + onClearAll={handleClearAll} privacy={privacy} privacyWarning={privacyWarning} sideArm={sideArm} diff --git a/app/javascript/flavours/glitch/features/compose/components/publisher.js b/app/javascript/flavours/glitch/features/compose/components/publisher.js index 107c7fa91..08318ab6d 100644 --- a/app/javascript/flavours/glitch/features/compose/components/publisher.js +++ b/app/javascript/flavours/glitch/features/compose/components/publisher.js @@ -23,6 +23,10 @@ const messages = defineMessages({ defaultMessage: '{publish}!', id: 'compose_form.publish_loud', }, + clear: { + defaultMessage: 'Clear', + id: 'compose_form.clear', + }, }); export default @injectIntl @@ -34,6 +38,7 @@ class Publisher extends ImmutablePureComponent { intl: PropTypes.object.isRequired, onSecondarySubmit: PropTypes.func, onSubmit: PropTypes.func, + onClearAll: PropTypes.func, privacy: PropTypes.oneOf(['direct', 'private', 'unlisted', 'public']), privacyWarning: PropTypes.bool, sideArm: PropTypes.oneOf(['none', 'direct', 'private', 'unlisted', 'public']), @@ -45,7 +50,7 @@ class Publisher extends ImmutablePureComponent { }; render () { - const { countText, disabled, intl, onSecondarySubmit, privacy, privacyWarning, sideArm, sideArmWarning } = this.props; + const { countText, disabled, intl, onClearAll, onSecondarySubmit, privacy, privacyWarning, sideArm, sideArmWarning } = this.props; const diff = maxChars - length(countText || ''); const computedClass = classNames('composer--publisher', { @@ -55,6 +60,17 @@ class Publisher extends ImmutablePureComponent { return (
+