added hasBreaks and splitBreaks to common.js

updated parseMessage to set wrap: true when breaks are detected
This commit is contained in:
chris moran
2020-07-01 07:41:18 -04:00
parent 2ffb2988bf
commit ca86ab71f2
4 changed files with 21 additions and 7 deletions

View File

@@ -27,6 +27,14 @@ export const sanitizeText = (text, config) => {
export const lineBreakRegex = /<br\s*\/?>/gi;
export const hasBreaks = text => {
return /<br\s*[/]?>/gi.test(text);
};
export const splitBreaks = text => {
return text.split(/<br\s*[/]?>/gi);
};
const breakToPlaceholder = s => {
return s.replace(lineBreakRegex, '#br#');
};
@@ -38,5 +46,7 @@ const placeholderToBreak = s => {
export default {
getRows,
sanitizeText,
hasBreaks,
splitBreaks,
lineBreakRegex
};