diff --git a/src/Umbraco.Web.UI.Client/src/common/filters/truncate.filter.js b/src/Umbraco.Web.UI.Client/src/common/filters/truncate.filter.js index 320b380393..5efe0f5fff 100644 --- a/src/Umbraco.Web.UI.Client/src/common/filters/truncate.filter.js +++ b/src/Umbraco.Web.UI.Client/src/common/filters/truncate.filter.js @@ -1,3 +1,15 @@ +/** + * @ngdoc filter + * @name umbraco.filters.filter:truncate + * @namespace truncateFilter + * + * param {any} wordwise if true, the string will be cut after last fully displayed word. + * param {any} max max length of the outputtet string + * param {any} tail option tail, defaults to: ' ...' + * + * @description + * Limits the length of a string, if a cut happens only the string will be appended with three dots to indicate that more is available. + */ angular.module("umbraco.filters").filter('truncate', function () { return function (value, wordwise, max, tail) { @@ -13,7 +25,7 @@ angular.module("umbraco.filters").filter('truncate', value = value.substr(0, lastspace); } } - return value + (tail || ' …'); + return value + (tail || (wordwise ? ' …' : '…')); }; } );