diff options
author | Reverite <github@reverite.sh> | 2019-09-18 16:38:31 -0700 |
---|---|---|
committer | Reverite <github@reverite.sh> | 2019-09-18 16:38:31 -0700 |
commit | 73f4af117fc5b5e4ee3337d634f5e589a9353644 (patch) | |
tree | 62b0443573ba5038fd45aa14d4243dfc832c060a /app/javascript/flavours/glitch/features/compose | |
parent | 849e2bc4ca11892e701835a4696904d78b1ad325 (diff) | |
parent | febcdad2e2c98aee62b55ee21bdf0debf7c6fd6b (diff) |
Merge branch 'glitch' into production
Diffstat (limited to 'app/javascript/flavours/glitch/features/compose')
-rw-r--r-- | app/javascript/flavours/glitch/features/compose/components/dropdown_menu.js | 13 | ||||
-rw-r--r-- | app/javascript/flavours/glitch/features/compose/components/poll_form.js | 2 |
2 files changed, 6 insertions, 9 deletions
diff --git a/app/javascript/flavours/glitch/features/compose/components/dropdown_menu.js b/app/javascript/flavours/glitch/features/compose/components/dropdown_menu.js index 60fee9b7f..404504e84 100644 --- a/app/javascript/flavours/glitch/features/compose/components/dropdown_menu.js +++ b/app/javascript/flavours/glitch/features/compose/components/dropdown_menu.js @@ -77,9 +77,7 @@ export default class ComposerOptionsDropdownContent extends React.PureComponent document.removeEventListener('touchend', this.handleDocumentClick, withPassive); } - handleClick = (e) => { - const name = e.currentTarget.getAttribute('data-index'); - + handleClick = (name, e) => { const { onChange, onClose, @@ -103,9 +101,8 @@ export default class ComposerOptionsDropdownContent extends React.PureComponent } } - handleKeyDown = e => { + handleKeyDown = (name, e) => { const { items } = this.props; - const name = e.currentTarget.getAttribute('data-index'); const index = items.findIndex(item => { return (item.name === name); }); @@ -183,7 +180,7 @@ export default class ComposerOptionsDropdownContent extends React.PureComponent let prefix = null; if (on !== null && typeof on !== 'undefined') { - prefix = <Toggle checked={on} onChange={this.handleClick} />; + prefix = <Toggle checked={on} onChange={this.handleClick.bind(this, name)} />; } else if (icon) { prefix = <Icon className='icon' fixedWidth id={icon} /> } @@ -191,8 +188,8 @@ export default class ComposerOptionsDropdownContent extends React.PureComponent return ( <div className={computedClass} - onClick={this.handleClick} - onKeyDown={this.handleKeyDown} + onClick={this.handleClick.bind(this, name)} + onKeyDown={this.handleKeyDown.bind(this, name)} role='option' tabIndex='0' key={name} 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 d0678f2f0..3d818ea20 100644 --- a/app/javascript/flavours/glitch/features/compose/components/poll_form.js +++ b/app/javascript/flavours/glitch/features/compose/components/poll_form.js @@ -79,7 +79,7 @@ class Option extends React.PureComponent { </label> <div className='poll__cancel'> - <IconButton disabled={index <= 1} title={intl.formatMessage(messages.remove_option)} id='times' onClick={this.handleOptionRemove} /> + <IconButton disabled={index <= 1} title={intl.formatMessage(messages.remove_option)} icon='times' onClick={this.handleOptionRemove} /> </div> </li> ); |