This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class ArticlePageController : PageController<ArticlePage> | |
| { | |
| private readonly PreviewPageHelper _pageHelper; | |
| public ArticlePageController(PreviewPageHelper pageHelper) | |
| { | |
| _pageHelper = pageHelper; | |
| } | |
| public IActionResult Index(ArticlePage currentPage) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class PreviewPageHelper( | |
| IContentRepository repo, | |
| IContentVersionRepository versions, | |
| IContextModeResolver modes, | |
| IHttpContextAccessor http) | |
| { | |
| private bool IsDraftView | |
| { | |
| get | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using EPiServer.Shell.ObjectEditing.EditorDescriptors; | |
| namespace YourNameSpace.Business.Editor; | |
| [EditorDescriptorRegistration(TargetType = typeof(ContentArea))] | |
| public class ContentAreaWithStatusEditorDescriptor : EditorDescriptor | |
| { | |
| public ContentAreaWithStatusEditorDescriptor() | |
| { | |
| // Point to our custom Dojo widget |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| define([ | |
| "dojo/_base/declare", | |
| "epi-cms/contentediting/editors/ContentAreaEditor", | |
| "dojo/dom-class", | |
| "dojo/dom-construct", | |
| "dojo/request", | |
| "dojo/_base/lang" | |
| ], function (declare, ContentAreaEditor, domClass, domConstruct, request, lang) { | |
| // === Config === |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| services.AddSingleton<ContentAreaRenderer, PreviewDraftContentAreaRenderer>(); | |
| services.AddSingleton<IContentAreaLoader>(sp => | |
| new PreviewContentAreaLoader( | |
| sp.GetRequiredService<IContentRepository>(), | |
| sp.GetRequiredService<IContentVersionRepository>(), | |
| sp.GetRequiredService<IContextModeResolver>())); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| using System.Linq; | |
| using EPiServer; | |
| using EPiServer.Core; | |
| using EPiServer.DataAbstraction; | |
| using EPiServer.Web; | |
| namespace YourNamespace.Business.Rendering; | |
| public sealed class PreviewContentAreaLoader( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class PreviewDraftContentAreaRenderer(IContextModeResolver contextModeResolver, IHttpContextAccessor httpContextAccessor) : ContentAreaRenderer | |
| { | |
| // Treat Preview like Edit so renderer doesn't skip edit-time behavior | |
| private bool IsDraftView | |
| { | |
| get | |
| { | |
| var ctx = httpContextAccessor.HttpContext; | |
| var hasParam = ctx?.Request?.Query.TryGetValue("showdrafts", out var val) == true | |
| && val.ToString().Equals("true", StringComparison.OrdinalIgnoreCase); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System.Globalization; | |
| using System.Web; | |
| using EPiServer.Core.Routing; | |
| using EPiServer.Core.Routing.Pipeline; | |
| using EPiServer.Filters; | |
| using EPiServer.Framework.Cache; | |
| public class SitePageDataPartialRouter( | |
| IContentLoader contentLoader, | |
| ISynchronizedObjectInstanceCache cache) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using Alloy.Models.Media; | |
| using EPiServer.Core; | |
| using EPiServer.Core.Html.StringParsing; | |
| using EPiServer.ServiceLocation; | |
| using EPiServer.Web; | |
| using HtmlAgilityPack; | |
| public static class XhtmlExtensions | |
| { | |
| public static XhtmlString AdjustAltText(this XhtmlString xhtmlString) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class Singleton : Attribute | |
| { | |
| } |
NewerOlder