Skip to content

Commit

Permalink
Replace substr with substring (#7188)
Browse files Browse the repository at this point in the history
  • Loading branch information
ivailop7 authored Feb 18, 2025
1 parent 7f4450f commit 4656ac1
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/lexical-playground/src/commenting/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ function createUID(): string {
return Math.random()
.toString(36)
.replace(/[^a-z]+/g, '')
.substr(0, 5);
.substring(0, 5);
}

export function createComment(
Expand Down
2 changes: 1 addition & 1 deletion packages/lexical-playground/src/nodes/PollNode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function createUID(): string {
return Math.random()
.toString(36)
.replace(/[^a-z]+/g, '')
.substr(0, 5);
.substring(0, 5);
}

export function createPollOption(text = ''): Option {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ type SearchPromise = {
export const uuid = Math.random()
.toString(36)
.replace(/[^a-z]+/g, '')
.substr(0, 5);
.substring(0, 5);

// TODO lookup should be custom
function $search(selection: null | BaseSelection): [boolean, string] {
Expand Down
2 changes: 1 addition & 1 deletion packages/lexical-react/src/shared/LexicalMenu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ function getFullMatchOffset(
): number {
let triggerOffset = offset;
for (let i = triggerOffset; i <= entryText.length; i++) {
if (documentText.substr(-i) === entryText.substr(0, i)) {
if (documentText.slice(-i) === entryText.substring(0, i)) {
triggerOffset = i;
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/lexical/src/LexicalUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -649,7 +649,7 @@ export function createUID(): string {
return Math.random()
.toString(36)
.replace(/[^a-z]+/g, '')
.substr(0, 5);
.substring(0, 5);
}

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

0 comments on commit 4656ac1

Please sign in to comment.