From 67e109c0e62ac063b14bc6c380515caa939a20d8 Mon Sep 17 00:00:00 2001 From: AndyButland Date: Fri, 23 Jun 2017 11:40:43 +0200 Subject: [PATCH] Preserved line breaks in property descriptions when rendering in content area --- .../common/filters/preserveNewLineInHtml.filter.js | 12 ++++++++++++ .../src/views/components/property/umb-property.html | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 src/Umbraco.Web.UI.Client/src/common/filters/preserveNewLineInHtml.filter.js diff --git a/src/Umbraco.Web.UI.Client/src/common/filters/preserveNewLineInHtml.filter.js b/src/Umbraco.Web.UI.Client/src/common/filters/preserveNewLineInHtml.filter.js new file mode 100644 index 0000000000..4a22830431 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/common/filters/preserveNewLineInHtml.filter.js @@ -0,0 +1,12 @@ +/** +* @ngdoc filter +* @name umbraco.filters.preserveNewLineInHtml +* @description +* Used when rendering a string as HTML (i.e. with ng-bind-html) to convert line-breaks to
tags +**/ +angular.module("umbraco.filters").filter('preserveNewLineInHtml', function () { + return function (text) { + return text.replace(/\n/g, '
'); + } +}); + \ No newline at end of file diff --git a/src/Umbraco.Web.UI.Client/src/views/components/property/umb-property.html b/src/Umbraco.Web.UI.Client/src/views/components/property/umb-property.html index b24e0985af..24bc1de6ed 100644 --- a/src/Umbraco.Web.UI.Client/src/views/components/property/umb-property.html +++ b/src/Umbraco.Web.UI.Client/src/views/components/property/umb-property.html @@ -11,7 +11,7 @@ * - +