init commit of strongly typed models for implementations of a block editor and the upcoming block list editor
This commit is contained in:
16
src/Umbraco.Core/Models/Blocks/BlockEditorModel.cs
Normal file
16
src/Umbraco.Core/Models/Blocks/BlockEditorModel.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using System.Collections.Generic;
|
||||
using Umbraco.Core.Models.PublishedContent;
|
||||
|
||||
namespace Umbraco.Core.Models.Blocks
|
||||
{
|
||||
/// <summary>
|
||||
/// The base class for any strongly typed model for a Block editor implementation
|
||||
/// </summary>
|
||||
public abstract class BlockEditorModel
|
||||
{
|
||||
/// <summary>
|
||||
/// The data items of the Block List editor
|
||||
/// </summary>
|
||||
public IEnumerable<IPublishedElement> Data { get; }
|
||||
}
|
||||
}
|
||||
20
src/Umbraco.Core/Models/Blocks/BlockListLayoutReference.cs
Normal file
20
src/Umbraco.Core/Models/Blocks/BlockListLayoutReference.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using Umbraco.Core.Models.PublishedContent;
|
||||
|
||||
namespace Umbraco.Core.Models.Blocks
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a layout item for the Block List editor
|
||||
/// </summary>
|
||||
public class BlockListLayoutReference : IBlockElement<IPublishedElement>
|
||||
{
|
||||
public BlockListLayoutReference(Udi udi, IPublishedElement settings)
|
||||
{
|
||||
Udi = udi ?? throw new ArgumentNullException(nameof(udi));
|
||||
Settings = settings ?? throw new ArgumentNullException(nameof(settings));
|
||||
}
|
||||
|
||||
public Udi Udi { get; }
|
||||
public IPublishedElement Settings { get; }
|
||||
}
|
||||
}
|
||||
17
src/Umbraco.Core/Models/Blocks/BlockListModel.cs
Normal file
17
src/Umbraco.Core/Models/Blocks/BlockListModel.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Umbraco.Core.Models.Blocks
|
||||
{
|
||||
/// <summary>
|
||||
/// The strongly typed model for the Block List editor
|
||||
/// </summary>
|
||||
public class BlockListModel : BlockEditorModel
|
||||
{
|
||||
/// <summary>
|
||||
/// The layout items of the Block List editor
|
||||
/// </summary>
|
||||
public IEnumerable<BlockListLayoutReference> Layout { get; }
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
18
src/Umbraco.Core/Models/Blocks/IBlockElement.cs
Normal file
18
src/Umbraco.Core/Models/Blocks/IBlockElement.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
namespace Umbraco.Core.Models.Blocks
|
||||
{
|
||||
// TODO: IBlockElement doesn't make sense, this is a reference to an actual element with some settings
|
||||
// and always has to do with the "Layout", should possibly be called IBlockReference or IBlockLayout or IBlockLayoutReference
|
||||
|
||||
/// <summary>
|
||||
/// Represents a data item for a Block editor implementation
|
||||
/// </summary>
|
||||
/// <typeparam name="TSettings"></typeparam>
|
||||
/// <remarks>
|
||||
/// see: https://github.com/umbraco/rfcs/blob/907f3758cf59a7b6781296a60d57d537b3b60b8c/cms/0011-block-data-structure.md#strongly-typed
|
||||
/// </remarks>
|
||||
public interface IBlockElement<TSettings>
|
||||
{
|
||||
Udi Udi { get; }
|
||||
TSettings Settings { get; }
|
||||
}
|
||||
}
|
||||
@@ -129,6 +129,10 @@
|
||||
-->
|
||||
<Compile Include="AssemblyExtensions.cs" />
|
||||
<Compile Include="Migrations\Upgrade\V_8_6_0\AddMainDomLock.cs" />
|
||||
<Compile Include="Models\Blocks\BlockEditorModel.cs" />
|
||||
<Compile Include="Models\Blocks\BlockListLayoutReference.cs" />
|
||||
<Compile Include="Models\Blocks\BlockListModel.cs" />
|
||||
<Compile Include="Models\Blocks\IBlockElement.cs" />
|
||||
<Compile Include="Runtime\IMainDomLock.cs" />
|
||||
<Compile Include="Runtime\MainDomSemaphoreLock.cs" />
|
||||
<Compile Include="Runtime\SqlMainDomLock.cs" />
|
||||
|
||||
Reference in New Issue
Block a user