umbraco-doc-type-grid-editor
umbraco-doc-type-grid-editor copied to clipboard
GetPreviewMarkup (DocTypeGridEditorApiController.cs) doesnt set InPreviewMode = true on UmbracoContext
Hi This is more of a nice to have request and question if it would be possible at all.
It would be nice to have Umbraco.Web.Composing.Current.UmbracoContext.InPreviewMode to be "true" when viewing the umbraco grid with doctype editors within the edit mode on a page & then being able to handle the partial view differently. Since i only want a minor if statement in case the doctype editor element is in preview, I dont want to have a completely separate view with potential duplicated code in Partials just for that minor if statement.
Right now InPreviewMode returns "false" when seeing doctype grid editors in edit mode, but pressing preview you of course get InPreviewMode = true. This is also true for the route value: "dtgePreview", so I cant use that directly instead and the IsFrontEndUmbracoRequest is also true even tho Im in edit mode looking at my doctype editor.
In my mind the doctype grid editors should have an UmbracoContext with InPreviewMode = true when viewing them in the grid from edit mode. Especially since the method is called GetPreviewMarkup() in DocTypeGridEditorApiController.
I saw in the old commits that you tried it but for a fix related to Vorto : https://github.com/skttl/umbraco-doc-type-grid-editor/commit/0ebaf166c4233274b6f43d6897ede5467be9f8b9 But in the Vorto issue https://github.com/skttl/umbraco-doc-type-grid-editor/issues/117 it is said that setting the InPreviewMode caused other issues, but not what issues it caused.
Is there a way to get an UmbracoContext with InPreviewMode = true through the GetPreviewMarkup() or if some route value could be set instead?
perhaps have anyone already solved this in another way and I'm just missing something?
If anyone wants to take a stab at this, feel free to do it - for know the workaround with dtgePreview is good enough for me.