Save and Preview blank on second use #14052 (#14094)

This commit is contained in:
Dhanesh Kumar Mj
2023-04-21 14:57:08 +05:30
committed by GitHub
parent 2987dcb30e
commit 00eab03d50

View File

@@ -941,15 +941,13 @@
const openPreviewWindow = () => {
// Chromes popup blocker will kick in if a window is opened
// without the initial scoped request. This trick will fix that.
//
const previewWindow = $window.open('preview/?init=true', 'umbpreview');
const previewWindow = $window.open(`preview/?id=${content.id}${$scope.culture ? `&culture=${$scope.culture}` : ''}`, 'umbpreview');
previewWindow.addEventListener('load', () => {
previewWindow.location.href = previewWindow.document.URL;
});
// Build the correct path so both /#/ and #/ work.
let query = 'id=' + content.id;
if ($scope.culture) {
query += "#?culture=" + $scope.culture;
}
previewWindow.location.href = Umbraco.Sys.ServerVariables.umbracoSettings.umbracoPath + '/preview/?' + query;
}
//The user cannot save if they don't have access to do that, in which case we just want to preview