diff --git a/packages/lexical-link/src/__tests__/unit/LexicalLinkNode.test.ts b/packages/lexical-link/src/__tests__/unit/LexicalLinkNode.test.ts index 82f21650a81..3ad6cbad8b8 100644 --- a/packages/lexical-link/src/__tests__/unit/LexicalLinkNode.test.ts +++ b/packages/lexical-link/src/__tests__/unit/LexicalLinkNode.test.ts @@ -9,9 +9,9 @@ import { $createLinkNode, $isLinkNode, + $toggleLink, LinkNode, SerializedLinkNode, - toggleLink, } from '@lexical/link'; import { $getRoot, @@ -391,7 +391,7 @@ describe('LexicalLinkNode tests', () => { }); }); - test('toggleLink applies the title attribute when creating', async () => { + test('$toggleLink applies the title attribute when creating', async () => { const {editor} = testEnv; await editor.update(() => { const p = new ParagraphNode(); @@ -401,7 +401,7 @@ describe('LexicalLinkNode tests', () => { await editor.update(() => { $selectAll(); - toggleLink('https://lexical.dev/', {title: 'Lexical Website'}); + $toggleLink('https://lexical.dev/', {title: 'Lexical Website'}); }); const paragraph = editor!.getEditorState().toJSON().root diff --git a/packages/lexical-react/src/LexicalLinkPlugin.ts b/packages/lexical-react/src/LexicalLinkPlugin.ts index 875ca8e04fc..e5f5b0afdc1 100644 --- a/packages/lexical-react/src/LexicalLinkPlugin.ts +++ b/packages/lexical-react/src/LexicalLinkPlugin.ts @@ -6,7 +6,7 @@ * */ -import {LinkNode, TOGGLE_LINK_COMMAND, toggleLink} from '@lexical/link'; +import {$toggleLink, LinkNode, TOGGLE_LINK_COMMAND} from '@lexical/link'; import {useLexicalComposerContext} from '@lexical/react/LexicalComposerContext'; import {mergeRegister, objectKlassEquals} from '@lexical/utils'; import { @@ -34,17 +34,17 @@ export function LinkPlugin({validateUrl}: Props): null { TOGGLE_LINK_COMMAND, (payload) => { if (payload === null) { - toggleLink(payload); + $toggleLink(payload); return true; } else if (typeof payload === 'string') { if (validateUrl === undefined || validateUrl(payload)) { - toggleLink(payload); + $toggleLink(payload); return true; } return false; } else { const {url, target, rel, title} = payload; - toggleLink(url, {rel, target, title}); + $toggleLink(url, {rel, target, title}); return true; } }, diff --git a/packages/lexical-website/docs/react/plugins.md b/packages/lexical-website/docs/react/plugins.md index 6bc8c451419..46090ef15a5 100644 --- a/packages/lexical-website/docs/react/plugins.md +++ b/packages/lexical-website/docs/react/plugins.md @@ -85,7 +85,7 @@ React wrapper for `@lexical/history` that adds support for history stack managem ### `LexicalLinkPlugin` -React wrapper for `@lexical/link` that adds support for links, including `toggleLink` command support that toggles link for selected text +React wrapper for `@lexical/link` that adds support for links, including `$toggleLink` command support that toggles link for selected text ```jsx