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

Commit 311e6fc

Browse files
Added support for previewCssFilePath and previewJsFilePath to allow injecting CSS / JS for previews
1 parent f7c5d5e commit 311e6fc

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed
132 Bytes
Binary file not shown.

Src/Our.Umbraco.DocTypeGridEditor/Web/UI/App_Plugins/DocTypeGridEditor/Config/grid.editors.config.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
"allowedDocTypes": [],
99
"enablePreview": true,
1010
"viewPath": "/Views/Partials/Grid/Editors/DocTypeGridEditor/",
11-
"previewViewPath": "/Views/Partials/Grid/Editors/DocTypeGridEditor/Previews/"
11+
"previewViewPath": "/Views/Partials/Grid/Editors/DocTypeGridEditor/Previews/",
12+
"previewCssFilePath": "/Views/Partials/Grid/Editors/DocTypeGridEditor/Previews/Css/dtge.css",
13+
"previewJsFilePath": "/Views/Partials/Grid/Editors/DocTypeGridEditor/Previews/Js/dtge.js"
1214
}
1315
}

Src/Our.Umbraco.DocTypeGridEditor/Web/UI/App_Plugins/DocTypeGridEditor/Js/doctypegrideditor.controllers.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@
44
"$rootScope",
55
"$timeout",
66
"$routeParams",
7+
'assetsService',
78
"Our.Umbraco.DocTypeGridEditor.Services.DocTypeDialogService",
89
"Our.Umbraco.DocTypeGridEditor.Resources.DocTypeGridEditorResources",
910

10-
function ($scope, $rootScope, $timeout, $routeParams, dtgeDialogService, dtgeResources) {
11+
function ($scope, $rootScope, $timeout, $routeParams, assetsService, dtgeDialogService, dtgeResources) {
1112

1213
$scope.title = "Click to insert item";
1314
$scope.icon = "icon-item-arrangement";
@@ -64,6 +65,18 @@
6465
value: {}
6566
});
6667

68+
// Load preview css / js files
69+
if ("enablePreview" in $scope.control.editor.config && $scope.control.editor.config.enablePreview)
70+
{
71+
if ("previewCssFilePath" in $scope.control.editor.config && $scope.control.editor.config.previewCssFilePath) {
72+
assetsService.loadCss($scope.control.editor.config.previewCssFilePath, $scope);
73+
};
74+
75+
if ("previewJsFilePath" in $scope.control.editor.config && $scope.control.editor.config.previewJsFilePath) {
76+
assetsService.loadJs($scope.control.editor.config.previewJsFilePath, $scope);
77+
}
78+
}
79+
6780
$timeout(function () {
6881
if ($scope.control.$initializing) {
6982
$scope.setDocType();

0 commit comments

Comments
 (0)