diff --git a/packages/svelte-lexical/src/lib/components/toolbar/BlockFormatDropDown/BulletDropDrownItem.svelte b/packages/svelte-lexical/src/lib/components/toolbar/BlockFormatDropDown/BulletDropDrownItem.svelte index 4f02b0e..2ae8b30 100644 --- a/packages/svelte-lexical/src/lib/components/toolbar/BlockFormatDropDown/BulletDropDrownItem.svelte +++ b/packages/svelte-lexical/src/lib/components/toolbar/BlockFormatDropDown/BulletDropDrownItem.svelte @@ -1,13 +1,11 @@ diff --git a/packages/svelte-lexical/src/lib/components/toolbar/BlockFormatDropDown/CheckDropDrownItem.svelte b/packages/svelte-lexical/src/lib/components/toolbar/BlockFormatDropDown/CheckDropDrownItem.svelte index cb96b78..904cd2e 100644 --- a/packages/svelte-lexical/src/lib/components/toolbar/BlockFormatDropDown/CheckDropDrownItem.svelte +++ b/packages/svelte-lexical/src/lib/components/toolbar/BlockFormatDropDown/CheckDropDrownItem.svelte @@ -1,10 +1,11 @@ diff --git a/packages/svelte-lexical/src/lib/components/toolbar/BlockFormatDropDown/NumberDropDrownItem.svelte b/packages/svelte-lexical/src/lib/components/toolbar/BlockFormatDropDown/NumberDropDrownItem.svelte index 1ccec2d..1b672de 100644 --- a/packages/svelte-lexical/src/lib/components/toolbar/BlockFormatDropDown/NumberDropDrownItem.svelte +++ b/packages/svelte-lexical/src/lib/components/toolbar/BlockFormatDropDown/NumberDropDrownItem.svelte @@ -1,13 +1,11 @@ diff --git a/packages/svelte-lexical/src/lib/components/toolbar/BlockFormatDropDown/formatParagraph.ts b/packages/svelte-lexical/src/lib/components/toolbar/BlockFormatDropDown/formatParagraph.ts new file mode 100644 index 0000000..651d74b --- /dev/null +++ b/packages/svelte-lexical/src/lib/components/toolbar/BlockFormatDropDown/formatParagraph.ts @@ -0,0 +1,9 @@ +import {$setBlocksType} from '@lexical/selection'; +import {$createParagraphNode, $getSelection, type LexicalEditor} from 'lexical'; + +export function formatParagraph(editor: LexicalEditor) { + editor.update(() => { + const selection = $getSelection(); + $setBlocksType(selection, () => $createParagraphNode()); + }); +}