Skip to content

Commit

Permalink
Merge pull request #3070 from udecode/fix/3069
Browse files Browse the repository at this point in the history
Fix list
  • Loading branch information
zbeyens authored Mar 26, 2024
2 parents 3c4f56e + 7e633f0 commit 0820270
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .changeset/late-cameras-help.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@udecode/plate-list": patch
---

Fixes #3069
Fixes #2397
8 changes: 8 additions & 0 deletions packages/list/src/insertFragmentList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,14 @@ export const insertFragmentList = <V extends Value>(editor: PlateEditor<V>) => {
mode: 'lowest',
});

// Check again if liEntry is undefined after the deletion above.
// This prevents unexpected behavior when pasting while a list is highlighted
if (!liEntry) {
return insertFragment(
isListRoot(editor, fragment[0]) ? [{ text: '' }, ...fragment] : fragment
);
}

const licEntry = findNode<TElement>(editor, {
match: { type: listItemContentType },
mode: 'lowest',
Expand Down

0 comments on commit 0820270

Please sign in to comment.