Fix trailing backslash on lists in Classic editor

Previously, when editing a post with an unordered list in it via the
Classic editor, backslashes (\) would get added to the end of each list
item. This fixes that.

Closes #480
pull/484/head
Matt Baer 3 years ago
parent e983c4527f
commit de5e91cb71
  1. 8
      prose/prose.js

@ -40,13 +40,7 @@ class ProseMirrorView {
$title.value = title; $title.value = title;
} }
const doc = writeFreelyMarkdownParser.parse( const doc = writeFreelyMarkdownParser.parse(content)
// Replace all "solo" \n's with \\\n for correct markdown parsing
// Can't use lookahead or lookbehind because it's not supported on Safari
content.replace(/([^]{0,1})(\n)([^]{0,1})/g, (match, p1, p2, p3) => {
return p1 !== "\n" && p3 !== "\n" ? p1 + "\\\n" + p3 : match;
})
);
this.view = new EditorView(target, { this.view = new EditorView(target, {
state: EditorState.create({ state: EditorState.create({

Loading…
Cancel
Save