diff --git a/modules/cms-kit/src/Volo.CmsKit.Common.Web/CmsKitCommonWebModule.cs b/modules/cms-kit/src/Volo.CmsKit.Common.Web/CmsKitCommonWebModule.cs index c80ab584dd..e8a30a75bc 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Common.Web/CmsKitCommonWebModule.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Common.Web/CmsKitCommonWebModule.cs @@ -5,6 +5,8 @@ using Volo.Abp.Modularity; using Volo.Abp.VirtualFileSystem; using Volo.CmsKit.Reactions; using Volo.CmsKit.Web.Icons; +using Markdig; +using Microsoft.Extensions.DependencyInjection; namespace Volo.CmsKit.Web; @@ -32,6 +34,14 @@ public class CmsKitCommonWebModule : AbpModule options.ReactionIcons[StandardReactions.Victory] = new LocalizableIconDictionary("fas fa-hand-peace text-warning"); options.ReactionIcons[StandardReactions.Rock] = new LocalizableIconDictionary("fas fa-hand-rock text-warning"); }); + + context.Services + .AddSingleton(_ => new MarkdownPipelineBuilder() + .UseAutoLinks() + .UseBootstrap() + .UseGridTables() + .UsePipeTables() + .Build()); Configure(options => { diff --git a/modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Components/Contents/ContentParser.cs b/modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Components/Contents/ContentParser.cs index 42ae745c19..1baf9c559a 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Components/Contents/ContentParser.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Components/Contents/ContentParser.cs @@ -78,7 +78,7 @@ public class ContentParser : ITransientDependency { content = Regex.Replace(content, @"=\s*""", @"="""); content = Regex.Replace(content, @"""\s*=", @"""="); - var widgets = Regex.Matches(content, @"(?<=\[Widget)(.*?)(?=\])").Cast().Select(p => p.Value).ToList(); + var widgets = Regex.Matches(content, @"(?<=\[Widget)(.*?)(?=\])").Select(p => p.Value).ToList(); for (int i = 0, k = 0; i < parsedList.Count; i++) { if (parsedList[i] == Delimeter) @@ -86,9 +86,9 @@ public class ContentParser : ITransientDependency if (widgets.Count > k) { var preparedContent = string.Join("", widgets[k]); - var keys = Regex.Matches(preparedContent, @"(?<=\s)(.*?)(?==\s*"")").Cast() + var keys = Regex.Matches(preparedContent, @"(?<=\s)(.*?)(?==\s*"")") .Select(p => p.Value).Where(p => p != string.Empty).ToList(); - var values = Regex.Matches(preparedContent, @"(?<=\s*[a-zA-Z]*=\s*"")(.*?)(?="")").Cast() + var values = Regex.Matches(preparedContent, @"(?<=\s*[a-zA-Z]*=\s*"")(.*?)(?="")") .Select(p => p.Value).ToList(); var widgetTypeIndex = keys.IndexOf("Type"); @@ -98,7 +98,7 @@ public class ContentParser : ITransientDependency var name = _options.WidgetConfigs.Where(p => p.Key == widgetType).Select(p => p.Value.Name).FirstOrDefault(); if (name is not null && widgets.Count > k) { - values[0] = name; + values[widgetTypeIndex] = name; var contentFragment = new ContentFragment() { Type = Widget }; contentFragments.Add(contentFragment); for (int kv = 0; kv < values.Count; kv++) diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Web/CmsKitPublicWebModule.cs b/modules/cms-kit/src/Volo.CmsKit.Public.Web/CmsKitPublicWebModule.cs index 4121999f91..36308b1839 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Web/CmsKitPublicWebModule.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Web/CmsKitPublicWebModule.cs @@ -1,5 +1,4 @@ -using Markdig; -using Microsoft.AspNetCore.Mvc.RazorPages; +using Microsoft.AspNetCore.Mvc.RazorPages; using Microsoft.Extensions.DependencyInjection; using Volo.Abp; using Volo.Abp.AspNetCore.Mvc.Localization; @@ -65,14 +64,6 @@ public class CmsKitPublicWebModule : AbpModule options.AddMaps(validate: true); }); - context.Services - .AddSingleton(_ => new MarkdownPipelineBuilder() - .UseAutoLinks() - .UseBootstrap() - .UseGridTables() - .UsePipeTables() - .Build()); - Configure(options => { options.DisableModule(CmsKitPublicRemoteServiceConsts.ModuleName);