Skip to content

Commit

Permalink
🐛 #588 列表中有 inline code 时换行无 marker
Browse files Browse the repository at this point in the history
  • Loading branch information
Vanessa219 committed Jul 17, 2020
1 parent 292f0d6 commit 30dfa82
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/ts/sv/process.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,16 @@ export const processSpinVditorSVDOM = (html: string, vditor: IVditor) => {
export const processPreviousMarkers = (textElement: HTMLElement) => {
let previousElement = textElement.previousElementSibling;
let markerText = "";
while (previousElement && (previousElement.getAttribute("data-type") === "li-marker" ||
previousElement.getAttribute("data-type") === "blockquote-marker" ||
previousElement.getAttribute("data-type") === "task-marker" ||
previousElement.getAttribute("data-type") === "padding")) {
markerText = previousElement.textContent + markerText;
let hasNL = false;
while (previousElement && !hasNL) {
if (previousElement.getAttribute("data-type") === "li-marker" ||
previousElement.getAttribute("data-type") === "blockquote-marker" ||
previousElement.getAttribute("data-type") === "task-marker" ||
previousElement.getAttribute("data-type") === "padding") {
markerText = previousElement.textContent + markerText;
} else if (previousElement.getAttribute("data-type") === "newline") {
hasNL = true;
}
previousElement = previousElement.previousElementSibling;
}
return markerText;
Expand Down

0 comments on commit 30dfa82

Please sign in to comment.