From 64ac4a3930a3ecbfd66b8874e7474a407efe515a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn?= Date: Tue, 16 Jun 2015 17:09:11 +0200 Subject: [PATCH] Feature #3748: New handlebar helper htmlDecode --- .../public/app/templates/helpers/htmlDecode.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 src/sunstone/public/app/templates/helpers/htmlDecode.js diff --git a/src/sunstone/public/app/templates/helpers/htmlDecode.js b/src/sunstone/public/app/templates/helpers/htmlDecode.js new file mode 100644 index 0000000000..b69a2f1836 --- /dev/null +++ b/src/sunstone/public/app/templates/helpers/htmlDecode.js @@ -0,0 +1,18 @@ +define(function(require) { + /** + * Decodes an escaped html string back to html. For example, + * "<p>This is a test</p>" --> + * "

This is a test

" + */ + + var Handlebars = require('hbs/handlebars'); + var TemplateUtils = require('utils/template-utils'); + + var htmlDecode = function(value, options) { + return TemplateUtils.htmlDecode(value); + }; + + Handlebars.registerHelper('htmlDecode', htmlDecode); + + return htmlDecode; +}); \ No newline at end of file