Skip to content
This repository was archived by the owner on Feb 10, 2024. It is now read-only.

Commit 2c7ee41

Browse files
committed
Tweak for InPreviewMode fix
Moves the logic lower down, after querying the Content cache.
1 parent 0ebaf16 commit 2c7ee41

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/Our.Umbraco.DocTypeGridEditor/Web/Controllers/DocTypeGridEditorApiController.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,6 @@ public object GetDataTypePreValues(string dtdId)
9999
[HttpPost]
100100
public HttpResponseMessage GetPreviewMarkup([FromBody] PreviewData data, [FromUri] int pageId)
101101
{
102-
// Set DTGE's preview to be in "preview mode", (storing the original value in a temp variable for resetting it later).
103-
var inPreviewMode = UmbracoContext.InPreviewMode;
104-
UmbracoContext.InPreviewMode = true;
105-
106102
var page = default(IPublishedContent);
107103

108104
// If the page is new, then the ID will be zero
@@ -140,6 +136,10 @@ public HttpResponseMessage GetPreviewMarkup([FromBody] PreviewData data, [FromUr
140136
System.Threading.Thread.CurrentThread.CurrentUICulture = culture;
141137
}
142138

139+
// Set DTGE's preview to be in "preview mode", (storing the original value in a temp variable for resetting it later).
140+
var inPreviewMode = UmbracoContext.InPreviewMode;
141+
UmbracoContext.InPreviewMode = true;
142+
143143
// Get content node object
144144
var content = DocTypeGridEditorHelper.ConvertValueToContent(data.Id, data.ContentTypeAlias, data.Value);
145145

0 commit comments

Comments
 (0)