From 692175f5b04648602314ec0a87ecc115c57200f1 Mon Sep 17 00:00:00 2001 From: ed Date: Sat, 1 Jun 2024 20:56:15 +0000 Subject: [PATCH] md-editor autoindent was duplicating hr markers only keep characters `>+-*` if there's less than three of them, and discard entire prefix if there's more markdown spec only cares about exactly-one or three-or-more, but let's keep pairs in case anyone use that as unconventional markup --- copyparty/web/md2.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/copyparty/web/md2.js b/copyparty/web/md2.js index e54af570..c59fa056 100644 --- a/copyparty/web/md2.js +++ b/copyparty/web/md2.js @@ -607,10 +607,10 @@ function md_newline() { var s = linebounds(true), ln = s.md.substring(s.n1, s.n2), m1 = /^( *)([0-9]+)(\. +)/.exec(ln), - m2 = /^[ \t>+-]*(\* )?/.exec(ln), + m2 = /^[ \t]*[>+*-]{0,2}[ \t]/.exec(ln), drop = dom_src.selectionEnd - dom_src.selectionStart; - var pre = m2[0]; + var pre = m2 ? m2[0] : ''; if (m1 !== null) pre = m1[1] + (parseInt(m1[2]) + 1) + m1[3];