diff --git a/packages/quill/src/core/editor.ts b/packages/quill/src/core/editor.ts index a19485840d..4b5a22ac8b 100644 --- a/packages/quill/src/core/editor.ts +++ b/packages/quill/src/core/editor.ts @@ -337,20 +337,27 @@ function convertListHTML( } const [{ child, offset, length, indent, type }, ...rest] = items; const [tag, attribute] = getListType(type); + // CLASSNAME FIX + const className = + (child.domNode).className != '' + ? ` class="${(child.domNode).className}"` + : ''; if (indent > lastIndent) { types.push(type); if (indent === lastIndent + 1) { - return `<${tag}>${convertHTML( + // CLASSNAME FIX + return `<${tag}>${convertHTML( child, offset, length, )}${convertListHTML(rest, indent, types)}`; } - return `<${tag}>
  • ${convertListHTML(items, lastIndent + 1, types)}`; + return `<${tag}>${convertListHTML(items, lastIndent + 1, types)}`; } const previousType = types[types.length - 1]; if (indent === lastIndent && type === previousType) { - return `
  • ${convertHTML( + // CLASSNAME FIX + return `${convertHTML( child, offset, length, diff --git a/packages/quill/test/unit/core/editor.spec.ts b/packages/quill/test/unit/core/editor.spec.ts index 0c595332bb..b685415b67 100644 --- a/packages/quill/test/unit/core/editor.spec.ts +++ b/packages/quill/test/unit/core/editor.spec.ts @@ -1287,10 +1287,10 @@ describe('Editor', () => {
  • e
  • Two
      -
    • Alpha +
    • Alpha
        -
      1. I
      2. -
      3. II
      4. +
      5. I
      6. +
      7. II
    @@ -1318,10 +1318,10 @@ describe('Editor', () => {
  • e
  • Two
      -
    • Alpha +
    • Alpha
        -
      • I
      • -
      • II
      • +
      • I
      • +
      • II
    @@ -1343,16 +1343,17 @@ describe('Editor', () => { `, ); + console.log(editor.getHTML(12, 12)); expect(editor.getHTML(12, 12)).toEqualHTML(`
      -
    1. +
      1. -
      2. +
        1. -
        2. II
        3. +
        4. II
      3. -
      4. BBBB
      5. +
      6. BBBB
    2. 2222