[skip CI] line breaks in demo
This commit is contained in:
@@ -59,7 +59,16 @@
|
|||||||
clearTimeout(timeout);
|
clearTimeout(timeout);
|
||||||
timeout = setTimeout(() => {
|
timeout = setTimeout(() => {
|
||||||
try{
|
try{
|
||||||
|
const findLineBreaks = (data) => {
|
||||||
|
Object.keys(data).forEach(key => {
|
||||||
|
if(typeof data[key] === 'object')
|
||||||
|
findLineBreaks(data[key]);
|
||||||
|
else if(typeof data[key] === 'string')
|
||||||
|
data[key] = data[key].replace(/\\n/gm,'\n');
|
||||||
|
});
|
||||||
|
};
|
||||||
let data = YAML.parse($('#input').val());
|
let data = YAML.parse($('#input').val());
|
||||||
|
findLineBreaks(data);
|
||||||
$('#right').html(faDiagrams.compute(data));
|
$('#right').html(faDiagrams.compute(data));
|
||||||
}catch(err){
|
}catch(err){
|
||||||
$('#right').html(`<h2>${err.toString().replace(/\n/gm, '<br>')}</h2>`);
|
$('#right').html(`<h2>${err.toString().replace(/\n/gm, '<br>')}</h2>`);
|
||||||
|
|||||||
Reference in New Issue
Block a user