Browse Source

Merge pull request #13499 from abpframework/editor-preview-enhancements

Editor preview enhancements
pull/13540/head
Enis Necipoglu 4 years ago
committed by GitHub
parent
commit
392beb897b
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 27
      modules/cms-kit/host/Volo.CmsKit.Web.Unified/CmsKitWebUnifiedModule.cs
  2. 19
      modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/create.js
  3. 19
      modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/update.js
  4. 36
      modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/create.js
  5. 28
      modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/update.js
  6. 7
      modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Contents/BlogPostCommonDto.cs
  7. 8
      modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Contents/DefaultContentDto.cs
  8. 7
      modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Contents/IContent.cs
  9. 10
      modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Contents/IContentAppService.cs
  10. 13
      modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Contents/PageDto.cs
  11. 22
      modules/cms-kit/src/Volo.CmsKit.Common.Application/Volo/CmsKit/Contents/ContentAppService.cs
  12. 4
      modules/cms-kit/src/Volo.CmsKit.Common.Application/Volo/CmsKit/Contents/ContentParser.cs
  13. 14
      modules/cms-kit/src/Volo.CmsKit.Common.Web/Controllers/CmsKitCommonWidgetsController.cs
  14. 9
      modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Components/ContentPreview/ContentPreviewDto.cs
  15. 30
      modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Components/ContentPreview/ContentPreviewViewComponent.cs
  16. 10
      modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Components/ContentPreview/Default.cshtml
  17. 20
      modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Components/Contents/ContentFragment.cshtml
  18. 21
      modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Components/Contents/ContentFragmentViewComponent.cs
  19. 2
      modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Components/Contents/IContentRenderer.cs
  20. 2
      modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Components/Contents/PlainTextContentRenderer.cs
  21. 2
      modules/cms-kit/src/Volo.CmsKit.Common.Web/Renderers/IMarkdownToHtmlRenderer.cs
  22. 2
      modules/cms-kit/src/Volo.CmsKit.Common.Web/Renderers/MarkdownToHtmlRenderer.cs
  23. 62
      modules/cms-kit/src/Volo.CmsKit.Common.Web/Volo.CmsKit.Common.Web.csproj
  24. 28
      modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/GlobalFeatures/ContentsFeature.cs
  25. 10
      modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Blogs/IBlogPostPublicAppService.cs
  26. 1
      modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Pages/IPagePublicAppService.cs
  27. 10
      modules/cms-kit/src/Volo.CmsKit.Public.Application/Volo/CmsKit/Public/Blogs/BlogPostPublicAppService.cs
  28. 4
      modules/cms-kit/src/Volo.CmsKit.Public.Application/Volo/CmsKit/Public/PublicApplicationAutoMapperProfile.cs
  29. 12
      modules/cms-kit/src/Volo.CmsKit.Public.HttpApi.Client/ClientProxies/BlogPostPublicClientProxy.Generated.cs
  30. 6
      modules/cms-kit/src/Volo.CmsKit.Public.HttpApi.Client/ClientProxies/PagesPublicClientProxy.Generated.cs
  31. 63
      modules/cms-kit/src/Volo.CmsKit.Public.HttpApi.Client/ClientProxies/cms-kit-generate-proxy.json
  32. 11
      modules/cms-kit/src/Volo.CmsKit.Public.HttpApi/Volo/CmsKit/Public/Blogs/BlogPostPublicController.cs
  33. 1
      modules/cms-kit/src/Volo.CmsKit.Public.HttpApi/Volo/CmsKit/Public/Pages/PagesPublicController.cs
  34. 2
      modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Commenting/CommentingViewComponent.cs
  35. 90
      modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/BlogPost.cshtml
  36. 3
      modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/BlogPost.cshtml.cs
  37. 10
      modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/Index.cshtml.cs
  38. 18
      modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Pages/Index.cshtml
  39. 5
      modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Pages/Index.cshtml.cs

27
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<AbpDbContextOptions>(options =>
{
@ -156,11 +153,11 @@ public class CmsKitWebUnifiedModule : AbpModule
Configure<CmsKitContentWidgetOptions>(options =>
{
options.AddWidget("ExComment", "CommentDate");
options.AddWidget("ExComment", "CommentDate", "DecisionCommentDate");
});
}
private void ConfigureCmsKit(ServiceConfigurationContext context)
private void ConfigureCmsKit()
{
Configure<CmsKitTagOptions>(options =>
{

19
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');

19
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');

36
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('<style id="editor-preview-style">' + style + '</style>');
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');

28
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('<style id="editor-preview-style">' + style + '</style>');
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');

7
modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Blogs/BlogPostPublicDto.cs → 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<Guid>
public class BlogPostCommonDto : AuditedEntityDto<Guid>, IContent
{
public Guid BlogId { get; set; }
@ -24,4 +23,4 @@ public class BlogPostPublicDto : AuditedEntityDto<Guid>
public Guid? CoverImageMediaId { get; set; }
public CmsUserDto Author { get; set; }
}
}

8
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<ContentFragment> ContentFragments { get; set; }
}

7
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<ContentFragment> ContentFragments { get; set; }
}

10
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<List<ContentFragment>> ParseAsync(string content);
}

13
modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Pages/PageDto.cs → 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<Guid>
public class PageDto : EntityDto<Guid>, IContent
{
public string Title { get; set; }
public string Slug { get; set; }
public string Content { get; set; }
public List<ContentFragment> ContentFragments { get; set; }
public string Script { get; set; }
public string Style { get; set; }
}
}

22
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<List<ContentFragment>> ParseAsync(string content)
{
return await ContentParser.ParseAsync(content);
}
}

4
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<string>();
List<string> parsedList = new();
ParseContent(content, parsedList);
var contentFragments = new List<ContentFragment>();
List<ContentFragment> contentFragments = new();
FillContentFragment(content, parsedList, contentFragments);
return Task.FromResult(contentFragments);

14
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 });
}
}

9
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; }
}

30
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<IViewComponentResult> InvokeAsync(string content)
{
var fragments = await ContentAppService.ParseAsync(content);
return View("~/Pages/CmsKit/Components/ContentPreview/Default.cshtml", new DefaultContentDto
{
ContentFragments = fragments
});
}
}

10
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
<div class="content">
@await Component.InvokeAsync(typeof(ContentFragmentViewComponent), Model)
</div>

20
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<string>("Content")))
}
else if (contentFragment.Type == "Widget")
{
@await Component.InvokeAsync(contentFragment.GetProperty<string>("Type"), contentFragment.ExtraProperties.ConvertToDynamicObject())
}
}

21
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<IViewComponentResult> InvokeAsync(IContent contentDto)
{
return View("~/Pages/CmsKit/Components/Contents/ContentFragment.cshtml", new ContentFragmentViewComponent() { ContentDto = contentDto });
}
}

2
modules/cms-kit/src/Volo.CmsKit.Common.Web/Contents/IContentRenderer.cs → 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
{

2
modules/cms-kit/src/Volo.CmsKit.Common.Web/Contents/PlainTextContentRenderer.cs → 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
{

2
modules/cms-kit/src/Volo.CmsKit.Public.Web/Renderers/IMarkdownToHtmlRenderer.cs → 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
{

2
modules/cms-kit/src/Volo.CmsKit.Public.Web/Renderers/MarkdownToHtmlRenderer.cs → 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
{

62
modules/cms-kit/src/Volo.CmsKit.Common.Web/Volo.CmsKit.Common.Web.csproj

@ -1,38 +1,40 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Import Project="..\..\..\..\common.props" />
<Import Project="..\..\..\..\configureawait.props" />
<Import Project="..\..\..\..\common.props" />
<Import Project="..\..\..\..\configureawait.props" />
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback>
<IsPackable>true</IsPackable>
<OutputType>Library</OutputType>
<RootNamespace>Volo.CmsKit.Web</RootNamespace>
<GenerateEmbeddedFilesManifest>true</GenerateEmbeddedFilesManifest>
</PropertyGroup>
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback>
<IsPackable>true</IsPackable>
<OutputType>Library</OutputType>
<RootNamespace>Volo.CmsKit.Web</RootNamespace>
<GenerateEmbeddedFilesManifest>true</GenerateEmbeddedFilesManifest>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared\Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.csproj" />
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.AutoMapper\Volo.Abp.AutoMapper.csproj" />
<ProjectReference Include="..\Volo.CmsKit.Common.Application.Contracts\Volo.CmsKit.Common.Application.Contracts.csproj" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared\Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.csproj" />
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.AutoMapper\Volo.Abp.AutoMapper.csproj" />
<ProjectReference Include="..\Volo.CmsKit.Common.Application.Contracts\Volo.CmsKit.Common.Application.Contracts.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.FileProviders.Embedded" Version="6.0.5" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.FileProviders.Embedded" Version="6.0.5" />
<PackageReference Include="Markdig.Signed" Version="0.26.0" />
<PackageReference Include="HtmlSanitizer" Version="5.0.331" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="wwwroot\**\*.*" />
<Content Remove="wwwroot\**\*.*" />
<EmbeddedResource Include="Pages\**\*.css" />
<Content Remove="Pages\**\*.css" />
<EmbeddedResource Include="Pages\**\*.js" />
<Content Remove="Pages\**\*.js" />
<EmbeddedResource Include="Components\**\*.js" />
<EmbeddedResource Include="Components\**\*.css" />
<Content Remove="Components\**\*.js" />
<Content Remove="Components\**\*.css" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="wwwroot\**\*.*" />
<Content Remove="wwwroot\**\*.*" />
<EmbeddedResource Include="Pages\**\*.css" />
<Content Remove="Pages\**\*.css" />
<EmbeddedResource Include="Pages\**\*.js" />
<Content Remove="Pages\**\*.js" />
<EmbeddedResource Include="Components\**\*.js" />
<EmbeddedResource Include="Components\**\*.css" />
<Content Remove="Components\**\*.js" />
<Content Remove="Components\**\*.css" />
</ItemGroup>
</Project>

28
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();
}
}

10
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<PagedResultDto<BlogPostPublicDto>> GetListAsync([NotNull] string blogSlug, BlogPostGetListInput input);
Task<PagedResultDto<BlogPostCommonDto>> GetListAsync([NotNull] string blogSlug, BlogPostGetListInput input);
Task<BlogPostPublicDto> GetAsync([NotNull] string blogSlug, [NotNull] string blogPostSlug);
Task<BlogPostCommonDto> GetAsync([NotNull] string blogSlug, [NotNull] string blogPostSlug);
Task<PagedResultDto<CmsUserDto>> GetAuthorsHasBlogPostsAsync(BlogPostFilteredPagedAndSortedResultRequestDto input);

1
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;

10
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<BlogPostPublicDto> GetAsync(
public virtual async Task<BlogPostCommonDto> 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, BlogPostPublicDto>(blogPost);
var blogPostDto = ObjectMapper.Map<BlogPost, BlogPostCommonDto>(blogPost);
blogPostDto.ContentFragments = await ContentParser.ParseAsync(blogPost.Content);
return blogPostDto;
}
public virtual async Task<PagedResultDto<BlogPostPublicDto>> GetListAsync([NotNull] string blogSlug, BlogPostGetListInput input)
public virtual async Task<PagedResultDto<BlogPostCommonDto>> 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<BlogPostPublicDto>(
return new PagedResultDto<BlogPostCommonDto>(
await BlogPostRepository.GetCountAsync(blogId: blog.Id, tagId: input.TagId,
statusFilter: BlogPostStatus.Published, authorId: input.AuthorId),
ObjectMapper.Map<List<BlogPost>, List<BlogPostPublicDto>>(blogPosts));
ObjectMapper.Map<List<BlogPost>, List<BlogPostCommonDto>>(blogPosts));
}
public virtual async Task<PagedResultDto<CmsUserDto>> GetAuthorsHasBlogPostsAsync(BlogPostFilteredPagedAndSortedResultRequestDto input)

4
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<Page, PageDto>()
.Ignore(x => x.ContentFragments);
CreateMap<BlogPost, BlogPostPublicDto>()
CreateMap<BlogPost, BlogPostCommonDto>()
.Ignore(x => x.ContentFragments);
CreateMap<MenuItem, MenuItemDto>();

12
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>, IBlogPostPublicAppService
{
public virtual async Task<BlogPostPublicDto> GetAsync(string blogSlug, string blogPostSlug)
public virtual async Task<BlogPostCommonDto> GetAsync(string blogSlug, string blogPostSlug)
{
return await RequestAsync<BlogPostPublicDto>(nameof(GetAsync), new ClientProxyRequestTypeValue
return await RequestAsync<BlogPostCommonDto>(nameof(GetAsync), new ClientProxyRequestTypeValue
{
{ typeof(string), blogSlug },
{ typeof(string), blogPostSlug }
});
}
public virtual async Task<PagedResultDto<BlogPostPublicDto>> GetListAsync(string blogSlug, BlogPostGetListInput input)
public virtual async Task<PagedResultDto<BlogPostCommonDto>> GetListAsync(string blogSlug, BlogPostGetListInput input)
{
return await RequestAsync<PagedResultDto<BlogPostPublicDto>>(nameof(GetListAsync), new ClientProxyRequestTypeValue
return await RequestAsync<PagedResultDto<BlogPostCommonDto>>(nameof(GetListAsync), new ClientProxyRequestTypeValue
{
{ typeof(string), blogSlug },
{ typeof(BlogPostGetListInput), input }

6
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;

63
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<Volo.CmsKit.Polls.ContentFragment>",
"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<Volo.CmsKit.Public.Blogs.BlogPostPublicDto>",
"typeSimple": "Volo.Abp.Application.Dtos.PagedResultDto<Volo.CmsKit.Public.Blogs.BlogPostPublicDto>"
"type": "Volo.Abp.Application.Dtos.PagedResultDto<Volo.CmsKit.Contents.BlogPostCommonDto>",
"typeSimple": "Volo.Abp.Application.Dtos.PagedResultDto<Volo.CmsKit.Contents.BlogPostCommonDto>"
},
"allowAnonymous": null,
"implementFrom": "Volo.CmsKit.Public.Blogs.IBlogPostPublicAppService"

11
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<BlogPostPublicDto> GetAsync(string blogSlug, string blogPostSlug)
public virtual Task<BlogPostCommonDto> GetAsync(string blogSlug, string blogPostSlug)
{
return BlogPostPublicAppService.GetAsync(blogSlug, blogPostSlug);
}
[HttpGet]
[Route("{blogSlug}")]
public virtual Task<PagedResultDto<BlogPostPublicDto>> GetListAsync(string blogSlug, BlogPostGetListInput input)
public virtual Task<PagedResultDto<BlogPostCommonDto>> GetListAsync(string blogSlug, BlogPostGetListInput input)
{
return BlogPostPublicAppService.GetListAsync(blogSlug, input);
}

1
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;

2
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;

90
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 @@
<abp-style src="/Pages/Public/CmsKit/Blogs/bootstrap-toc.css" />
</abp-abp-style-bundle>
}
<abp-abp-style-bundle>
<abp-style src="/Pages/Public/CmsKit/Blogs/blogPost.css" />
<abp-style type="typeof(HighlightJsStyleContributor)" />
</abp-abp-style-bundle>
}
@section scripts{
@section scripts{
@if (isScrollIndexEnabled)
{
<abp-script-bundle>
@ -54,49 +55,39 @@
}
<div class="row">
<div @Html.Raw(isScrollIndexEnabled ? "class=\"col-md-10 col-sm-12\"" : "class=\"col-md-12\"")>
<abp-card class="mb-4">
<img src="/api/cms-kit/media/@Model.BlogPost.CoverImageMediaId" class="card-img-top" onerror="this.src='@dummyImageSource'" />
<abp-card-body>
<abp-row>
<div class="col-lg-8 col-md-10 mx-auto pb-4">
<h1 class="mt-lg-4 mt-md-3">@Model.BlogPost.Title</h1>
<p class="mb-lg-5 mb-md-3">
<a href="/blogs/@Model.BlogSlug?authorId=@Model.BlogPost.Author.Id">
<span class="font-weight-bold">@@@Model.BlogPost.Author?.UserName</span>
</a>
<small style="opacity:.65;">@Model.BlogPost.CreationTime</small>
</p>
@foreach (var contentFragment in Model.BlogPost.ContentFragments)
<div class="row">
<div @Html.Raw(isScrollIndexEnabled ? "class=\"col-md-10 col-sm-12\"" : "class=\"col-md-12\"")>
<abp-card class="mb-4">
<img src="/api/cms-kit/media/@Model.BlogPost.CoverImageMediaId" class="card-img-top" onerror="this.src='@dummyImageSource'" />
<abp-card-body>
<abp-row>
<div class="col-lg-8 col-md-10 mx-auto pb-4">
<h1 class="mt-lg-4 mt-md-3">@Model.BlogPost.Title</h1>
<p class="mb-lg-5 mb-md-3">
<a href="/blogs/@Model.BlogSlug?authorId=@Model.BlogPost.Author.Id">
<span class="font-weight-bold">@@@Model.BlogPost.Author?.UserName</span>
</a>
<small style="opacity:.65;">@Model.BlogPost.CreationTime</small>
</p>
@await Component.InvokeAsync("ContentFragment", new { contentDto = Model.BlogPost })
<p class="mb-3">
@if (Model.BlogPost.LastModificationTime != null)
{
if (contentFragment.Type == ContentConsts.Markdown)
{
@Html.Raw(await MarkdownRenderer.RenderAsync(contentFragment.GetProperty<string>("Content")))
}
else if (contentFragment.Type == ContentConsts.Widget)
{
@await Component.InvokeAsync(contentFragment.GetProperty<string>("Type"), contentFragment.ExtraProperties.ConvertToDynamicObject())
}
<small style="opacity:.65;">@L["LastModification"].Value : @Model.BlogPost.LastModificationTime</small>
}
<p class="mb-3">
@if (Model.BlogPost.LastModificationTime != null)
{
<small style="opacity:.65;">@L["LastModification"].Value : @Model.BlogPost.LastModificationTime</small>
}
</p>
<hr />
</p>
<hr />
@if (GlobalFeatureManager.Instance.IsEnabled<TagsFeature>())
@if (GlobalFeatureManager.Instance.IsEnabled<TagsFeature>())
{
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}}"
})
}
}
</div>
@ -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()
})
}
}
</abp-column>
@ -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()
})
}
}
</abp-column>
@ -133,6 +124,7 @@
</abp-card-body>
</abp-card>
</div>
@if (isScrollIndexEnabled)
{
<div class="col-md-2 d-sm-none d-md-block">
@ -140,7 +132,7 @@
<h5>@L["InThisDocument"]</h5>
<nav id="blog-post-sticky-index" class="navbar index-scroll pt-0">
</nav>
<div class="row">
<div class="col p-0 py-3">
<a href="#" class="scroll-top-btn">

3
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; }

10
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<BlogPostPublicDto> Blogs { get; private set; }
public PagedResultDto<BlogPostCommonDto> Blogs { get; private set; }
public PagerModel PagerModel => new PagerModel(Blogs.TotalCount, Blogs.Items.Count, CurrentPage, PageSize, Request.Path.ToString());

18
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{
<abp-style src="/Pages/Public/CmsKit/Pages/index.css" />
@ -30,18 +25,7 @@
<abp-card>
<abp-card-body>
@foreach (ContentFragment contentFragment in Model.PageDto.ContentFragments)
{
if (contentFragment.Type == ContentConsts.Markdown)
{
@Html.Raw(await MarkdownRenderer.RenderAsync(contentFragment.GetProperty<string>("Content")))
}
else if (contentFragment.Type == ContentConsts.Widget)
{
@await Component.InvokeAsync(contentFragment.GetProperty<string>("Type"), contentFragment.ExtraProperties.ConvertToDynamicObject())
}
}
@await Component.InvokeAsync("ContentFragment", new { contentDto = Model.PageDto })
</abp-card-body>
</abp-card>

5
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;
}

Loading…
Cancel
Save