Skip to content

Commit

Permalink
fix: fail to convert list having blockQuote with spaces to wysiwyg (n…
Browse files Browse the repository at this point in the history
…hn#1792)

* fix: wrong wysiwyg listItem content property

* chore: add convertor test case(block nodes in list)
  • Loading branch information
js87zz committed Sep 7, 2021
1 parent a47c4d5 commit 4e8563a
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 4 deletions.
23 changes: 23 additions & 0 deletions src/__test__/unit/convertor.spec.ts
Expand Up @@ -316,6 +316,29 @@ describe('Convertor', () => {
assertConverting(markdown, expected);
});

it('block nodes in list', () => {
const markdown = source`
1. foo
\`\`\`
bar
\`\`\`
> bam
`;
const expected = source`
1. foo
\`\`\`
bar
\`\`\`
> bam
`;

assertConverting(markdown, expected);
});

it('soft break', () => {
const markdown = source`
foo
Expand Down
2 changes: 1 addition & 1 deletion src/wysiwyg/nodes/bulletList.ts
Expand Up @@ -19,7 +19,7 @@ export class BulletList extends NodeSchema {
get schema() {
return {
content: 'listItem+',
group: 'block listGroup',
group: 'block',
attrs: {
rawHTML: { default: null },
...getDefaultCustomAttrs(),
Expand Down
3 changes: 2 additions & 1 deletion src/wysiwyg/nodes/listItem.ts
Expand Up @@ -11,7 +11,8 @@ export class ListItem extends NodeSchema {

get schema() {
return {
content: 'paragraph listGroup*',
content: 'paragraph block*',
selectable: false,
attrs: {
task: { default: false },
checked: { default: false },
Expand Down
2 changes: 1 addition & 1 deletion src/wysiwyg/nodes/orderedList.ts
Expand Up @@ -15,7 +15,7 @@ export class OrderedList extends NodeSchema {
get schema() {
return {
content: 'listItem+',
group: 'block listGroup',
group: 'block',
attrs: {
order: { default: 1 },
rawHTML: { default: null },
Expand Down
2 changes: 1 addition & 1 deletion src/wysiwyg/nodes/paragraph.ts
Expand Up @@ -11,7 +11,7 @@ export class Paragraph extends NodeSchema {
get schema() {
return {
content: 'inline*',
group: 'block listGroup',
group: 'block',
attrs: {
...getDefaultCustomAttrs(),
},
Expand Down

0 comments on commit 4e8563a

Please sign in to comment.