diff --git a/src/cards/ha-persistent_notification-card.html b/src/cards/ha-persistent_notification-card.html index 964c43ad21..7f603df40d 100644 --- a/src/cards/ha-persistent_notification-card.html +++ b/src/cards/ha-persistent_notification-card.html @@ -18,8 +18,8 @@ } - -
[[stateObj.state]]
+ +
DISMISS
@@ -37,12 +37,51 @@ Polymer({ stateObj: { type: Object, }, + + scriptLoaded: { + type: Boolean, + value: false, + }, }, + observers: [ + 'computeContent(stateObj, scriptLoaded)', + ], + computeTitle: function (stateObj) { return stateObj.attributes.title || stateObj.entityDisplay; }, + loadScript: function () { + var success = function () { + this.scriptLoaded = true; + }.bind(this); + + var error = function () { + console.error('Micromarkdown was not loaded.'); + }; + + this.importHref( + '/static/micromarkdown-js.html', + success, error + ); + }, + + computeContent: function (stateObj, scriptLoaded) { + var el = ''; + var message = ''; + if (scriptLoaded) { + el = this.$.pnContent; + message = micromarkdown.parse(stateObj.state); + el.innerHTML = message; + } + return; + }, + + ready: function () { + this.loadScript(); + }, + dismissTap: function (ev) { ev.preventDefault();