Skip to content

Commit 4656ac1

Browse files
authored
Replace substr with substring (#7188)
1 parent 7f4450f commit 4656ac1

File tree

5 files changed

+5
-5
lines changed

5 files changed

+5
-5
lines changed

packages/lexical-playground/src/commenting/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ function createUID(): string {
4141
return Math.random()
4242
.toString(36)
4343
.replace(/[^a-z]+/g, '')
44-
.substr(0, 5);
44+
.substring(0, 5);
4545
}
4646

4747
export function createComment(

packages/lexical-playground/src/nodes/PollNode.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ function createUID(): string {
3535
return Math.random()
3636
.toString(36)
3737
.replace(/[^a-z]+/g, '')
38-
.substr(0, 5);
38+
.substring(0, 5);
3939
}
4040

4141
export function createPollOption(text = ''): Option {

packages/lexical-playground/src/plugins/AutocompletePlugin/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ type SearchPromise = {
5151
export const uuid = Math.random()
5252
.toString(36)
5353
.replace(/[^a-z]+/g, '')
54-
.substr(0, 5);
54+
.substring(0, 5);
5555

5656
// TODO lookup should be custom
5757
function $search(selection: null | BaseSelection): [boolean, string] {

packages/lexical-react/src/shared/LexicalMenu.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ function getFullMatchOffset(
111111
): number {
112112
let triggerOffset = offset;
113113
for (let i = triggerOffset; i <= entryText.length; i++) {
114-
if (documentText.substr(-i) === entryText.substr(0, i)) {
114+
if (documentText.slice(-i) === entryText.substring(0, i)) {
115115
triggerOffset = i;
116116
}
117117
}

packages/lexical/src/LexicalUtils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -649,7 +649,7 @@ export function createUID(): string {
649649
return Math.random()
650650
.toString(36)
651651
.replace(/[^a-z]+/g, '')
652-
.substr(0, 5);
652+
.substring(0, 5);
653653
}
654654

655655
export function getAnchorTextFromDOM(anchorNode: Node): null | string {

0 commit comments

Comments
 (0)