Skip to content

Commit

Permalink
Merge pull request #6 from GenbuHase/v3
Browse files Browse the repository at this point in the history
[WIP] りさ姉ボタンの改良
  • Loading branch information
YoheiZuho committed Jan 8, 2018
2 parents 59b8254 + d9a815e commit eacde0d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
4 changes: 2 additions & 2 deletions app/javascript/mastodon/actions/UtilBtns.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ export const UTILBTNS_RISA = 'UTILBTNS_RISA';
export const UTILBTNS_GOJI = 'UTILBTNS_GOJI';
export const UTILBTNS_HARUKIN = 'UTILBTNS_HARUKIN';

export function submitRisa () {
export function submitRisa (content = "") {
return function (dispatch, getState) {
let text = "@RISA ";
let text = `@RISA ${content}`;

dispatch(submitRisaRequest());
dispatch(changeCompose(text));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,13 @@ export default class ComposeForm extends ImmutablePureComponent {
this.props.onPickEmoji(position, data);
}

handleOnRisaSubmit = () => {
this.props.onRisaSubmit(this.autosuggestTextarea.textarea.value);
this.autosuggestTextarea.textarea.focus();
}

render () {
const { intl, onPaste, showSearch, onRisaSubmit } = this.props;
const { intl, onPaste, showSearch } = this.props;
const disabled = this.props.is_submitting;
const text = [this.props.spoiler_text, countableText(this.props.text)].join('');

Expand Down Expand Up @@ -209,7 +214,7 @@ export default class ComposeForm extends ImmutablePureComponent {

<div className='compose-form__publish'>
<div className='compose-form__publish-button-wrapper'>
<Button id="utilBtns__button--risa" className="utilBtns__button" text={intl.formatMessage(messages.risa)} onClick={onRisaSubmit} block />
<Button id="utilBtns__button--risa" className="utilBtns__button" text={intl.formatMessage(messages.risa)} onClick={this.handleOnRisaSubmit} block />
<Button text={publishText} onClick={this.handleSubmit} disabled={disabled || this.props.is_uploading || length(text) > 500 || (text.length !== 0 && text.trim().length === 0)} block />
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ const mapDispatchToProps = (dispatch) => ({
dispatch(insertEmojiCompose(position, data));
},

onRisaSubmit () {
dispatch(submitRisa());
onRisaSubmit (content) {
dispatch(submitRisa(content));
},

});
Expand Down

0 comments on commit eacde0d

Please sign in to comment.