diff --git a/README.md b/README.md index 693bb5e..12d89bf 100644 --- a/README.md +++ b/README.md @@ -13,13 +13,13 @@ The Umbraco 10.4+ version of this package is [available via NuGet](https://www.n To install the package, you can use either .NET CLI: ``` -dotnet add package Umbraco.Community.BlockPreview --version 1.2.2 +dotnet add package Umbraco.Community.BlockPreview --version 1.2.3 ``` or the older NuGet Package Manager: ``` -Install-Package Umbraco.Community.BlockPreview -Version 1.2.2 +Install-Package Umbraco.Community.BlockPreview -Version 1.2.3 ``` ## Setup diff --git a/releases/nuget/Our.Umbraco.BlockPreview.1.2.3.nupkg b/releases/nuget/Our.Umbraco.BlockPreview.1.2.3.nupkg new file mode 100644 index 0000000..798fec8 Binary files /dev/null and b/releases/nuget/Our.Umbraco.BlockPreview.1.2.3.nupkg differ diff --git a/releases/nuget/Umbraco.Community.BlockPreview.1.2.3.nupkg b/releases/nuget/Umbraco.Community.BlockPreview.1.2.3.nupkg new file mode 100644 index 0000000..bf407bb Binary files /dev/null and b/releases/nuget/Umbraco.Community.BlockPreview.1.2.3.nupkg differ diff --git a/src-old/App_Plugins/Umbraco.Community.BlockPreview/js/controllers/block-preview.controller.js b/src-old/App_Plugins/Umbraco.Community.BlockPreview/js/controllers/block-preview.controller.js deleted file mode 100644 index 886110d..0000000 --- a/src-old/App_Plugins/Umbraco.Community.BlockPreview/js/controllers/block-preview.controller.js +++ /dev/null @@ -1,73 +0,0 @@ -angular.module('umbraco').controller('Umbraco.Community.BlockPreview.Controllers.BlockPreviewController', - ['$scope', '$sce', '$element', '$compile', '$timeout', 'editorState', 'Umbraco.Community.BlockPreview.Resources.PreviewResource', 'blockEditorService', - function ($scope, $sce, $element, $compile, $timeout, editorState, previewResource, blockEditorService) { - var active = editorState.getCurrent().variants.find(function (v) { - return v.active; - }); - - if (active !== null) { - if (active.language !== null) { - $scope.language = active.language.culture; - } - } - - $scope.id = editorState.getCurrent().id; - $scope.loading = true; - $scope.markup = $sce.trustAsHtml('Loading preview'); - - function loadPreview(content, settings) { - $scope.markup = $sce.trustAsHtml('Loading preview'); - $scope.loading = true; - - var formattedBlockData = { - layout: $scope.block.layout, - contentData: [content ?? $scope.block.data], - settingsData: [settings ?? $scope.block.settingsData] - }; - - previewResource.getPreview(formattedBlockData, $scope.id, $scope.model.constructor.name == 'BlockGridBlockController', $scope.language).then(function (data) { - $scope.markup = $sce.trustAsHtml(data); - $scope.loading = false; - }); - } - - loadPreview($scope.block.data, $scope.block.settingsData); - - var timeoutPromise; - - $scope.$watch('block.data', function (newValue, oldValue) { - if (newValue !== oldValue) { - $timeout.cancel(timeoutPromise); - - timeoutPromise = $timeout(function () { //Set timeout - loadPreview(newValue, null); - }, 500); - } - }, true); - - $scope.$watch('block.settingsData', function (newValue, oldValue) { - if (newValue !== oldValue) { - $timeout.cancel(timeoutPromise); - - timeoutPromise = $timeout(function () { //Set timeout - loadPreview(null, newValue); - }, 500); - } - }, true); - - $scope.editBlock = function ($event, block) { - var target = $event.target; - var blockActions = target.closest('.umb-block-grid__block--actions'); - var areaCreate = target.closest('.umb-block-grid__create-button'); - - if (!blockActions && !areaCreate) { - block.edit(); - $event.preventDefault(); - $event.stopPropagation(); - $event.stopImmediatePropagation(); - $event.cancelBubble = true; - return; - } - } - } - ]); diff --git a/src-old/App_Plugins/Umbraco.Community.BlockPreview/js/directives/bind-compile.directive.js b/src-old/App_Plugins/Umbraco.Community.BlockPreview/js/directives/bind-compile.directive.js deleted file mode 100644 index 0645193..0000000 --- a/src-old/App_Plugins/Umbraco.Community.BlockPreview/js/directives/bind-compile.directive.js +++ /dev/null @@ -1,25 +0,0 @@ -/* - * angular-bind-compile v0.1.0 - * https://github.com/emn178/angular-bind-compile - * - * Copyright 2014, emn178@gmail.com - * - * Licensed under the MIT license: - * http://www.opensource.org/licenses/MIT - */ -angular.module('umbraco.filters') - .directive('ngBindCompile', ['$sce', '$compile', function ($sce, $compile) { - return { - restrict: 'A', - compile: function (tElement, tAttrs) { - return function (scope, element, attrs) { - scope.$watch(function () { - return $sce.getTrustedHtml(scope.$eval(attrs.ngBindCompile)); - }, function (value) { - element.html(value); - $compile(element.contents())(scope); - }); - }; - } - }; - }]); \ No newline at end of file diff --git a/src-old/App_Plugins/Umbraco.Community.BlockPreview/js/directives/published-check.directive.js b/src-old/App_Plugins/Umbraco.Community.BlockPreview/js/directives/published-check.directive.js deleted file mode 100644 index 97be5ac..0000000 --- a/src-old/App_Plugins/Umbraco.Community.BlockPreview/js/directives/published-check.directive.js +++ /dev/null @@ -1,50 +0,0 @@ -angular.module('umbraco.filters') - .directive('publicationCheck', [function () { - - function setStyle(scope, element) { - if (!scope.settings) { - element[0].style.opacity = 1; - return; - } - if (scope.settings.hideBlock === '1') { - element[0].style.opacity = 0.25; - return; - } - - if (scope.settings.startDate === '' && scope.settings.endDate === '') { - element[0].style.opacity = 1; - return; - } - - if (Date.parse(scope.settings.startDate) > new Date()) { - element[0].style.opacity = 0.25; - return; - } - - if (Date.parse(scope.settings.endDate) < new Date()) { - element[0].style.opacity = 0.25; - return; - } - - element[0].style.opacity = 1; - } - - function link(scope, element, attrs) { - - setStyle(scope, element); - - scope.$watch('settings', function (newValue, oldValue) { - if (newValue) - setStyle(scope, element); - }, true); - - } - - return { - restrict: 'A', - scope: { - 'settings': '=', - }, - link: link, - }; - }]); \ No newline at end of file diff --git a/src-old/App_Plugins/Umbraco.Community.BlockPreview/js/resources/preview.resource.js b/src-old/App_Plugins/Umbraco.Community.BlockPreview/js/resources/preview.resource.js deleted file mode 100644 index 12fc44f..0000000 --- a/src-old/App_Plugins/Umbraco.Community.BlockPreview/js/resources/preview.resource.js +++ /dev/null @@ -1,26 +0,0 @@ -(function () { - 'use strict'; - - function previewResource($http, umbRequestHelper) { - - var apiUrl = Umbraco.Sys.ServerVariables.UmbracoCommunityBlockPreview.PreviewApi; - - var resource = { - getPreview: getPreview, - }; - - return resource; - - function getPreview(data, pageId, isGrid, culture) { - culture = culture || ''; - - return umbRequestHelper.resourcePromise( - $http.post(apiUrl + '?pageId=' + pageId + '&isGrid=' + isGrid + '&culture=' + culture, data), - 'Failed getting block preview markup' - ); - }; - } - - angular.module('umbraco.resources').factory('Umbraco.Community.BlockPreview.Resources.PreviewResource', previewResource); - -})(); diff --git a/src-old/App_Plugins/Umbraco.Community.BlockPreview/package.manifest b/src-old/App_Plugins/Umbraco.Community.BlockPreview/package.manifest deleted file mode 100644 index 361ade6..0000000 --- a/src-old/App_Plugins/Umbraco.Community.BlockPreview/package.manifest +++ /dev/null @@ -1,11 +0,0 @@ -{ - "name": "Umbraco.Community.BlockPreview", - "version": "1.1.1", - "allowPackageTelemetry": true, - "javascript": [ - "~/App_Plugins/Umbraco.Community.BlockPreview/js/resources/preview.resource.js", - "~/App_Plugins/Umbraco.Community.BlockPreview/js/directives/published-check.directive.js", - "~/App_Plugins/Umbraco.Community.BlockPreview/js/directives/bind-compile.directive.js", - "~/App_Plugins/Umbraco.Community.BlockPreview/js/controllers/block-preview.controller.js" - ] -} \ No newline at end of file diff --git a/src-old/App_Plugins/Umbraco.Community.BlockPreview/views/block-preview.html b/src-old/App_Plugins/Umbraco.Community.BlockPreview/views/block-preview.html deleted file mode 100644 index 85c5ff1..0000000 --- a/src-old/App_Plugins/Umbraco.Community.BlockPreview/views/block-preview.html +++ /dev/null @@ -1,8 +0,0 @@ -