diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/CmsKitWebUnifiedModule.cs b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/CmsKitWebUnifiedModule.cs index 4a07c92ca8..e3094a7da8 100644 --- a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/CmsKitWebUnifiedModule.cs +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/CmsKitWebUnifiedModule.cs @@ -1,11 +1,7 @@ using System.IO; -using System.Linq; using Microsoft.AspNetCore.Builder; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; -using Volo.CmsKit.EntityFrameworkCore; -using Volo.CmsKit.MultiTenancy; -using Volo.CmsKit.Web; using Microsoft.OpenApi.Models; using Volo.Abp; using Volo.Abp.Account; @@ -19,8 +15,8 @@ using Volo.Abp.BlobStoring.Database.EntityFrameworkCore; using Volo.Abp.Data; using Volo.Abp.EntityFrameworkCore; using Volo.Abp.EntityFrameworkCore.SqlServer; -using Volo.Abp.FeatureManagement.EntityFrameworkCore; using Volo.Abp.FeatureManagement; +using Volo.Abp.FeatureManagement.EntityFrameworkCore; using Volo.Abp.Identity; using Volo.Abp.Identity.EntityFrameworkCore; using Volo.Abp.Identity.Web; @@ -29,6 +25,7 @@ using Volo.Abp.Modularity; using Volo.Abp.MultiTenancy; using Volo.Abp.PermissionManagement; using Volo.Abp.PermissionManagement.EntityFrameworkCore; +using Volo.Abp.PermissionManagement.HttpApi; using Volo.Abp.PermissionManagement.Identity; using Volo.Abp.SettingManagement.EntityFrameworkCore; using Volo.Abp.Swashbuckle; @@ -38,15 +35,16 @@ using Volo.Abp.TenantManagement.Web; using Volo.Abp.Threading; using Volo.Abp.VirtualFileSystem; using Volo.CmsKit.Admin.Web; -using Volo.CmsKit.Public.Web; -using System; -using Volo.Abp.PermissionManagement.HttpApi; -using Volo.CmsKit.Tags; using Volo.CmsKit.Comments; +using Volo.CmsKit.Contents; +using Volo.CmsKit.EntityFrameworkCore; using Volo.CmsKit.MediaDescriptors; -using Volo.CmsKit.Reactions; +using Volo.CmsKit.MultiTenancy; +using Volo.CmsKit.Public.Web; using Volo.CmsKit.Ratings; -using Volo.CmsKit.Contents; +using Volo.CmsKit.Reactions; +using Volo.CmsKit.Tags; +using Volo.CmsKit.Web; namespace Volo.CmsKit; @@ -93,9 +91,8 @@ public class CmsKitWebUnifiedModule : AbpModule public override void ConfigureServices(ServiceConfigurationContext context) { var hostingEnvironment = context.Services.GetHostingEnvironment(); - var configuration = context.Services.GetConfiguration(); - ConfigureCmsKit(context); + ConfigureCmsKit(); Configure(options => { @@ -156,11 +153,11 @@ public class CmsKitWebUnifiedModule : AbpModule Configure(options => { - options.AddWidget("ExComment", "CommentDate"); + options.AddWidget("ExComment", "CommentDate", "DecisionCommentDate"); }); } - private void ConfigureCmsKit(ServiceConfigurationContext context) + private void ConfigureCmsKit() { Configure(options => { diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/create.js b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/create.js index 375b7ad41b..a101635d73 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/create.js +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/create.js @@ -334,6 +334,25 @@ $(function () { editor.insertText(txt); }); + $('.tab-item').on('click', function () { + if ($(this).attr("aria-label") == 'Preview' && editor.isMarkdownMode()) { + + let content = editor.getMarkdown(); + localStorage.setItem('content', content); + + $.post("/CmsKitCommonWidgets/ContentPreview", { content: content }, function (result) { + editor.setHTML(result); + + var highllightedText = $('#ContentEditor').find('.toastui-editor-md-preview-highlight'); + highllightedText.removeClass('toastui-editor-md-preview-highlight'); + }); + } + else if ($(this).attr("aria-label") == 'Write') { + var retrievedObject = localStorage.getItem('content'); + editor.setMarkdown(retrievedObject); + } + }); + function createAddWidgetButton() { const button = document.createElement('button'); diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/update.js b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/update.js index 51e3eda96c..d14194ecb5 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/update.js +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/update.js @@ -255,6 +255,25 @@ $(function () { editor.insertText(txt); }); + $('.tab-item').on('click', function () { + if ($(this).attr("aria-label") == 'Preview' && editor.isMarkdownMode()) { + + let content = editor.getMarkdown(); + localStorage.setItem('content', content); + + $.post("/CmsKitCommonWidgets/ContentPreview", { content: content }, function (result) { + editor.setHTML(result); + + var highllightedText = $('#ContentEditor').find('.toastui-editor-md-preview-highlight'); + highllightedText.removeClass('toastui-editor-md-preview-highlight'); + }); + } + else if ($(this).attr("aria-label") == 'Write') { + var retrievedObject = localStorage.getItem('content'); + editor.setMarkdown(retrievedObject); + } + }); + function createAddWidgetButton() { const button = document.createElement('button'); diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/create.js b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/create.js index 49a482bf33..ee6c7b7f9f 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/create.js +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/create.js @@ -1,6 +1,6 @@ $(function () { var l = abp.localization.getResource("CmsKit"); - + var $createForm = $('#form-page-create'); var $title = $('#ViewModel_Title'); var $slug = $('#ViewModel_Slug'); @@ -90,7 +90,7 @@ $(function () { var fileUriPrefix = "/api/cms-kit/media/"; initEditor(); - + var editor; function initEditor() { var $editorContainer = $("#ContentEditor"); @@ -133,7 +133,7 @@ $(function () { } }); } - + function uploadFile(blob, callback, source) { var UPPY_OPTIONS = { endpoint: fileUploadUri, @@ -166,11 +166,37 @@ $(function () { }); } - $('#GeneratedWidgetText').on('change',function () { + $('#GeneratedWidgetText').on('change', function () { var txt = $('#GeneratedWidgetText').val(); editor.insertText(txt); }); - + + $('.tab-item').on('click', function () { + if ($(this).attr("aria-label") == 'Preview' && editor.isMarkdownMode()) { + + let content = editor.getMarkdown(); + localStorage.setItem('content', content); + + $.post("/CmsKitCommonWidgets/ContentPreview", { content: content }, function (result) { + + let style = styleEditor.getValue(); + + $('#editor-preview-style').remove(); + + $('head').append(''); + + editor.setHTML(result); + + var highllightedText = $('#ContentEditor').find('.toastui-editor-md-preview-highlight'); + highllightedText.removeClass('toastui-editor-md-preview-highlight'); + }); + } + else if ($(this).attr("aria-label") == 'Write'){ + var retrievedObject = localStorage.getItem('content'); + editor.setMarkdown(retrievedObject); + } + }); + function createAddWidgetButton() { const button = document.createElement('button'); diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/update.js b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/update.js index 565f758552..c46f1c274c 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/update.js +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/update.js @@ -140,7 +140,33 @@ $(function () { var txt = $('#GeneratedWidgetText').val(); editor.insertText(txt); }); - + + $('.tab-item').on('click', function () { + if ($(this).attr("aria-label") == 'Preview' && editor.isMarkdownMode()) { + + let content = editor.getMarkdown(); + localStorage.setItem('content', content); + + $.post("/CmsKitCommonWidgets/ContentPreview", { content: content }, function (result) { + + let style = styleEditor.getValue(); + + $('#editor-preview-style').remove(); + + $('head').append(''); + + editor.setHTML(result); + + var highllightedText = $('#ContentEditor').find('.toastui-editor-md-preview-highlight'); + highllightedText.removeClass('toastui-editor-md-preview-highlight'); + }); + } + else if ($(this).attr("aria-label") == 'Write') { + var retrievedObject = localStorage.getItem('content'); + editor.setMarkdown(retrievedObject); + } + }); + function createAddWidgetButton() { const button = document.createElement('button'); diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Blogs/BlogPostPublicDto.cs b/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Contents/BlogPostCommonDto.cs similarity index 80% rename from modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Blogs/BlogPostPublicDto.cs rename to modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Contents/BlogPostCommonDto.cs index 695f50836e..c2b2373d9c 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Blogs/BlogPostPublicDto.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Contents/BlogPostCommonDto.cs @@ -1,13 +1,12 @@ using System; using System.Collections.Generic; using Volo.Abp.Application.Dtos; -using Volo.CmsKit.Contents; using Volo.CmsKit.Users; -namespace Volo.CmsKit.Public.Blogs; +namespace Volo.CmsKit.Contents; [Serializable] -public class BlogPostPublicDto : AuditedEntityDto +public class BlogPostCommonDto : AuditedEntityDto, IContent { public Guid BlogId { get; set; } @@ -24,4 +23,4 @@ public class BlogPostPublicDto : AuditedEntityDto public Guid? CoverImageMediaId { get; set; } public CmsUserDto Author { get; set; } -} +} \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Contents/DefaultContentDto.cs b/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Contents/DefaultContentDto.cs new file mode 100644 index 0000000000..731e346df4 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Contents/DefaultContentDto.cs @@ -0,0 +1,8 @@ +using System.Collections.Generic; + +namespace Volo.CmsKit.Contents; + +public class DefaultContentDto : IContent +{ + public List ContentFragments { get; set; } +} diff --git a/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Contents/IContent.cs b/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Contents/IContent.cs new file mode 100644 index 0000000000..2a393e0a14 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Contents/IContent.cs @@ -0,0 +1,7 @@ +using System.Collections.Generic; + +namespace Volo.CmsKit.Contents; +public interface IContent +{ + public List ContentFragments { get; set; } +} diff --git a/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Contents/IContentAppService.cs b/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Contents/IContentAppService.cs new file mode 100644 index 0000000000..ec2b9bcf42 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Contents/IContentAppService.cs @@ -0,0 +1,10 @@ +using System.Collections.Generic; +using System.Threading.Tasks; +using Volo.Abp.Application.Services; + +namespace Volo.CmsKit.Contents; + +public interface IContentAppService : IApplicationService +{ + Task> ParseAsync(string content); +} diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Pages/PageDto.cs b/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Contents/PageDto.cs similarity index 65% rename from modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Pages/PageDto.cs rename to modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Contents/PageDto.cs index a336844289..0b573be372 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Pages/PageDto.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Contents/PageDto.cs @@ -1,22 +1,21 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; +using System; using Volo.Abp.Application.Dtos; -using Volo.CmsKit.Contents; -namespace Volo.CmsKit.Public.Pages; +namespace Volo.CmsKit.Contents; [Serializable] -public class PageDto : EntityDto +public class PageDto : EntityDto, IContent { public string Title { get; set; } public string Slug { get; set; } public string Content { get; set; } - + public List ContentFragments { get; set; } public string Script { get; set; } public string Style { get; set; } -} +} \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Common.Application/Volo/CmsKit/Contents/ContentAppService.cs b/modules/cms-kit/src/Volo.CmsKit.Common.Application/Volo/CmsKit/Contents/ContentAppService.cs new file mode 100644 index 0000000000..a227f31e18 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Common.Application/Volo/CmsKit/Contents/ContentAppService.cs @@ -0,0 +1,22 @@ +using System.Collections.Generic; +using System.Threading.Tasks; +using Volo.Abp.GlobalFeatures; +using Volo.CmsKit.GlobalFeatures; + +namespace Volo.CmsKit.Contents; + +[RequiresGlobalFeature(typeof(PagesFeature))] +public class ContentAppService : CmsKitAppServiceBase, IContentAppService +{ + protected ContentParser ContentParser { get; } + + public ContentAppService(ContentParser contentParser) + { + ContentParser = contentParser; + } + + public async Task> ParseAsync(string content) + { + return await ContentParser.ParseAsync(content); + } +} diff --git a/modules/cms-kit/src/Volo.CmsKit.Common.Application/Volo/CmsKit/Contents/ContentParser.cs b/modules/cms-kit/src/Volo.CmsKit.Common.Application/Volo/CmsKit/Contents/ContentParser.cs index 7fe9fe5b60..9c6aafc0d0 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Common.Application/Volo/CmsKit/Contents/ContentParser.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Common.Application/Volo/CmsKit/Contents/ContentParser.cs @@ -28,10 +28,10 @@ public class ContentParser : ITransientDependency }); } - var parsedList = new List(); + List parsedList = new(); ParseContent(content, parsedList); - var contentFragments = new List(); + List contentFragments = new(); FillContentFragment(content, parsedList, contentFragments); return Task.FromResult(contentFragments); diff --git a/modules/cms-kit/src/Volo.CmsKit.Common.Web/Controllers/CmsKitCommonWidgetsController.cs b/modules/cms-kit/src/Volo.CmsKit.Common.Web/Controllers/CmsKitCommonWidgetsController.cs new file mode 100644 index 0000000000..8e226a31f2 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Common.Web/Controllers/CmsKitCommonWidgetsController.cs @@ -0,0 +1,14 @@ +using Microsoft.AspNetCore.Mvc; +using Volo.Abp.AspNetCore.Mvc; +using Volo.CmsKit.Web.Pages.CmsKit.Components.ContentPreview; + +namespace Volo.CmsKit.Web.Controllers; + +public class CmsKitCommonWidgetsController : AbpController +{ + [HttpPost] + public IActionResult ContentPreview(ContentPreviewDto dto) + { + return ViewComponent(typeof(ContentPreviewViewComponent), new { content = dto.Content }); + } +} diff --git a/modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Components/ContentPreview/ContentPreviewDto.cs b/modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Components/ContentPreview/ContentPreviewDto.cs new file mode 100644 index 0000000000..9c01a325bf --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Components/ContentPreview/ContentPreviewDto.cs @@ -0,0 +1,9 @@ +using System; + +namespace Volo.CmsKit.Web.Pages.CmsKit.Components.ContentPreview; + +[Serializable] +public class ContentPreviewDto +{ + public string Content { get; set; } +} diff --git a/modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Components/ContentPreview/ContentPreviewViewComponent.cs b/modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Components/ContentPreview/ContentPreviewViewComponent.cs new file mode 100644 index 0000000000..987c404e31 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Components/ContentPreview/ContentPreviewViewComponent.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Mvc; +using Volo.Abp.AspNetCore.Mvc; +using Volo.CmsKit.Contents; + +namespace Volo.CmsKit.Web.Pages.CmsKit.Components.ContentPreview; + +public class ContentPreviewViewComponent : AbpViewComponent +{ + protected IContentAppService ContentAppService { get; } + + public ContentPreviewViewComponent(IContentAppService contentAppService) + { + ContentAppService = contentAppService; + } + + public virtual async Task InvokeAsync(string content) + { + var fragments = await ContentAppService.ParseAsync(content); + + return View("~/Pages/CmsKit/Components/ContentPreview/Default.cshtml", new DefaultContentDto + { + ContentFragments = fragments + }); + } +} diff --git a/modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Components/ContentPreview/Default.cshtml b/modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Components/ContentPreview/Default.cshtml new file mode 100644 index 0000000000..6baf41716e --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Components/ContentPreview/Default.cshtml @@ -0,0 +1,10 @@ +@using Volo.CmsKit.Contents +@using Volo.CmsKit.Web.Pages.CmsKit.Components.Contents + +@model DefaultContentDto + +
+ + @await Component.InvokeAsync(typeof(ContentFragmentViewComponent), Model) + +
\ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Components/Contents/ContentFragment.cshtml b/modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Components/Contents/ContentFragment.cshtml new file mode 100644 index 0000000000..0fa7d59064 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Components/Contents/ContentFragment.cshtml @@ -0,0 +1,20 @@ +@using System.Dynamic +@using Volo.Abp.Data +@using Volo.CmsKit.Web.Renderers; +@using Volo.CmsKit.Web.Pages.CmsKit.Components.Contents; + +@model ContentFragmentViewComponent + +@inject IMarkdownToHtmlRenderer MarkdownRenderer + +@foreach (var contentFragment in Model.ContentDto.ContentFragments) +{ + if (contentFragment.Type == "Markdown") + { + @Html.Raw(await MarkdownRenderer.RenderAsync(contentFragment.GetProperty("Content"))) + } + else if (contentFragment.Type == "Widget") + { + @await Component.InvokeAsync(contentFragment.GetProperty("Type"), contentFragment.ExtraProperties.ConvertToDynamicObject()) + } +} \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Components/Contents/ContentFragmentViewComponent.cs b/modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Components/Contents/ContentFragmentViewComponent.cs new file mode 100644 index 0000000000..d276165982 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Components/Contents/ContentFragmentViewComponent.cs @@ -0,0 +1,21 @@ +using System.Threading.Tasks; +using Microsoft.AspNetCore.Mvc; +using Volo.Abp.AspNetCore.Mvc; +using Volo.Abp.AspNetCore.Mvc.UI.Widgets; +using Volo.CmsKit.Contents; + +namespace Volo.CmsKit.Web.Pages.CmsKit.Components.Contents; + +[ViewComponent(Name = "ContentFragment")] +[Widget( + AutoInitialize = true +)] +public class ContentFragmentViewComponent : AbpViewComponent +{ + public IContent ContentDto { get; set; } + + public virtual async Task InvokeAsync(IContent contentDto) + { + return View("~/Pages/CmsKit/Components/Contents/ContentFragment.cshtml", new ContentFragmentViewComponent() { ContentDto = contentDto }); + } +} \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Common.Web/Contents/IContentRenderer.cs b/modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Components/Contents/IContentRenderer.cs similarity index 66% rename from modules/cms-kit/src/Volo.CmsKit.Common.Web/Contents/IContentRenderer.cs rename to modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Components/Contents/IContentRenderer.cs index 879b27cda7..b33c044392 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Common.Web/Contents/IContentRenderer.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Components/Contents/IContentRenderer.cs @@ -1,6 +1,6 @@ using System.Threading.Tasks; -namespace Volo.CmsKit.Web.Contents; +namespace Volo.CmsKit.Web.Pages.CmsKit.Components.Contents; public interface IContentRenderer { diff --git a/modules/cms-kit/src/Volo.CmsKit.Common.Web/Contents/PlainTextContentRenderer.cs b/modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Components/Contents/PlainTextContentRenderer.cs similarity index 80% rename from modules/cms-kit/src/Volo.CmsKit.Common.Web/Contents/PlainTextContentRenderer.cs rename to modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Components/Contents/PlainTextContentRenderer.cs index cf68e25e15..3fcc78f658 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Common.Web/Contents/PlainTextContentRenderer.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Components/Contents/PlainTextContentRenderer.cs @@ -1,7 +1,7 @@ using System.Threading.Tasks; using Volo.Abp.DependencyInjection; -namespace Volo.CmsKit.Web.Contents; +namespace Volo.CmsKit.Web.Pages.CmsKit.Components.Contents; public class PlainTextContentRenderer : IContentRenderer, ITransientDependency { diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Renderers/IMarkdownToHtmlRenderer.cs b/modules/cms-kit/src/Volo.CmsKit.Common.Web/Renderers/IMarkdownToHtmlRenderer.cs similarity index 77% rename from modules/cms-kit/src/Volo.CmsKit.Public.Web/Renderers/IMarkdownToHtmlRenderer.cs rename to modules/cms-kit/src/Volo.CmsKit.Common.Web/Renderers/IMarkdownToHtmlRenderer.cs index d11e76f6dd..98fcda1fac 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Renderers/IMarkdownToHtmlRenderer.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Common.Web/Renderers/IMarkdownToHtmlRenderer.cs @@ -1,6 +1,6 @@ using System.Threading.Tasks; -namespace Volo.CmsKit.Public.Web.Renderers; +namespace Volo.CmsKit.Web.Renderers; public interface IMarkdownToHtmlRenderer { diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Renderers/MarkdownToHtmlRenderer.cs b/modules/cms-kit/src/Volo.CmsKit.Common.Web/Renderers/MarkdownToHtmlRenderer.cs similarity index 98% rename from modules/cms-kit/src/Volo.CmsKit.Public.Web/Renderers/MarkdownToHtmlRenderer.cs rename to modules/cms-kit/src/Volo.CmsKit.Common.Web/Renderers/MarkdownToHtmlRenderer.cs index b6fab3c008..639948e801 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Renderers/MarkdownToHtmlRenderer.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Common.Web/Renderers/MarkdownToHtmlRenderer.cs @@ -7,7 +7,7 @@ using System.Web; using Volo.Abp.DependencyInjection; using Ganss.XSS; -namespace Volo.CmsKit.Public.Web.Renderers; +namespace Volo.CmsKit.Web.Renderers; public class MarkdownToHtmlRenderer : IMarkdownToHtmlRenderer, ITransientDependency { diff --git a/modules/cms-kit/src/Volo.CmsKit.Common.Web/Volo.CmsKit.Common.Web.csproj b/modules/cms-kit/src/Volo.CmsKit.Common.Web/Volo.CmsKit.Common.Web.csproj index 1ca9a78b27..e717f49be5 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Common.Web/Volo.CmsKit.Common.Web.csproj +++ b/modules/cms-kit/src/Volo.CmsKit.Common.Web/Volo.CmsKit.Common.Web.csproj @@ -1,38 +1,40 @@ - - + + - - net6.0 - $(AssetTargetFallback);portable-net45+win8+wp8+wpa81; - true - Library - Volo.CmsKit.Web - true - + + net6.0 + $(AssetTargetFallback);portable-net45+win8+wp8+wpa81; + true + Library + Volo.CmsKit.Web + true + - - - - - + + + + + - - - + + + + + - - - - - - - - - - - - + + + + + + + + + + + + diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/GlobalFeatures/ContentsFeature.cs b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/GlobalFeatures/ContentsFeature.cs new file mode 100644 index 0000000000..ac752a68c4 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/GlobalFeatures/ContentsFeature.cs @@ -0,0 +1,28 @@ +using JetBrains.Annotations; +using Volo.Abp.GlobalFeatures; + +namespace Volo.CmsKit.GlobalFeatures; + +[GlobalFeatureName(Name)] +public class ContentsFeature : GlobalFeature +{ + public const string Name = "CmsKit.Contents"; + + internal ContentsFeature( + [NotNull] GlobalCmsKitFeatures cmsKit + ) : base(cmsKit) + { + + } + + public override void Enable() + { + var userFeature = FeatureManager.Modules.CmsKit().User; + if (!userFeature.IsEnabled) + { + userFeature.Enable(); + } + + base.Enable(); + } +} diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Blogs/IBlogPostPublicAppService.cs b/modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Blogs/IBlogPostPublicAppService.cs index 42161f884c..a6462d937c 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Blogs/IBlogPostPublicAppService.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Blogs/IBlogPostPublicAppService.cs @@ -1,18 +1,18 @@ -using System.Collections.Generic; -using JetBrains.Annotations; +using System; using System.Threading.Tasks; +using JetBrains.Annotations; using Volo.Abp.Application.Dtos; using Volo.Abp.Application.Services; +using Volo.CmsKit.Contents; using Volo.CmsKit.Users; -using System; namespace Volo.CmsKit.Public.Blogs; public interface IBlogPostPublicAppService : IApplicationService { - Task> GetListAsync([NotNull] string blogSlug, BlogPostGetListInput input); + Task> GetListAsync([NotNull] string blogSlug, BlogPostGetListInput input); - Task GetAsync([NotNull] string blogSlug, [NotNull] string blogPostSlug); + Task GetAsync([NotNull] string blogSlug, [NotNull] string blogPostSlug); Task> GetAuthorsHasBlogPostsAsync(BlogPostFilteredPagedAndSortedResultRequestDto input); diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Pages/IPagePublicAppService.cs b/modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Pages/IPagePublicAppService.cs index 0b33a91236..230b8ded97 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Pages/IPagePublicAppService.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Pages/IPagePublicAppService.cs @@ -1,6 +1,7 @@ using JetBrains.Annotations; using System.Threading.Tasks; using Volo.Abp.Application.Services; +using Volo.CmsKit.Contents; namespace Volo.CmsKit.Public.Pages; diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Application/Volo/CmsKit/Public/Blogs/BlogPostPublicAppService.cs b/modules/cms-kit/src/Volo.CmsKit.Public.Application/Volo/CmsKit/Public/Blogs/BlogPostPublicAppService.cs index ebdda3d293..80185f7bea 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Application/Volo/CmsKit/Public/Blogs/BlogPostPublicAppService.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Application/Volo/CmsKit/Public/Blogs/BlogPostPublicAppService.cs @@ -29,20 +29,20 @@ public class BlogPostPublicAppService : CmsKitPublicAppServiceBase, IBlogPostPub ContentParser = contentParser; } - public virtual async Task GetAsync( + public virtual async Task GetAsync( [NotNull] string blogSlug, [NotNull] string blogPostSlug) { var blog = await BlogRepository.GetBySlugAsync(blogSlug); var blogPost = await BlogPostRepository.GetBySlugAsync(blog.Id, blogPostSlug); - var blogPostDto = ObjectMapper.Map(blogPost); + var blogPostDto = ObjectMapper.Map(blogPost); blogPostDto.ContentFragments = await ContentParser.ParseAsync(blogPost.Content); return blogPostDto; } - public virtual async Task> GetListAsync([NotNull] string blogSlug, BlogPostGetListInput input) + public virtual async Task> GetListAsync([NotNull] string blogSlug, BlogPostGetListInput input) { var blog = await BlogRepository.GetBySlugAsync(blogSlug); @@ -50,10 +50,10 @@ public class BlogPostPublicAppService : CmsKitPublicAppServiceBase, IBlogPostPub BlogPostStatus.Published, input.MaxResultCount, input.SkipCount, input.Sorting); - return new PagedResultDto( + return new PagedResultDto( await BlogPostRepository.GetCountAsync(blogId: blog.Id, tagId: input.TagId, statusFilter: BlogPostStatus.Published, authorId: input.AuthorId), - ObjectMapper.Map, List>(blogPosts)); + ObjectMapper.Map, List>(blogPosts)); } public virtual async Task> GetAuthorsHasBlogPostsAsync(BlogPostFilteredPagedAndSortedResultRequestDto input) diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Application/Volo/CmsKit/Public/PublicApplicationAutoMapperProfile.cs b/modules/cms-kit/src/Volo.CmsKit.Public.Application/Volo/CmsKit/Public/PublicApplicationAutoMapperProfile.cs index 704a03778c..bd0c6d5e6c 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Application/Volo/CmsKit/Public/PublicApplicationAutoMapperProfile.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Application/Volo/CmsKit/Public/PublicApplicationAutoMapperProfile.cs @@ -2,13 +2,13 @@ using Volo.Abp.AutoMapper; using Volo.CmsKit.Blogs; using Volo.CmsKit.Comments; +using Volo.CmsKit.Contents; using Volo.CmsKit.GlobalResources; using Volo.CmsKit.Menus; using Volo.CmsKit.Pages; using Volo.CmsKit.Public.Blogs; using Volo.CmsKit.Public.Comments; using Volo.CmsKit.Public.GlobalResources; -using Volo.CmsKit.Public.Pages; using Volo.CmsKit.Public.Ratings; using Volo.CmsKit.Ratings; using Volo.CmsKit.Users; @@ -33,7 +33,7 @@ public class PublicApplicationAutoMapperProfile : Profile CreateMap() .Ignore(x => x.ContentFragments); - CreateMap() + CreateMap() .Ignore(x => x.ContentFragments); CreateMap(); diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi.Client/ClientProxies/BlogPostPublicClientProxy.Generated.cs b/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi.Client/ClientProxies/BlogPostPublicClientProxy.Generated.cs index b1bbf6be07..f26816e88d 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi.Client/ClientProxies/BlogPostPublicClientProxy.Generated.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi.Client/ClientProxies/BlogPostPublicClientProxy.Generated.cs @@ -2,11 +2,9 @@ using System; using System.Threading.Tasks; using Volo.Abp.Application.Dtos; -using Volo.Abp.Http.Client; -using Volo.Abp.Http.Modeling; using Volo.Abp.DependencyInjection; using Volo.Abp.Http.Client.ClientProxying; -using Volo.CmsKit.Public.Blogs; +using Volo.CmsKit.Contents; using Volo.CmsKit.Users; // ReSharper disable once CheckNamespace @@ -16,18 +14,18 @@ namespace Volo.CmsKit.Public.Blogs.ClientProxies; [ExposeServices(typeof(IBlogPostPublicAppService), typeof(BlogPostPublicClientProxy))] public partial class BlogPostPublicClientProxy : ClientProxyBase, IBlogPostPublicAppService { - public virtual async Task GetAsync(string blogSlug, string blogPostSlug) + public virtual async Task GetAsync(string blogSlug, string blogPostSlug) { - return await RequestAsync(nameof(GetAsync), new ClientProxyRequestTypeValue + return await RequestAsync(nameof(GetAsync), new ClientProxyRequestTypeValue { { typeof(string), blogSlug }, { typeof(string), blogPostSlug } }); } - public virtual async Task> GetListAsync(string blogSlug, BlogPostGetListInput input) + public virtual async Task> GetListAsync(string blogSlug, BlogPostGetListInput input) { - return await RequestAsync>(nameof(GetListAsync), new ClientProxyRequestTypeValue + return await RequestAsync>(nameof(GetListAsync), new ClientProxyRequestTypeValue { { typeof(string), blogSlug }, { typeof(BlogPostGetListInput), input } diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi.Client/ClientProxies/PagesPublicClientProxy.Generated.cs b/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi.Client/ClientProxies/PagesPublicClientProxy.Generated.cs index 9ecf6cb387..f992bb3dbf 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi.Client/ClientProxies/PagesPublicClientProxy.Generated.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi.Client/ClientProxies/PagesPublicClientProxy.Generated.cs @@ -1,12 +1,8 @@ // This file is automatically generated by ABP framework to use MVC Controllers from CSharp -using System; using System.Threading.Tasks; -using Volo.Abp.Application.Dtos; -using Volo.Abp.Http.Client; -using Volo.Abp.Http.Modeling; using Volo.Abp.DependencyInjection; using Volo.Abp.Http.Client.ClientProxying; -using Volo.CmsKit.Public.Pages; +using Volo.CmsKit.Contents; // ReSharper disable once CheckNamespace namespace Volo.CmsKit.Public.Pages.ClientProxies; diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi.Client/ClientProxies/cms-kit-generate-proxy.json b/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi.Client/ClientProxies/cms-kit-generate-proxy.json index 626dce7ff2..e3b3802ee9 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi.Client/ClientProxies/cms-kit-generate-proxy.json +++ b/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi.Client/ClientProxies/cms-kit-generate-proxy.json @@ -505,57 +505,6 @@ } } }, - "Volo.CmsKit.Public.Polls.PollViewComponentController": { - "controllerName": "PollViewComponent", - "controllerGroupName": "PollViewComponent", - "isRemoteService": true, - "apiVersion": null, - "type": "Volo.CmsKit.Public.Polls.PollViewComponentController", - "interfaces": [ - { - "type": "Volo.CmsKit.Public.Polls.IPollViewComponentAppService" - } - ], - "actions": { - "ParseAsyncByContent": { - "uniqueName": "ParseAsyncByContent", - "name": "ParseAsync", - "httpMethod": "GET", - "url": "api/cms-kit-public/polls/{content}", - "supportedVersions": [], - "parametersOnMethod": [ - { - "name": "content", - "typeAsString": "System.String, System.Private.CoreLib", - "type": "System.String", - "typeSimple": "string", - "isOptional": false, - "defaultValue": null - } - ], - "parameters": [ - { - "nameOnMethod": "content", - "name": "content", - "jsonName": null, - "type": "System.String", - "typeSimple": "string", - "isOptional": false, - "defaultValue": null, - "constraintTypes": [], - "bindingSourceId": "Path", - "descriptorName": "" - } - ], - "returnValue": { - "type": "System.Collections.Generic.List", - "typeSimple": "[Volo.CmsKit.Polls.ContentFragment]" - }, - "allowAnonymous": null, - "implementFrom": "Volo.CmsKit.Public.Polls.IPollViewComponentAppService" - } - } - }, "Volo.CmsKit.Public.Pages.PagesPublicController": { "controllerName": "PagesPublic", "controllerGroupName": "PagesPublic", @@ -599,8 +548,8 @@ } ], "returnValue": { - "type": "Volo.CmsKit.Public.Pages.PageDto", - "typeSimple": "Volo.CmsKit.Public.Pages.PageDto" + "type": "Volo.CmsKit.Contents.PageDto", + "typeSimple": "Volo.CmsKit.Contents.PageDto" }, "allowAnonymous": null, "implementFrom": "Volo.CmsKit.Public.Pages.IPagePublicAppService" @@ -985,8 +934,8 @@ } ], "returnValue": { - "type": "Volo.CmsKit.Public.Blogs.BlogPostPublicDto", - "typeSimple": "Volo.CmsKit.Public.Blogs.BlogPostPublicDto" + "type": "Volo.CmsKit.Contents.BlogPostCommonDto", + "typeSimple": "Volo.CmsKit.Contents.BlogPostCommonDto" }, "allowAnonymous": null, "implementFrom": "Volo.CmsKit.Public.Blogs.IBlogPostPublicAppService" @@ -1090,8 +1039,8 @@ } ], "returnValue": { - "type": "Volo.Abp.Application.Dtos.PagedResultDto", - "typeSimple": "Volo.Abp.Application.Dtos.PagedResultDto" + "type": "Volo.Abp.Application.Dtos.PagedResultDto", + "typeSimple": "Volo.Abp.Application.Dtos.PagedResultDto" }, "allowAnonymous": null, "implementFrom": "Volo.CmsKit.Public.Blogs.IBlogPostPublicAppService" diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi/Volo/CmsKit/Public/Blogs/BlogPostPublicController.cs b/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi/Volo/CmsKit/Public/Blogs/BlogPostPublicController.cs index 9f43d65766..be28afa6a4 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi/Volo/CmsKit/Public/Blogs/BlogPostPublicController.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi/Volo/CmsKit/Public/Blogs/BlogPostPublicController.cs @@ -1,11 +1,10 @@ -using Microsoft.AspNetCore.Mvc; -using System; -using System.Collections.Generic; +using System; using System.Threading.Tasks; +using Microsoft.AspNetCore.Mvc; using Volo.Abp; using Volo.Abp.Application.Dtos; -using Volo.Abp.Content; using Volo.Abp.GlobalFeatures; +using Volo.CmsKit.Contents; using Volo.CmsKit.GlobalFeatures; using Volo.CmsKit.Users; @@ -26,14 +25,14 @@ public class BlogPostPublicController : CmsKitPublicControllerBase, IBlogPostPub [HttpGet] [Route("{blogSlug}/{blogPostSlug}")] - public virtual Task GetAsync(string blogSlug, string blogPostSlug) + public virtual Task GetAsync(string blogSlug, string blogPostSlug) { return BlogPostPublicAppService.GetAsync(blogSlug, blogPostSlug); } [HttpGet] [Route("{blogSlug}")] - public virtual Task> GetListAsync(string blogSlug, BlogPostGetListInput input) + public virtual Task> GetListAsync(string blogSlug, BlogPostGetListInput input) { return BlogPostPublicAppService.GetListAsync(blogSlug, input); } diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi/Volo/CmsKit/Public/Pages/PagesPublicController.cs b/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi/Volo/CmsKit/Public/Pages/PagesPublicController.cs index 763fe7522d..cd65f84c26 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi/Volo/CmsKit/Public/Pages/PagesPublicController.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi/Volo/CmsKit/Public/Pages/PagesPublicController.cs @@ -2,6 +2,7 @@ using Microsoft.AspNetCore.Mvc; using Volo.Abp; using Volo.Abp.GlobalFeatures; +using Volo.CmsKit.Contents; using Volo.CmsKit.GlobalFeatures; namespace Volo.CmsKit.Public.Pages; diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Commenting/CommentingViewComponent.cs b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Commenting/CommentingViewComponent.cs index 0a608740e9..03b040f2e9 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Commenting/CommentingViewComponent.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Commenting/CommentingViewComponent.cs @@ -8,7 +8,7 @@ using Volo.Abp.AspNetCore.Mvc; using Volo.Abp.AspNetCore.Mvc.UI; using Volo.Abp.AspNetCore.Mvc.UI.Widgets; using Volo.CmsKit.Public.Comments; -using Volo.CmsKit.Public.Web.Renderers; +using Volo.CmsKit.Web.Renderers; namespace Volo.CmsKit.Public.Web.Pages.CmsKit.Shared.Components.Commenting; diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/BlogPost.cshtml b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/BlogPost.cshtml index 2cff5c9072..fe9227f194 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/BlogPost.cshtml +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/BlogPost.cshtml @@ -9,9 +9,9 @@ @using Volo.CmsKit.Public.Web.Pages.CmsKit.Shared.Components.ReactionSelection @using Volo.CmsKit.Public.Web.Pages.CmsKit.Shared.Components.Rating @using Volo.CmsKit.Public.Web.Pages.CmsKit.Shared.Components.Tags -@using Volo.CmsKit.Public.Web.Renderers @using Volo.Abp.AspNetCore.Mvc.UI.Packages.HighlightJs @using Volo.CmsKit.Contents +@using Volo.CmsKit.Web.Renderers @inherits CmsKitPublicPageBase @@ -32,13 +32,14 @@ } + } - @section scripts{ +@section scripts{ @if (isScrollIndexEnabled) { @@ -54,49 +55,39 @@ } -
-
- - - - -
-

@Model.BlogPost.Title

-

- - @@@Model.BlogPost.Author?.UserName - - @Model.BlogPost.CreationTime -

- @foreach (var contentFragment in Model.BlogPost.ContentFragments) +
+
+ + + + +
+

@Model.BlogPost.Title

+

+ + @@@Model.BlogPost.Author?.UserName + + @Model.BlogPost.CreationTime +

+ @await Component.InvokeAsync("ContentFragment", new { contentDto = Model.BlogPost }) +

+ @if (Model.BlogPost.LastModificationTime != null) { - if (contentFragment.Type == ContentConsts.Markdown) - { - @Html.Raw(await MarkdownRenderer.RenderAsync(contentFragment.GetProperty("Content"))) - } - else if (contentFragment.Type == ContentConsts.Widget) - { - @await Component.InvokeAsync(contentFragment.GetProperty("Type"), contentFragment.ExtraProperties.ConvertToDynamicObject()) - } + @L["LastModification"].Value : @Model.BlogPost.LastModificationTime } -

- @if (Model.BlogPost.LastModificationTime != null) - { - @L["LastModification"].Value : @Model.BlogPost.LastModificationTime - } -

-
+

+
- @if (GlobalFeatureManager.Instance.IsEnabled()) + @if (GlobalFeatureManager.Instance.IsEnabled()) + { + if (Model.TagsFeature?.IsEnabled == true) { - if (Model.TagsFeature?.IsEnabled == true) + @await Component.InvokeAsync(typeof(TagViewComponent), new { - @await Component.InvokeAsync(typeof(TagViewComponent), new - { - entityType = Volo.CmsKit.Blogs.BlogPostConsts.EntityType, - entityId = Model.BlogPost.Id.ToString(), - urlFormat = $"/blogs/{Model.BlogSlug}?tagId={{TagId}}" - }) + entityType = Volo.CmsKit.Blogs.BlogPostConsts.EntityType, + entityId = Model.BlogPost.Id.ToString(), + urlFormat = $"/blogs/{Model.BlogSlug}?tagId={{TagId}}" + }) } }
@@ -109,10 +100,10 @@ if (Model.ReactionsFeature?.IsEnabled == true) { @await Component.InvokeAsync(typeof(ReactionSelectionViewComponent), new - { - entityType = Volo.CmsKit.Blogs.BlogPostConsts.EntityType, - entityId = Model.BlogPost.Id.ToString() - }) + { + entityType = Volo.CmsKit.Blogs.BlogPostConsts.EntityType, + entityId = Model.BlogPost.Id.ToString() + }) } } @@ -122,10 +113,10 @@ if (Model.RatingsFeature?.IsEnabled == true) { @await Component.InvokeAsync(typeof(RatingViewComponent), new - { - entityType = Volo.CmsKit.Blogs.BlogPostConsts.EntityType, - entityId = Model.BlogPost.Id.ToString() - }) + { + entityType = Volo.CmsKit.Blogs.BlogPostConsts.EntityType, + entityId = Model.BlogPost.Id.ToString() + }) } } @@ -133,6 +124,7 @@
+ @if (isScrollIndexEnabled) {
@@ -140,7 +132,7 @@
@L["InThisDocument"]
- +
diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/BlogPost.cshtml.cs b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/BlogPost.cshtml.cs index 6227190ab8..e1d9a3b0f7 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/BlogPost.cshtml.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/BlogPost.cshtml.cs @@ -2,6 +2,7 @@ using Microsoft.AspNetCore.Mvc; using Volo.Abp.GlobalFeatures; using Volo.CmsKit.Blogs; +using Volo.CmsKit.Contents; using Volo.CmsKit.GlobalFeatures; using Volo.CmsKit.Public.Blogs; @@ -15,7 +16,7 @@ public class BlogPostModel : CmsKitPublicPageModelBase [BindProperty(SupportsGet = true)] public string BlogPostSlug { get; set; } - public BlogPostPublicDto BlogPost { get; private set; } + public BlogPostCommonDto BlogPost { get; private set; } public BlogFeatureDto CommentsFeature { get; private set; } diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/Index.cshtml.cs b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/Index.cshtml.cs index f5f2cc2f7a..736fba5e9e 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/Index.cshtml.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/Index.cshtml.cs @@ -1,11 +1,9 @@ -using Microsoft.AspNetCore.Mvc; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; +using System; using System.Threading.Tasks; +using Microsoft.AspNetCore.Mvc; using Volo.Abp.Application.Dtos; using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Pagination; +using Volo.CmsKit.Contents; using Volo.CmsKit.Public.Blogs; using Volo.CmsKit.Users; @@ -27,7 +25,7 @@ public class IndexModel : CmsKitPublicPageModelBase [BindProperty(SupportsGet = true)] public Guid? TagId { get; set; } - public PagedResultDto Blogs { get; private set; } + public PagedResultDto Blogs { get; private set; } public PagerModel PagerModel => new PagerModel(Blogs.TotalCount, Blogs.Items.Count, CurrentPage, PageSize, Request.Path.ToString()); diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Pages/Index.cshtml b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Pages/Index.cshtml index 2aa3c0ce8b..250303177b 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Pages/Index.cshtml +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Pages/Index.cshtml @@ -2,17 +2,12 @@ @addTagHelper *, Volo.Abp.AspNetCore.Mvc.UI.Bootstrap @using Volo.CmsKit.Contents @using System.Dynamic -@using Volo.CmsKit.Public.Web.Renderers @using Volo.Abp.Data @using Volo.Abp.AspNetCore.Mvc.UI.Packages.HighlightJs; @using Volo.Abp.AspNetCore.Mvc.UI.Widgets; -@inject IMarkdownToHtmlRenderer MarkdownRenderer - - @model Volo.CmsKit.Public.Web.Pages.Public.CmsKit.Pages.IndexModel - @section styles{ @@ -30,18 +25,7 @@ - @foreach (ContentFragment contentFragment in Model.PageDto.ContentFragments) - { - if (contentFragment.Type == ContentConsts.Markdown) - { - @Html.Raw(await MarkdownRenderer.RenderAsync(contentFragment.GetProperty("Content"))) - } - else if (contentFragment.Type == ContentConsts.Widget) - { - @await Component.InvokeAsync(contentFragment.GetProperty("Type"), contentFragment.ExtraProperties.ConvertToDynamicObject()) - } - - } + @await Component.InvokeAsync("ContentFragment", new { contentDto = Model.PageDto }) diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Pages/Index.cshtml.cs b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Pages/Index.cshtml.cs index 1434eccb4b..7ae92d7016 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Pages/Index.cshtml.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Pages/Index.cshtml.cs @@ -1,5 +1,6 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; +using Volo.CmsKit.Contents; using Volo.CmsKit.Public.Pages; using Volo.CmsKit.Web.Pages; @@ -12,9 +13,9 @@ public class IndexModel : CommonPageModel protected IPagePublicAppService PagePublicAppService { get; } - public PageDto PageDto{ get; private set; } + public PageDto PageDto { get; private set; } -public IndexModel(IPagePublicAppService pagePublicAppService) + public IndexModel(IPagePublicAppService pagePublicAppService) { PagePublicAppService = pagePublicAppService; }