fix extra markup surrounding empty lines in textile toolbar

This commit is contained in:
byte[] 2021-02-25 15:03:39 -05:00
parent 58d8d24812
commit fad734b50c

View file

@ -90,12 +90,7 @@ function wrapSelection(textarea, options) {
scrollTop = textarea.scrollTop, scrollTop = textarea.scrollTop,
emptyText = text === ''; emptyText = text === '';
let newText = text; const newText = text;
if (!emptyText && prefix[0] !== '[') {
newText = text.replace(/(\n{2,})/g, match => {
return suffix + match + prefix;
});
}
if (type === 'inline' && newText.includes('\n')) { if (type === 'inline' && newText.includes('\n')) {
textarea.value = `${beforeSelection}[${prefix}${newText}${suffix}]${afterSelection}`; textarea.value = `${beforeSelection}[${prefix}${newText}${suffix}]${afterSelection}`;