Skip to content

Commit

Permalink
bugfix: Empty list item deserialization error
Browse files Browse the repository at this point in the history
  • Loading branch information
FranciscoMoretti committed Jan 20, 2024
1 parent 53f240b commit 62d323f
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -397,4 +397,29 @@ describe('deserializeMdIndentList', () => {

expect(deserializeMd(editor, input)).toEqual(output);
});

it('should deserialize an empty list item', () => {
const input = '* Line 1\n*';

const output = [
{
type: 'p',
listStyleType: 'disc',
indent: 1,
children: [
{
text: 'Line 1',
},
],
},
{
type: 'p',
listStyleType: 'disc',
indent: 1,
children: [],
},
];

expect(deserializeMd(editor, input)).toEqual(output);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,10 @@ export const remarkDefaultElementRules: RemarkElementRules<Value> = {
type: getPluginType(options.editor, ELEMENT_PARAGRAPH),
listStyleType,
indent,
children: remarkTransformElementChildren(paragraph, options),
children: remarkTransformElementChildren(
paragraph || '',
options
),
});

subLists.forEach((subList) => {
Expand Down

0 comments on commit 62d323f

Please sign in to comment.