-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c136595
commit 11eee9d
Showing
6 changed files
with
21 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 11 additions & 13 deletions
24
Kentico.Kontent.Delivery/ContentItems/RichText/Blocks/InlineContentItem.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,30 @@ | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using System.Collections.Generic; | ||
using Kentico.Kontent.Delivery.Abstractions; | ||
using Newtonsoft.Json; | ||
|
||
namespace Kentico.Kontent.Delivery.ContentItems.RichText.Blocks | ||
{ | ||
/// <summary> | ||
/// Represents inline content item. IEnumerable is implemented so that Html.DisplayFor is automatically bridged to the underlying ContentItem property. | ||
/// </summary> | ||
internal class InlineContentItem : IInlineContentItem, IEnumerable<object> | ||
internal class InlineContentItem : List<object>, IInlineContentItem | ||
{ | ||
public object ContentItem | ||
{ | ||
get; | ||
get | ||
{ | ||
return this[0]; | ||
} | ||
} | ||
|
||
public InlineContentItem(object contentItem) | ||
[JsonConstructor] | ||
private InlineContentItem() | ||
{ | ||
ContentItem = contentItem; | ||
} | ||
|
||
public IEnumerator<object> GetEnumerator() | ||
{ | ||
yield return ContentItem; | ||
} | ||
|
||
IEnumerator IEnumerable.GetEnumerator() | ||
public InlineContentItem(object contentItem) | ||
{ | ||
yield return ContentItem; | ||
Add(contentItem); | ||
} | ||
} | ||
} |
25 changes: 5 additions & 20 deletions
25
Kentico.Kontent.Delivery/ContentItems/RichText/RichTextContent.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,14 @@ | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using System.Collections.Generic; | ||
using Kentico.Kontent.Delivery.Abstractions; | ||
using Newtonsoft.Json; | ||
|
||
namespace Kentico.Kontent.Delivery.ContentItems.RichText | ||
{ | ||
internal class RichTextContent : IRichTextContent | ||
internal class RichTextContent : List<IRichTextBlock>, IRichTextContent | ||
{ | ||
public IEnumerable<IRichTextBlock> Blocks | ||
[JsonConstructor] | ||
public RichTextContent() | ||
{ | ||
get; | ||
} | ||
|
||
public RichTextContent(IEnumerable<IRichTextBlock> blocks) | ||
{ | ||
Blocks = blocks; | ||
} | ||
|
||
public IEnumerator<IRichTextBlock> GetEnumerator() | ||
{ | ||
return Blocks.GetEnumerator(); | ||
} | ||
|
||
IEnumerator IEnumerable.GetEnumerator() | ||
{ | ||
return Blocks.GetEnumerator(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters