Fixes identified by TS
This commit is contained in:
parent
e768ecb3d0
commit
0a5abb09f4
2 changed files with 5 additions and 4 deletions
|
@ -395,7 +395,7 @@ export default class EditMessageComposer extends React.Component<IProps, IState>
|
||||||
const sel = document.getSelection();
|
const sel = document.getSelection();
|
||||||
let caret;
|
let caret;
|
||||||
if (sel.focusNode) {
|
if (sel.focusNode) {
|
||||||
caret = getCaretOffsetAndText(this.editorRef.current, sel).caret;
|
caret = getCaretOffsetAndText(this.editorRef.current?.editorRef.current, sel).caret;
|
||||||
}
|
}
|
||||||
const parts = this.model.serializeParts();
|
const parts = this.model.serializeParts();
|
||||||
// if caret is undefined because for some reason there isn't a valid selection,
|
// if caret is undefined because for some reason there isn't a valid selection,
|
||||||
|
|
|
@ -207,20 +207,20 @@ export default class SendMessageComposer extends React.Component<IProps> {
|
||||||
|
|
||||||
// we keep sent messages/commands in a separate history (separate from undo history)
|
// we keep sent messages/commands in a separate history (separate from undo history)
|
||||||
// so you can alt+up/down in them
|
// so you can alt+up/down in them
|
||||||
private selectSendHistory(up: boolean): void {
|
private selectSendHistory(up: boolean): boolean {
|
||||||
const delta = up ? -1 : 1;
|
const delta = up ? -1 : 1;
|
||||||
// True if we are not currently selecting history, but composing a message
|
// True if we are not currently selecting history, but composing a message
|
||||||
if (this.sendHistoryManager.currentIndex === this.sendHistoryManager.history.length) {
|
if (this.sendHistoryManager.currentIndex === this.sendHistoryManager.history.length) {
|
||||||
// We can't go any further - there isn't any more history, so nop.
|
// We can't go any further - there isn't any more history, so nop.
|
||||||
if (!up) {
|
if (!up) {
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
this.currentlyComposedEditorState = this.model.serializeParts();
|
this.currentlyComposedEditorState = this.model.serializeParts();
|
||||||
} else if (this.sendHistoryManager.currentIndex + delta === this.sendHistoryManager.history.length) {
|
} else if (this.sendHistoryManager.currentIndex + delta === this.sendHistoryManager.history.length) {
|
||||||
// True when we return to the message being composed currently
|
// True when we return to the message being composed currently
|
||||||
this.model.reset(this.currentlyComposedEditorState);
|
this.model.reset(this.currentlyComposedEditorState);
|
||||||
this.sendHistoryManager.currentIndex = this.sendHistoryManager.history.length;
|
this.sendHistoryManager.currentIndex = this.sendHistoryManager.history.length;
|
||||||
return;
|
return true;
|
||||||
}
|
}
|
||||||
const { parts, replyEventId } = this.sendHistoryManager.getItem(delta);
|
const { parts, replyEventId } = this.sendHistoryManager.getItem(delta);
|
||||||
dis.dispatch({
|
dis.dispatch({
|
||||||
|
@ -231,6 +231,7 @@ export default class SendMessageComposer extends React.Component<IProps> {
|
||||||
this.model.reset(parts);
|
this.model.reset(parts);
|
||||||
this.editorRef.current?.focus();
|
this.editorRef.current?.focus();
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private isSlashCommand(): boolean {
|
private isSlashCommand(): boolean {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue