add clear button & missing monsterpit visibility icons
parent
b93bf4b271
commit
4fc97d77a9
|
@ -52,6 +52,7 @@ class ComposeForm extends ImmutablePureComponent {
|
||||||
isUploading: PropTypes.bool,
|
isUploading: PropTypes.bool,
|
||||||
onChange: PropTypes.func,
|
onChange: PropTypes.func,
|
||||||
onSubmit: PropTypes.func,
|
onSubmit: PropTypes.func,
|
||||||
|
onClearAll: PropTypes.func,
|
||||||
onClearSuggestions: PropTypes.func,
|
onClearSuggestions: PropTypes.func,
|
||||||
onFetchSuggestions: PropTypes.func,
|
onFetchSuggestions: PropTypes.func,
|
||||||
onSuggestionSelected: PropTypes.func,
|
onSuggestionSelected: PropTypes.func,
|
||||||
|
@ -111,6 +112,7 @@ class ComposeForm extends ImmutablePureComponent {
|
||||||
text,
|
text,
|
||||||
mediaDescriptionConfirmation,
|
mediaDescriptionConfirmation,
|
||||||
onMediaDescriptionConfirm,
|
onMediaDescriptionConfirm,
|
||||||
|
onClearAll,
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
// If something changes inside the textarea, then we update the
|
// If something changes inside the textarea, then we update the
|
||||||
|
@ -168,6 +170,10 @@ class ComposeForm extends ImmutablePureComponent {
|
||||||
this.handleSubmit();
|
this.handleSubmit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
handleClearAll = () => {
|
||||||
|
this.props.onClearAll();
|
||||||
|
}
|
||||||
|
|
||||||
// Selects a suggestion from the autofill.
|
// Selects a suggestion from the autofill.
|
||||||
onSuggestionSelected = (tokenStart, token, value) => {
|
onSuggestionSelected = (tokenStart, token, value) => {
|
||||||
this.props.onSuggestionSelected(tokenStart, token, value, ['text']);
|
this.props.onSuggestionSelected(tokenStart, token, value, ['text']);
|
||||||
|
@ -279,6 +285,7 @@ class ComposeForm extends ImmutablePureComponent {
|
||||||
handleSelect,
|
handleSelect,
|
||||||
handleSubmit,
|
handleSubmit,
|
||||||
handleRefTextarea,
|
handleRefTextarea,
|
||||||
|
handleClearAll,
|
||||||
} = this;
|
} = this;
|
||||||
const {
|
const {
|
||||||
advancedOptions,
|
advancedOptions,
|
||||||
|
@ -376,6 +383,7 @@ class ComposeForm extends ImmutablePureComponent {
|
||||||
disabled={disabledButton}
|
disabled={disabledButton}
|
||||||
onSecondarySubmit={handleSecondarySubmit}
|
onSecondarySubmit={handleSecondarySubmit}
|
||||||
onSubmit={handleSubmit}
|
onSubmit={handleSubmit}
|
||||||
|
onClearAll={handleClearAll}
|
||||||
privacy={privacy}
|
privacy={privacy}
|
||||||
sideArm={sideArm}
|
sideArm={sideArm}
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -23,6 +23,10 @@ const messages = defineMessages({
|
||||||
defaultMessage: '{publish}!',
|
defaultMessage: '{publish}!',
|
||||||
id: 'compose_form.publish_loud',
|
id: 'compose_form.publish_loud',
|
||||||
},
|
},
|
||||||
|
clear: {
|
||||||
|
defaultMessage: 'Clear',
|
||||||
|
id: 'compose_form.clear',
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
export default @injectIntl
|
export default @injectIntl
|
||||||
|
@ -34,12 +38,13 @@ class Publisher extends ImmutablePureComponent {
|
||||||
intl: PropTypes.object.isRequired,
|
intl: PropTypes.object.isRequired,
|
||||||
onSecondarySubmit: PropTypes.func,
|
onSecondarySubmit: PropTypes.func,
|
||||||
onSubmit: PropTypes.func,
|
onSubmit: PropTypes.func,
|
||||||
privacy: PropTypes.oneOf(['direct', 'private', 'unlisted', 'public']),
|
onClearAll: PropTypes.func,
|
||||||
sideArm: PropTypes.oneOf(['none', 'direct', 'private', 'unlisted', 'public']),
|
privacy: PropTypes.oneOf(['direct', 'private', 'unlisted', 'local', 'public']),
|
||||||
|
sideArm: PropTypes.oneOf(['none', 'direct', 'private', 'unlisted', 'local', 'public']),
|
||||||
};
|
};
|
||||||
|
|
||||||
render () {
|
render () {
|
||||||
const { countText, disabled, intl, onSecondarySubmit, onSubmit, privacy, sideArm } = this.props;
|
const { countText, disabled, intl, onSecondarySubmit, onSubmit, onClearAll, privacy, sideArm } = this.props;
|
||||||
|
|
||||||
const diff = maxChars - length(countText || '');
|
const diff = maxChars - length(countText || '');
|
||||||
const computedClass = classNames('composer--publisher', {
|
const computedClass = classNames('composer--publisher', {
|
||||||
|
@ -49,6 +54,17 @@ class Publisher extends ImmutablePureComponent {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={computedClass}>
|
<div className={computedClass}>
|
||||||
|
<Button
|
||||||
|
className='clear'
|
||||||
|
onClick={onClearAll}
|
||||||
|
text={
|
||||||
|
<span>
|
||||||
|
<Icon icon='trash-o' />
|
||||||
|
{' '}
|
||||||
|
<FormattedMessage {...messages.clear} />
|
||||||
|
</span>
|
||||||
|
}
|
||||||
|
/>
|
||||||
<span className='count'>{diff}</span>
|
<span className='count'>{diff}</span>
|
||||||
{sideArm && sideArm !== 'none' ? (
|
{sideArm && sideArm !== 'none' ? (
|
||||||
<Button
|
<Button
|
||||||
|
@ -61,6 +77,7 @@ class Publisher extends ImmutablePureComponent {
|
||||||
<Icon
|
<Icon
|
||||||
icon={{
|
icon={{
|
||||||
public: 'globe',
|
public: 'globe',
|
||||||
|
local: 'users',
|
||||||
unlisted: 'unlock',
|
unlisted: 'unlock',
|
||||||
private: 'lock',
|
private: 'lock',
|
||||||
direct: 'envelope',
|
direct: 'envelope',
|
||||||
|
@ -86,6 +103,7 @@ class Publisher extends ImmutablePureComponent {
|
||||||
private: 'lock',
|
private: 'lock',
|
||||||
public: 'globe',
|
public: 'globe',
|
||||||
unlisted: 'unlock',
|
unlisted: 'unlock',
|
||||||
|
local: 'users',
|
||||||
}[privacy]}
|
}[privacy]}
|
||||||
/>
|
/>
|
||||||
{' '}
|
{' '}
|
||||||
|
|
|
@ -14,6 +14,7 @@ import {
|
||||||
submitCompose,
|
submitCompose,
|
||||||
unmountCompose,
|
unmountCompose,
|
||||||
uploadCompose,
|
uploadCompose,
|
||||||
|
resetCompose,
|
||||||
} from 'flavours/glitch/actions/compose';
|
} from 'flavours/glitch/actions/compose';
|
||||||
import {
|
import {
|
||||||
openModal,
|
openModal,
|
||||||
|
@ -134,6 +135,10 @@ const mapDispatchToProps = (dispatch, { intl }) => ({
|
||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onClearAll() {
|
||||||
|
dispatch(resetCompose());
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export default injectIntl(connect(mapStateToProps, mapDispatchToProps)(ComposeForm));
|
export default injectIntl(connect(mapStateToProps, mapDispatchToProps)(ComposeForm));
|
||||||
|
|
Loading…
Reference in New Issue