Commit 0d587553 authored by Natalia Tepluhina's avatar Natalia Tepluhina

Merge branch 'revert-95bc8490' into 'master'

Revert "Merge branch 'ph/333351/fixSuggestionsNewLines' into 'master'"

See merge request gitlab-org/gitlab!68717
parents 5c09e414 75affd91
...@@ -232,7 +232,7 @@ export function insertMarkdownText({ ...@@ -232,7 +232,7 @@ export function insertMarkdownText({
.join('\n'); .join('\n');
} }
} else if (tag.indexOf(textPlaceholder) > -1) { } else if (tag.indexOf(textPlaceholder) > -1) {
textToInsert = tag.replace(textPlaceholder, () => selected); textToInsert = tag.replace(textPlaceholder, () => selected.replace(/\\n/g, '\n'));
} else { } else {
textToInsert = String(startChar) + tag + selected + (wrap ? tag : ''); textToInsert = String(startChar) + tag + selected + (wrap ? tag : '');
} }
......
...@@ -70,25 +70,6 @@ describe('init markdown', () => { ...@@ -70,25 +70,6 @@ describe('init markdown', () => {
expect(textArea.value).toContain('# Does not parse the `$` currently.'); expect(textArea.value).toContain('# Does not parse the `$` currently.');
}); });
it('inserts a new line correctly', () => {
const initialValue = '';
textArea.value = initialValue;
textArea.selectionStart = 0;
textArea.selectionEnd = 0;
insertMarkdownText({
textArea,
text: textArea.value,
tag: '```suggestion:-0+0\n{text}\n```',
blockTag: true,
selected: '# Does not parse the \\n currently.',
wrap: false,
});
expect(textArea.value).toContain('# Does not parse the \\n currently.');
});
it('inserts the tag on a new line if the current one is not empty', () => { it('inserts the tag on a new line if the current one is not empty', () => {
const initialValue = 'some text'; const initialValue = 'some text';
......
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