Umbraco.Community.BlockPreview
1.1.2
See the version list below for details.
dotnet add package Umbraco.Community.BlockPreview --version 1.1.2
NuGet\Install-Package Umbraco.Community.BlockPreview -Version 1.1.2
<PackageReference Include="Umbraco.Community.BlockPreview" Version="1.1.2" />
paket add Umbraco.Community.BlockPreview --version 1.1.2
#r "nuget: Umbraco.Community.BlockPreview, 1.1.2"
// Install Umbraco.Community.BlockPreview as a Cake Addin #addin nuget:?package=Umbraco.Community.BlockPreview&version=1.1.2 // Install Umbraco.Community.BlockPreview as a Cake Tool #tool nuget:?package=Umbraco.Community.BlockPreview&version=1.1.2
Umbraco.Community.BlockPreview
Umbraco.Community.BlockPreview enables easy to use rich HTML backoffice previews for the Umbraco Block List and Block Grid editors.
Installation
The Umbraco 10.4+ version of this package is available via NuGet.
To install the package, you can use either .NET CLI:
dotnet add package Umbraco.Community.BlockPreview --version 1.1.2
or the older NuGet Package Manager:
Install-Package Umbraco.Community.BlockPreview -Version 1.1.2
Usage
This package installs a custom Angular preview for both the Block List and Block Grid editors in the backoffice.
When setting up a block to be part of the List or Grid, setting the 'Custom View' property to block-preview.html
will generate preview HTML based on the respective partial view found in /Views/Partials/blocklist/Components
or /Views/Partials/blockgrid/Components
.
How to select the custom views when creating a Block List/Grid:
Before and after of how components look within the Block Grid:
Grid-specific setup
When using the new Block Grid, replace the references below in your Grid template partial views
Default Umbraco usage | BlockPreview usage |
---|---|
@await Html.GetBlockGridItemAreasHtmlAsync(Model) | @await Html.GetPreviewBlockGridItemAreasHtmlAsync(Model) |
@await Html.GetBlockGridItemAreaHtmlAsync(Model) | @await Html.GetPreviewBlockGridItemAreaHtmlAsync(Model) |
@await Html.GetBlockGridItemsHtmlAsync(Model) | @await Html.GetPreviewBlockGridItemsHtmlAsync(Model) |
All of these extensions can be found in the namespace Umbraco.Community.BlockPreview.Extensions
. This ensures that the grid editors correctly load in the back office.
Preview mode
This package adds an IsBlockPreviewRequest()
extension to HttpContext.Request
, similar to IsBackOfficeRequest()
and IsFrontEndRequest()
so you can add custom code to your views that only appears in the back office.
For example:
@using Umbraco.Community.BlockPreview.Extensions
@inherits UmbracoViewPage<BlockGridItem>
@if (Context.Request.IsBlockPreviewRequest())
{
<p>This content will only be shown to content editors in the back office!</p>
}
Credits
This package is entirely based on the amazing work done by Dave Woestenborghs for 24days in Umbraco 2021. His code has been extended to support the new Block Grid editor in v10.4/v11 and turned into this package.
Matthew Wise also wrote a great article for 24days in Umbraco 2022 which added the ability to surface ViewComponents
and has allowed his code to be contributed.
License
Copyright © 2022-2023 Rick Butterfield, and other contributors.
Licensed under the MIT License.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net6.0
- Umbraco.Cms.Web.BackOffice (>= 10.4.0 && < 11.0.0)
- Umbraco.Cms.Web.Common (>= 10.4.0 && < 11.0.0)
- Umbraco.Cms.Web.Website (>= 10.4.0 && < 11.0.0)
-
net7.0
- Umbraco.Cms.Web.BackOffice (>= 11.0.0 && < 12.0.0)
- Umbraco.Cms.Web.Common (>= 11.0.0 && < 12.0.0)
- Umbraco.Cms.Web.Website (>= 11.0.0 && < 12.0.0)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on Umbraco.Community.BlockPreview:
Package | Downloads |
---|---|
Our.Umbraco.BlockPreview
Easy to use rich HTML backoffice previews for the Umbraco Block List and Block Grid editors |
|
Our.Community.CustomForm
Custom forms add-on for UmBootstrap |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated | |
---|---|---|---|
3.0.0 | 250 | 11/14/2024 | |
2.0.4 | 643 | 11/5/2024 | |
2.0.3 | 202 | 10/30/2024 | |
2.0.2 | 1,780 | 8/28/2024 | |
2.0.1 | 229 | 8/22/2024 | |
2.0.0 | 401 | 8/22/2024 | |
2.0.0-rc2 | 116 | 8/8/2024 | |
2.0.0-rc1 | 80 | 8/6/2024 | |
2.0.0-alpha007 | 76 | 8/6/2024 | |
2.0.0-alpha006 | 60 | 8/2/2024 | |
2.0.0-alpha005 | 53 | 8/2/2024 | |
1.10.5 | 2,050 | 10/30/2024 | |
1.10.4 | 3,636 | 9/13/2024 | |
1.10.3 | 2,000 | 8/29/2024 | |
1.10.2 | 298 | 8/28/2024 | |
1.10.1 | 345 | 8/22/2024 | |
1.10.0 | 167 | 8/22/2024 | |
1.9.1 | 1,438 | 8/7/2024 | |
1.9.0 | 101 | 8/7/2024 | |
1.8.4 | 15,090 | 4/23/2024 | |
1.8.3 | 5,024 | 3/25/2024 | |
1.8.2 | 2,394 | 3/15/2024 | |
1.8.1 | 163 | 3/14/2024 | |
1.8.0 | 14,655 | 12/15/2023 | |
1.7.1 | 8,295 | 9/18/2023 | |
1.7.0 | 409 | 9/15/2023 | |
1.6.1 | 2,013 | 9/2/2023 | |
1.6.0 | 214 | 9/1/2023 | |
1.5.0 | 1,127 | 8/18/2023 | |
1.4.1 | 3,484 | 6/30/2023 | |
1.4.0 | 231 | 6/29/2023 | |
1.3.1 | 315 | 6/26/2023 | |
1.3.0 | 599 | 6/20/2023 | |
1.2.3 | 1,488 | 5/24/2023 | |
1.2.2 | 233 | 5/24/2023 | |
1.2.1 | 1,406 | 4/12/2023 | |
1.2.0 | 289 | 4/12/2023 | |
1.1.2 | 942 | 3/14/2023 | |
1.1.1 | 385 | 3/7/2023 | |
1.1.0 | 412 | 2/25/2023 |