This repository was archived by the owner on Feb 10, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
src/Our.Umbraco.DocTypeGridEditor Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change 5
5
using Umbraco . Core . Events ;
6
6
using Umbraco . Core . Models ;
7
7
using Umbraco . Core . Services ;
8
+ using Umbraco . Web . Routing ;
8
9
9
10
namespace Our . Umbraco . DocTypeGridEditor
10
11
{
@@ -24,6 +25,18 @@ protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplica
24
25
{
25
26
DataTypeService . Saved += ExpireDataTypeCache ;
26
27
ContentTypeService . SavedContentType += ExpireContentTypeCache ;
28
+ PublishedContentRequest . Prepared += PublishedContentRequest_Prepared ;
29
+ }
30
+
31
+ private void PublishedContentRequest_Prepared ( object sender , EventArgs e )
32
+ {
33
+ var request = sender as PublishedContentRequest ;
34
+ // Check if it's a dtgePreview request and is set to redirect.
35
+ // If so reset the redirect url to an empty string to stop the redirect happening in preview mode.
36
+ if ( request . Uri . Query . Contains ( "dtgePreview" ) && request . IsRedirect )
37
+ {
38
+ request . SetRedirect ( string . Empty ) ;
39
+ }
27
40
}
28
41
29
42
private void ExpireDataTypeCache ( IDataTypeService sender , SaveEventArgs < IDataTypeDefinition > e )
You can’t perform that action at this time.
0 commit comments