Merge pull request #2089 from matrix-org/t3chguy/slate_cont2
Slate Fixes 42?
This commit is contained in:
commit
b6ebb0cc37
1 changed files with 8 additions and 24 deletions
|
@ -1255,16 +1255,14 @@ export default class MessageComposerInput extends React.Component {
|
||||||
|
|
||||||
let editorState;
|
let editorState;
|
||||||
const historyItem = this.historyManager.getItem(delta);
|
const historyItem = this.historyManager.getItem(delta);
|
||||||
if (historyItem) {
|
if (!historyItem) return;
|
||||||
if (historyItem.format === 'rich' && !this.state.isRichTextEnabled) {
|
|
||||||
editorState = this.richToMdEditorState(historyItem.value);
|
if (historyItem.format === 'rich' && !this.state.isRichTextEnabled) {
|
||||||
}
|
editorState = this.richToMdEditorState(historyItem.value);
|
||||||
else if (historyItem.format === 'markdown' && this.state.isRichTextEnabled) {
|
} else if (historyItem.format === 'markdown' && this.state.isRichTextEnabled) {
|
||||||
editorState = this.mdToRichEditorState(historyItem.value);
|
editorState = this.mdToRichEditorState(historyItem.value);
|
||||||
}
|
} else {
|
||||||
else {
|
editorState = historyItem.value;
|
||||||
editorState = historyItem.value;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Move selection to the end of the selected history
|
// Move selection to the end of the selected history
|
||||||
|
@ -1544,18 +1542,6 @@ export default class MessageComposerInput extends React.Component {
|
||||||
this.handleKeyCommand('toggle-mode');
|
this.handleKeyCommand('toggle-mode');
|
||||||
};
|
};
|
||||||
|
|
||||||
onBlur = (e) => {
|
|
||||||
this.selection = this.state.editorState.selection;
|
|
||||||
};
|
|
||||||
|
|
||||||
onFocus = (e) => {
|
|
||||||
if (this.selection) {
|
|
||||||
const change = this.state.editorState.change().select(this.selection);
|
|
||||||
this.onChange(change);
|
|
||||||
delete this.selection;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
focusComposer = () => {
|
focusComposer = () => {
|
||||||
this.refs.editor.focus();
|
this.refs.editor.focus();
|
||||||
};
|
};
|
||||||
|
@ -1601,8 +1587,6 @@ export default class MessageComposerInput extends React.Component {
|
||||||
onChange={this.onChange}
|
onChange={this.onChange}
|
||||||
onKeyDown={this.onKeyDown}
|
onKeyDown={this.onKeyDown}
|
||||||
onPaste={this.onPaste}
|
onPaste={this.onPaste}
|
||||||
onBlur={this.onBlur}
|
|
||||||
onFocus={this.onFocus}
|
|
||||||
renderNode={this.renderNode}
|
renderNode={this.renderNode}
|
||||||
renderMark={this.renderMark}
|
renderMark={this.renderMark}
|
||||||
// disable spell check for the placeholder because browsers don't like "unencrypted"
|
// disable spell check for the placeholder because browsers don't like "unencrypted"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue