diff --git a/packages/lexical-playground/src/commenting/index.ts b/packages/lexical-playground/src/commenting/index.ts index 59aa95baec0..c37469ba5e8 100644 --- a/packages/lexical-playground/src/commenting/index.ts +++ b/packages/lexical-playground/src/commenting/index.ts @@ -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( diff --git a/packages/lexical-playground/src/nodes/PollNode.tsx b/packages/lexical-playground/src/nodes/PollNode.tsx index f4f57f47cda..e6d25ce268d 100644 --- a/packages/lexical-playground/src/nodes/PollNode.tsx +++ b/packages/lexical-playground/src/nodes/PollNode.tsx @@ -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 { diff --git a/packages/lexical-playground/src/plugins/AutocompletePlugin/index.tsx b/packages/lexical-playground/src/plugins/AutocompletePlugin/index.tsx index 6a3da055337..c2f94339fbb 100644 --- a/packages/lexical-playground/src/plugins/AutocompletePlugin/index.tsx +++ b/packages/lexical-playground/src/plugins/AutocompletePlugin/index.tsx @@ -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] { diff --git a/packages/lexical-react/src/shared/LexicalMenu.ts b/packages/lexical-react/src/shared/LexicalMenu.ts index 39caca2816d..05fc084eb00 100644 --- a/packages/lexical-react/src/shared/LexicalMenu.ts +++ b/packages/lexical-react/src/shared/LexicalMenu.ts @@ -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; } } diff --git a/packages/lexical/src/LexicalUtils.ts b/packages/lexical/src/LexicalUtils.ts index 695d45d05c2..d61cb0587e7 100644 --- a/packages/lexical/src/LexicalUtils.ts +++ b/packages/lexical/src/LexicalUtils.ts @@ -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 {