Commit bc1b5bf0 authored by Kushal Pandya's avatar Kushal Pandya

Merge branch 'ph/345019/fixMultiNewLineRegex' into 'master'

Fixes multiple new line suggestions not escaping correctly

See merge request gitlab-org/gitlab!74090
parents 96205e5f a6b6a4a5
......@@ -233,7 +233,7 @@ export function insertMarkdownText({
}
} else if (tag.indexOf(textPlaceholder) > -1) {
textToInsert = tag.replace(textPlaceholder, () =>
selected.replace(/\\n/g, '\n').replace('%br', '\\n'),
selected.replace(/\\n/g, '\n').replace(/%br/g, '\\n'),
);
} else {
textToInsert = String(startChar) + tag + selected + (wrap ? tag : '');
......
......@@ -100,11 +100,11 @@ describe('init markdown', () => {
text: textArea.value,
tag: '```suggestion:-0+0\n{text}\n```',
blockTag: true,
selected: '# Does not parse the %br currently.',
selected: '# Does not %br parse the %br currently.',
wrap: false,
});
expect(textArea.value).toContain('# Does not parse the \\n currently.');
expect(textArea.value).toContain('# Does not \\n parse the \\n currently.');
});
it('inserts the tag on the same line if the current line only contains spaces', () => {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment