I am using sweet-alert plugin to display an alert. With a classical config (defaults), everything goes OK. But when I want to add a HTML tag into the TEXT, it display
I just applied the patch above and it starts working.
diff --git a/sweet-alert.js b/sweet-alert.js
index ab6e1f1..d7eafaa 100755
--- a/sweet-alert.js
+++ b/sweet-alert.js
@@ -200,7 +200,8 @@
confirmButtonColor: '#AEDEF4',
cancelButtonText: 'Cancel',
imageUrl: null,
- imageSize: null
+ imageSize: null,
+ html: false
};
if (arguments[0] === undefined) {
@@ -224,6 +225,7 @@
return false;
}
+ params.html = arguments[0].html;
params.title = arguments[0].title;
params.text = arguments[0].text || params.text;
params.type = arguments[0].type || params.type;
@@ -477,11 +479,18 @@
$cancelBtn = modal.querySelector('button.cancel'),
$confirmBtn = modal.querySelector('button.confirm');
+ console.log(params.html);
// Title
- $title.innerHTML = escapeHtml(params.title).split("\n").join("
");
+ if(params.html)
+ $title.innerHTML = params.title.split("\n").join("
");
+ else
+ $title.innerHTML = escapeHtml(params.title).split("\n").join("
");
// Text
- $text.innerHTML = escapeHtml(params.text || '').split("\n").join("
");
+ if(params.html)
+ $text.innerHTML = params.text.split("\n").join("
");
+ else
+ $text.innerHTML = escapeHtml(params.text || '').split("\n").join("
");
if (params.text) {
show($text);
}