mirror of https://github.com/abpframework/abp.git
4 changed files with 76 additions and 0 deletions
@ -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); |
||||
|
} |
||||
@ -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); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,29 @@ |
|||||
|
using System.Collections.Generic; |
||||
|
using System.Threading.Tasks; |
||||
|
using Microsoft.AspNetCore.Mvc; |
||||
|
using Volo.Abp; |
||||
|
using Volo.Abp.GlobalFeatures; |
||||
|
using Volo.CmsKit.GlobalFeatures; |
||||
|
|
||||
|
namespace Volo.CmsKit.Contents; |
||||
|
|
||||
|
[RequiresGlobalFeature(typeof(PagesFeature))] |
||||
|
[RemoteService(Name = CmsKitCommonRemoteServiceConsts.RemoteServiceName)] |
||||
|
[Area(CmsKitCommonRemoteServiceConsts.ModuleName)] |
||||
|
[Route("api/cms-kit/contents")] |
||||
|
public class ContentController : CmsKitControllerBase, IContentAppService |
||||
|
{ |
||||
|
protected IContentAppService ContentAppService { get; } |
||||
|
|
||||
|
public ContentController(IContentAppService contentAppService) |
||||
|
{ |
||||
|
ContentAppService = contentAppService; |
||||
|
} |
||||
|
|
||||
|
[HttpGet] |
||||
|
[Route("{parse}")] |
||||
|
public async Task<List<ContentFragment>> ParseAsync(string content) |
||||
|
{ |
||||
|
return await ContentAppService.ParseAsync(content); |
||||
|
} |
||||
|
} |
||||
Loading…
Reference in new issue