Replace deprecated String#substr with String#slice (#8314)
This commit is contained in:
parent
0e68c16a90
commit
c35fc169f5
17 changed files with 37 additions and 37 deletions
|
@ -364,7 +364,7 @@ export default class BasicMessageEditor extends React.Component<IProps, IState>
|
|||
private insertText(textToInsert: string, inputType = "insertText"): void {
|
||||
const sel = document.getSelection();
|
||||
const { caret, text } = getCaretOffsetAndText(this.editorRef.current, sel);
|
||||
const newText = text.substr(0, caret.offset) + textToInsert + text.substr(caret.offset);
|
||||
const newText = text.slice(0, caret.offset) + textToInsert + text.slice(caret.offset);
|
||||
caret.offset += textToInsert.length;
|
||||
this.modifiedFlag = true;
|
||||
this.props.model.update(newText, inputType, caret);
|
||||
|
|
|
@ -274,7 +274,7 @@ export default class MemberList extends React.Component<IProps, IState> {
|
|||
|
||||
this.sortNames.set(
|
||||
member,
|
||||
(member.name[0] === '@' ? member.name.substr(1) : member.name).replace(SORT_REGEX, ""),
|
||||
(member.name[0] === '@' ? member.name.slice(1) : member.name).replace(SORT_REGEX, ""),
|
||||
);
|
||||
|
||||
// XXX: this user may have no lastPresenceTs value!
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue