diff options
author | Fire Demon <firedemon@creature.cafe> | 2020-08-15 22:19:26 -0500 |
---|---|---|
committer | Fire Demon <firedemon@creature.cafe> | 2020-08-30 05:45:18 -0500 |
commit | 405bdae4e8787b1b0155d5a3329ae19757c773f9 (patch) | |
tree | ca991fbb3283cbbc73b7dd5f276515c994b46561 /app | |
parent | cc29f25b87d44daf5da2d3ef702ea29a333630b5 (diff) |
[UI] Add double-click to clear
Diffstat (limited to 'app')
3 files changed, 13 insertions, 3 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 aa97f864a..e812ba982 100644 --- a/app/javascript/flavours/glitch/features/compose/components/compose_form.js +++ b/app/javascript/flavours/glitch/features/compose/components/compose_form.js @@ -73,10 +73,12 @@ class ComposeForm extends ImmutablePureComponent { onChangeVisibility: PropTypes.func, onPaste: PropTypes.func, onMediaDescriptionConfirm: PropTypes.func, + clearTimeout: PropTypes.bool, }; static defaultProps = { showSearch: false, + clearTimeout: null, }; handleChange = (e) => { @@ -152,7 +154,14 @@ class ComposeForm extends ImmutablePureComponent { } handleClearAll = () => { - this.props.onClearAll(); + if(!this.clearTimeout || this.clearTimeout === null) { + this.clearTimeout = window.setTimeout(() => { + this.clearTimeout = null; + }, 500); + } else { + this.clearTimeout = null; + this.props.onClearAll(); + } } // Selects a suggestion from the autofill. @@ -290,6 +299,7 @@ class ComposeForm extends ImmutablePureComponent { suggestions, text, spoilersAlwaysOn, + clearTimeout, } = this.props; let disabledButton = isSubmitting || isUploading || isChangingUpload || (!text.trim().length && !anyMedia); diff --git a/app/javascript/flavours/glitch/features/compose/components/publisher.js b/app/javascript/flavours/glitch/features/compose/components/publisher.js index 08318ab6d..d42c578aa 100644 --- a/app/javascript/flavours/glitch/features/compose/components/publisher.js +++ b/app/javascript/flavours/glitch/features/compose/components/publisher.js @@ -24,7 +24,7 @@ const messages = defineMessages({ id: 'compose_form.publish_loud', }, clear: { - defaultMessage: 'Clear', + defaultMessage: 'Double-click to clear', id: 'compose_form.clear', }, }); diff --git a/app/javascript/mastodon/locales/en-MP.json b/app/javascript/mastodon/locales/en-MP.json index 31c798215..2818b7003 100644 --- a/app/javascript/mastodon/locales/en-MP.json +++ b/app/javascript/mastodon/locales/en-MP.json @@ -21,7 +21,7 @@ "column.public": "Fediverse", "column.toot": "Roars & Growls", "community.column_settings.remote_only": "Rowdy tavern mode", - "compose_form.clear": "Clear", + "compose_form.clear": "Double-click to clear", "compose_form.direct_message_warning": "This roar will only be sent to the mentioned creatures.", "compose_form.hashtag_warning": "This roar won't be listed under any hashtag as it is unlisted. Only public roars can be searched by hashtag.", "compose_form.lock_disclaimer": "Your account is not {locked}. Anyone can follow you to view your follower-only posts.", |