diff options
Diffstat (limited to 'app/javascript/flavours/glitch/features/compose')
4 files changed, 26 insertions, 23 deletions
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 daacbb73f..3d736e83f 100644 --- a/app/javascript/flavours/glitch/features/compose/components/compose_form.js +++ b/app/javascript/flavours/glitch/features/compose/components/compose_form.js @@ -81,18 +81,6 @@ class ComposeForm extends ImmutablePureComponent { this.props.onChange(e.target.value); } - handleKeyDown = ({ ctrlKey, keyCode, metaKey, altKey }) => { - // We submit the status on control/meta + enter. - if (keyCode === 13 && (ctrlKey || metaKey)) { - this.handleSubmit(); - } - - // Submit the status with secondary visibility on alt + enter. - if (keyCode === 13 && altKey) { - this.handleSecondarySubmit(); - } - } - handleSubmit = (overriddenVisibility = null) => { const { textarea: { value }, uploadForm } = this; const { @@ -123,7 +111,7 @@ class ComposeForm extends ImmutablePureComponent { // Submit unless there are media with missing descriptions if (mediaDescriptionConfirmation && onMediaDescriptionConfirm && media && media.some(item => !item.get('description'))) { const firstWithoutDescription = media.find(item => !item.get('description')); - onMediaDescriptionConfirm(this.context.router ? this.context.router.history : null, firstWithoutDescription.get('id')); + onMediaDescriptionConfirm(this.context.router ? this.context.router.history : null, firstWithoutDescription.get('id'), overriddenVisibility); } else if (onSubmit) { if (onChangeVisibility && overriddenVisibility) { onChangeVisibility(overriddenVisibility); @@ -171,10 +159,20 @@ class ComposeForm extends ImmutablePureComponent { } // When the escape key is released, we focus the UI. - handleKeyUp = ({ key }) => { + handleKeyUp = ({ key, ctrlKey, keyCode, metaKey, altKey }) => { if (key === 'Escape') { document.querySelector('.ui').parentElement.focus(); } + + // We submit the status on control/meta + enter. + if (keyCode === 13 && (ctrlKey || metaKey)) { + this.handleSubmit(); + } + + // Submit the status with secondary visibility on alt + enter. + if (keyCode === 13 && altKey) { + this.handleSecondarySubmit(); + } } // Sets a reference to the textarea. @@ -307,7 +305,6 @@ class ComposeForm extends ImmutablePureComponent { placeholder={intl.formatMessage(messages.spoiler_placeholder)} value={spoilerText} onChange={this.handleChangeSpoiler} - onKeyDown={this.handleKeyDown} onKeyUp={this.handleKeyUp} disabled={!spoiler} ref={this.handleRefSpoilerText} @@ -328,9 +325,9 @@ class ComposeForm extends ImmutablePureComponent { disabled={isSubmitting} value={this.props.text} onChange={this.handleChange} + onKeyUp={this.handleKeyUp} suggestions={this.props.suggestions} onFocus={this.handleFocus} - onKeyDown={this.handleKeyDown} onSuggestionsFetchRequested={onFetchSuggestions} onSuggestionsClearRequested={onClearSuggestions} onSuggestionSelected={this.onSuggestionSelected} diff --git a/app/javascript/flavours/glitch/features/compose/components/options.js b/app/javascript/flavours/glitch/features/compose/components/options.js index 92348b000..9e332aabd 100644 --- a/app/javascript/flavours/glitch/features/compose/components/options.js +++ b/app/javascript/flavours/glitch/features/compose/components/options.js @@ -34,7 +34,7 @@ const messages = defineMessages({ id: 'content-type.change', }, direct_long: { - defaultMessage: 'Post to mentioned users only', + defaultMessage: 'Visible for mentioned users only', id: 'privacy.direct.long', }, direct_short: { @@ -66,7 +66,7 @@ const messages = defineMessages({ id: 'compose.content-type.plain', }, private_long: { - defaultMessage: 'Post to followers only', + defaultMessage: 'Visible for followers only', id: 'privacy.private.long', }, private_short: { @@ -74,7 +74,7 @@ const messages = defineMessages({ id: 'privacy.private.short', }, public_long: { - defaultMessage: 'Post to public timelines', + defaultMessage: 'Visible for all, shown in public timelines', id: 'privacy.public.long', }, public_short: { @@ -94,7 +94,7 @@ const messages = defineMessages({ id: 'advanced_options.threaded_mode.short', }, unlisted_long: { - defaultMessage: 'Do not show in public timelines', + defaultMessage: 'Visible for all, but not in public timelines', id: 'privacy.unlisted.long', }, unlisted_short: { diff --git a/app/javascript/flavours/glitch/features/compose/components/poll_form.js b/app/javascript/flavours/glitch/features/compose/components/poll_form.js index 3d818ea20..57fac10ac 100644 --- a/app/javascript/flavours/glitch/features/compose/components/poll_form.js +++ b/app/javascript/flavours/glitch/features/compose/components/poll_form.js @@ -62,7 +62,7 @@ class Option extends React.PureComponent { return ( <li> - <label className='poll__text editable'> + <label className='poll__option editable'> <span className={classNames('poll__input', { checkbox: isPollMultiple })} /> <AutosuggestInput @@ -143,6 +143,7 @@ class PollForm extends ImmutablePureComponent { <option value='true'>{intl.formatMessage(messages.multiple_choices)}</option> </select> + {/* eslint-disable-next-line jsx-a11y/no-onchange */} <select value={expiresIn} onChange={this.handleSelectDuration}> <option value={300}>{intl.formatMessage(messages.minutes, { number: 5 })}</option> <option value={1800}>{intl.formatMessage(messages.minutes, { number: 30 })}</option> diff --git a/app/javascript/flavours/glitch/features/compose/containers/compose_form_container.js b/app/javascript/flavours/glitch/features/compose/containers/compose_form_container.js index 18e2b2f39..fcd2caf1b 100644 --- a/app/javascript/flavours/glitch/features/compose/containers/compose_form_container.js +++ b/app/javascript/flavours/glitch/features/compose/containers/compose_form_container.js @@ -114,11 +114,16 @@ const mapDispatchToProps = (dispatch, { intl }) => ({ dispatch(changeComposeVisibility(value)); }, - onMediaDescriptionConfirm(routerHistory, mediaId) { + onMediaDescriptionConfirm(routerHistory, mediaId, overriddenVisibility = null) { dispatch(openModal('CONFIRM', { message: intl.formatMessage(messages.missingDescriptionMessage), confirm: intl.formatMessage(messages.missingDescriptionConfirm), - onConfirm: () => dispatch(submitCompose(routerHistory)), + onConfirm: () => { + if (overriddenVisibility) { + dispatch(changeComposeVisibility(overriddenVisibility)); + }; + dispatch(submitCompose(routerHistory)); + }, secondary: intl.formatMessage(messages.missingDescriptionEdit), onSecondary: () => dispatch(openModal('FOCAL_POINT', { id: mediaId })), onDoNotAsk: () => dispatch(changeLocalSetting(['confirm_missing_media_description'], false)), |