Fix wrong indentation with nested ordered list unnesting list on edit (#7300)

This commit is contained in:
Renan Cleyson 2021-12-07 06:46:04 -03:00 committed by GitHub
parent 2e4fe7891a
commit b4b81a455e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 1 deletions

View file

@ -129,7 +129,9 @@ function parseElement(n: HTMLElement, partCreator: PartCreator, lastNode: HTMLEl
case "U":
return partCreator.plain(`<u>${n.textContent}</u>`);
case "LI": {
const indent = " ".repeat(state.listDepth - 1);
const BASE_INDENT = 4;
const depth = state.listDepth - 1;
const indent = " ".repeat(BASE_INDENT * depth);
if (n.parentElement.nodeName === "OL") {
// The markdown parser doesn't do nested indexed lists at all, but this supports it anyway.
const index = state.listIndex[state.listIndex.length - 1];