Compare commits

...

8 Commits

Author SHA1 Message Date
Benedek Farkas
bf32b70740 Fixing auto-merge 2024-04-19 11:48:55 +02:00
Benedek Farkas
cc7d224a66 Merge branch 'dev' into issue/6193/htmlfilter 2024-04-19 11:45:32 +02:00
Benedek Farkas
d95f81259e Code styling 2024-04-09 14:58:00 +02:00
Benedek Farkas
a751764b27 Fixing FeedControllerTests.CorePartValuesAreExtracted 2024-04-09 12:22:54 +02:00
Benedek Farkas
1f571866ff Merge branch 'dev' into issue/6193/htmlfilter 2024-04-09 11:33:52 +02:00
Benedek Farkas
84266ca34a Applying IHtmlFilterProcessor to HtmlMenuItems too + code styling in BodyPartDriver 2024-04-09 11:32:11 +02:00
Benedek Farkas
14d84f6db3 Renaming IHtmlFilterRunner to IHtmlFilterProcessor (and its references) 2024-04-09 11:05:45 +02:00
Sipke Schoorstra
34af2365cf IHtmlFilter and TokenFilter improvements and bugfixes.
This changeset unifies the two separate TokenFilter implementations (one for BodyPart, TextField, etc and another one for certain elements such as Html).
It also fixes a bug with the TokenFilter when executing for HtmlWidget, where the wrong content item is being recorded by the handler (the original implementation).
Thirdly, it removes awkward code repetition by moving filter execution into a dedicated HtmlFilterRunner service.
2016-05-31 22:12:15 +02:00

View File

@@ -1,6 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Orchard.ContentManagement;
using Orchard.ContentManagement.Drivers;
@@ -74,12 +72,12 @@ namespace Orchard.Core.Common.Drivers {
if (settings.MaxLength > 0) {
var value = new HtmlString(_htmlFilters.Aggregate(field.Value, (text, filter) => filter.ProcessContent(text, settings.Flavor)))
var value = new HtmlString(_htmlFilterProcessor.ProcessFilters(field.Value, settings.Flavor, part))
.ToString().RemoveTags();
if (value.Length > settings.MaxLength) {
updater.AddModelError("Text", T("The maximum allowed length for the field {0} is {1}", T(field.DisplayName), settings.MaxLength));
}
}
}
}