Commit 14678733 authored by Phil Hughes's avatar Phil Hughes

Fixes some characters being changed incorrectly in suggestions

This fixes some forward slashes being changed incorrectly in
suggestions.
parent fff7ebeb
......@@ -233,7 +233,7 @@ export function insertMarkdownText({
}
} else if (tag.indexOf(textPlaceholder) > -1) {
textToInsert = tag.replace(textPlaceholder, () =>
selected.replace(/\\n/g, '\n').replace(/\/(n|t|r)/g, '\\$1'),
selected.replace(/\\n/g, '\n').replace('%br', '\\n'),
);
} else {
textToInsert = String(startChar) + tag + selected + (wrap ? tag : '');
......
......@@ -16,11 +16,7 @@ import MarkdownHeader from './header.vue';
import MarkdownToolbar from './toolbar.vue';
function cleanUpLine(content) {
return unescape(
stripHtml(content)
.replace(/\\(n|t|r)/g, '/$1')
.replace(/\n/g, ''),
);
return unescape(stripHtml(content).replace(/\\n/g, '%br').replace(/\n/g, ''));
}
export default {
......
......@@ -100,7 +100,7 @@ describe('init markdown', () => {
text: textArea.value,
tag: '```suggestion:-0+0\n{text}\n```',
blockTag: true,
selected: '# Does not parse the /n currently.',
selected: '# Does not parse the %br currently.',
wrap: false,
});
......
......@@ -250,7 +250,7 @@ describe('Markdown field component', () => {
createSubject([{ rich_text: 'hello world\\n' }]);
expect(subject.find('[data-testid="markdownHeader"]').props('lineContent')).toBe(
'hello world/n',
'hello world%br',
);
});
});
......
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