mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-13 04:19:44 +02:00
added hasBreaks and splitBreaks to common.js
updated parseMessage to set wrap: true when breaks are detected
This commit is contained in:
@@ -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
|
||||
};
|
||||
|
Reference in New Issue
Block a user