mirror of
https://github.com/element-hq/element-web
synced 2024-11-28 12:28:50 +03:00
Merge pull request #2677 from jryans/composer-input
Add `onClick` to Markdown buttons
This commit is contained in:
commit
c45ca58689
2 changed files with 10 additions and 4 deletions
|
@ -257,6 +257,8 @@ export default class MessageComposer extends React.Component {
|
|||
}
|
||||
|
||||
onInputStateChanged(inputState) {
|
||||
// Merge the new input state with old to support partial updates
|
||||
inputState = Object.assign({}, this.state.inputState, inputState);
|
||||
this.setState({inputState});
|
||||
}
|
||||
|
||||
|
@ -501,7 +503,7 @@ export default class MessageComposer extends React.Component {
|
|||
{ formatButtons }
|
||||
<div style={{ flex: 1 }}></div>
|
||||
<AccessibleButton className="mx_MessageComposer_formatbar_markdown mx_MessageComposer_markdownDisabled"
|
||||
onMouseDown={this.onToggleMarkdownClicked}
|
||||
onClick={this.onToggleMarkdownClicked}
|
||||
title={_t("Markdown is disabled")}
|
||||
/>
|
||||
<AccessibleButton element="img" title={_t("Hide Text Formatting Toolbar")}
|
||||
|
|
|
@ -628,7 +628,6 @@ export default class MessageComposerInput extends React.Component {
|
|||
}
|
||||
const inputState = {
|
||||
marks: editorState.activeMarks,
|
||||
isRichTextEnabled: this.state.isRichTextEnabled,
|
||||
blockType,
|
||||
};
|
||||
this.props.onInputStateChanged(inputState);
|
||||
|
@ -698,8 +697,13 @@ export default class MessageComposerInput extends React.Component {
|
|||
this.setState({
|
||||
editorState: this.createEditorState(enabled, editorState),
|
||||
isRichTextEnabled: enabled,
|
||||
}, ()=>{
|
||||
}, () => {
|
||||
this._editor.focus();
|
||||
if (this.props.onInputStateChanged) {
|
||||
this.props.onInputStateChanged({
|
||||
isRichTextEnabled: enabled,
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
SettingsStore.setValue("MessageComposerInput.isRichTextEnabled", null, SettingLevel.ACCOUNT, enabled);
|
||||
|
@ -1603,7 +1607,7 @@ export default class MessageComposerInput extends React.Component {
|
|||
</div>
|
||||
<div className={className}>
|
||||
<AccessibleButton className={markdownClasses}
|
||||
onMouseDown={this.onMarkdownToggleClicked}
|
||||
onClick={this.onMarkdownToggleClicked}
|
||||
title={this.state.isRichTextEnabled ? _t("Markdown is disabled") : _t("Markdown is enabled")}
|
||||
/>
|
||||
<Editor ref={this._collectEditor}
|
||||
|
|
Loading…
Reference in a new issue