* insert umb rte block web component in rte * First stab at moving the RTE markup to a nested "markup" property in the property value. * initial work * only rewrite markup * transform RTE into component * parse scope in grid.rte * revert use a fallback instead * block insertion and sync in place * block picker partly impl * remove test of old controller * remove test of old controller * block with block data * proper block with api connection * remove log * styling * Persist blocks data (still a temporary solution) * styling allows for interaction * block actions * tinyMCE styling * paste feature * prevalue display Inline toggle * inline mode in RTE * todo note * fixes wording * preparation for editor communication * remove val-server-match for now * clean up blocks that does not belong in markup * remove blocks not used in the markup * liveEditing * displayAsBlock formatting * clean up * TODO note * Serverside handling for RTE blocks (incl. refactor of Block List and Block Grid) * ensure rich text loads after block editor * trigger resize on block init * Handle RTE blocks output in Delivery API * sanitize ng classes * simplify calls to init blocks * move sanitisation * make validation work * only warn when missing one * clean up * remove validation border as it does not work * more clean up * add unsupported block entry editor * Revert breaking functionality for Block List and Grid * prevent re-inits of blocks * make sure delete blocks triggers an update * Refactor RichTextPropertyIndexValueFactory to index values from blocks + clean up RichTextPropertyEditor dependencies * first working cursor solution * inline element approach * Handle both inline and block level blocks * Fix the RTE block parser regex so it handles multiple inline blocks. * Fix reference and tags tracking, add tests, make the editor backwards compatible and make deploy happy * Use RichTextPropertyEditorHelper serialization in tests * Ensure correct model in Block Grid value converter (incl unit test to prove it) * do not include umbblockpicker in grid * make blocks the new default, instead of macros * only send value of body from DOMParser * Blocks of deleted ElementTypes shows unsupported * do not edit a unsupported block * remove trying to be smart on the init * fix missing culture issue * set dirty * alert when no blocks * Revert "make blocks the new default, instead of macros" This reverts commit 283e8aa473fdfde075197d34aa47e35dfc64a8ae. --------- Co-authored-by: kjac <kja@umbraco.dk>
130 lines
4.3 KiB
C#
130 lines
4.3 KiB
C#
// Copyright (c) Umbraco.
|
|
// See LICENSE for more details.
|
|
|
|
using System.Runtime.Serialization;
|
|
using Umbraco.Cms.Core.Models.PublishedContent;
|
|
|
|
namespace Umbraco.Cms.Core.Models.Blocks;
|
|
|
|
/// <summary>
|
|
/// Represents a layout item for the Block List editor.
|
|
/// </summary>
|
|
/// <seealso cref="IBlockReference{IPublishedElement}" />
|
|
[DataContract(Name = "block", Namespace = "")]
|
|
public class RichTextBlockItem : IBlockReference<IPublishedElement, IPublishedElement>
|
|
{
|
|
/// <summary>
|
|
/// Initializes a new instance of the <see cref="RichTextBlockItem" /> class.
|
|
/// </summary>
|
|
/// <param name="contentUdi">The content UDI.</param>
|
|
/// <param name="content">The content.</param>
|
|
/// <param name="settingsUdi">The settings UDI.</param>
|
|
/// <param name="settings">The settings.</param>
|
|
/// <exception cref="System.ArgumentNullException">
|
|
/// contentUdi
|
|
/// or
|
|
/// content
|
|
/// </exception>
|
|
public RichTextBlockItem(Udi contentUdi, IPublishedElement content, Udi settingsUdi, IPublishedElement settings)
|
|
{
|
|
ContentUdi = contentUdi ?? throw new ArgumentNullException(nameof(contentUdi));
|
|
Content = content ?? throw new ArgumentNullException(nameof(content));
|
|
SettingsUdi = settingsUdi;
|
|
Settings = settings;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Gets the content.
|
|
/// </summary>
|
|
/// <value>
|
|
/// The content.
|
|
/// </value>
|
|
[DataMember(Name = "content")]
|
|
public IPublishedElement Content { get; }
|
|
|
|
/// <summary>
|
|
/// Gets the settings UDI.
|
|
/// </summary>
|
|
/// <value>
|
|
/// The settings UDI.
|
|
/// </value>
|
|
[DataMember(Name = "settingsUdi")]
|
|
public Udi SettingsUdi { get; }
|
|
|
|
/// <summary>
|
|
/// Gets the content UDI.
|
|
/// </summary>
|
|
/// <value>
|
|
/// The content UDI.
|
|
/// </value>
|
|
[DataMember(Name = "contentUdi")]
|
|
public Udi ContentUdi { get; }
|
|
|
|
/// <summary>
|
|
/// Gets the settings.
|
|
/// </summary>
|
|
/// <value>
|
|
/// The settings.
|
|
/// </value>
|
|
[DataMember(Name = "settings")]
|
|
public IPublishedElement Settings { get; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// Represents a layout item with a generic content type for the Block List editor.
|
|
/// </summary>
|
|
/// <typeparam name="T">The type of the content.</typeparam>
|
|
/// <seealso cref="IBlockReference{IPublishedElement}" />
|
|
public class RichTextBlockItem<T> : RichTextBlockItem
|
|
where T : IPublishedElement
|
|
{
|
|
/// <summary>
|
|
/// Initializes a new instance of the <see cref="RichTextBlockItem{T}" /> class.
|
|
/// </summary>
|
|
/// <param name="contentUdi">The content UDI.</param>
|
|
/// <param name="content">The content.</param>
|
|
/// <param name="settingsUdi">The settings UDI.</param>
|
|
/// <param name="settings">The settings.</param>
|
|
public RichTextBlockItem(Udi contentUdi, T content, Udi settingsUdi, IPublishedElement settings)
|
|
: base(contentUdi, content, settingsUdi, settings) =>
|
|
Content = content;
|
|
|
|
/// <summary>
|
|
/// Gets the content.
|
|
/// </summary>
|
|
/// <value>
|
|
/// The content.
|
|
/// </value>
|
|
public new T Content { get; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// Represents a layout item with generic content and settings types for the Block List editor.
|
|
/// </summary>
|
|
/// <typeparam name="TContent">The type of the content.</typeparam>
|
|
/// <typeparam name="TSettings">The type of the settings.</typeparam>
|
|
/// <seealso cref="IBlockReference{IPublishedElement}" />
|
|
public class RichTextBlockItem<TContent, TSettings> : RichTextBlockItem<TContent>
|
|
where TContent : IPublishedElement
|
|
where TSettings : IPublishedElement
|
|
{
|
|
/// <summary>
|
|
/// Initializes a new instance of the <see cref="RichTextBlockItem{TContent, TSettings}" /> class.
|
|
/// </summary>
|
|
/// <param name="contentUdi">The content udi.</param>
|
|
/// <param name="content">The content.</param>
|
|
/// <param name="settingsUdi">The settings udi.</param>
|
|
/// <param name="settings">The settings.</param>
|
|
public RichTextBlockItem(Udi contentUdi, TContent content, Udi settingsUdi, TSettings settings)
|
|
: base(contentUdi, content, settingsUdi, settings) =>
|
|
Settings = settings;
|
|
|
|
/// <summary>
|
|
/// Gets the settings.
|
|
/// </summary>
|
|
/// <value>
|
|
/// The settings.
|
|
/// </value>
|
|
public new TSettings Settings { get; }
|
|
}
|