Skip to content

Commit df6952f

Browse files
committed
feature: add examples to test site
1 parent 49756aa commit df6952f

File tree

20 files changed

+560
-27
lines changed

20 files changed

+560
-27
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
@inherits UmbracoViewPage<Umbraco.Cms.Core.Models.Blocks.BlockGridItem<MarkdownBlock>>
2+
3+
@if (!Model.Content.Markdown?.IsValid ?? true)
4+
{
5+
<div class="alert alert-danger">
6+
<strong>Markdown block error:</strong> The markdown block is not valid.
7+
</div>
8+
return;
9+
}
10+
11+
<div>
12+
<div>
13+
<span class="display-1">Markdown Editor - HTML Output</span>
14+
@Html.Raw(Model.Content.Markdown.Html)
15+
</div>
16+
<div>
17+
18+
<span class="display-1">Markdown Editor - Raw Output</span>
19+
<pre><code>@Model.Content.Markdown.Raw</code></pre>
20+
</div>
21+
</div>

src/TestSite.10/uSync/v9/Content/home.config

Lines changed: 29 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Content Key="8aa88365-4221-4886-a491-0e968a95b93f" Alias="Home" Level="1">
3-
<Info>
4-
<Parent Key="00000000-0000-0000-0000-000000000000"></Parent>
5-
<Path>/Home</Path>
6-
<Trashed>false</Trashed>
7-
<ContentType>home</ContentType>
8-
<CreateDate>2024-03-25T22:54:59</CreateDate>
9-
<NodeName Default="Home" />
10-
<SortOrder>0</SortOrder>
11-
<Published Default="true" />
12-
<Schedule />
13-
<Template Key="d5d4d7dd-c931-4137-b199-40ae17562532">home</Template>
14-
</Info>
15-
<Properties>
16-
<gridContent>
17-
<Value><![CDATA[{
3+
<Info>
4+
<Parent Key="00000000-0000-0000-0000-000000000000"></Parent>
5+
<Path>/Home</Path>
6+
<Trashed>false</Trashed>
7+
<ContentType>home</ContentType>
8+
<CreateDate>2024-03-25T22:54:59</CreateDate>
9+
<NodeName Default="Home"/>
10+
<SortOrder>0</SortOrder>
11+
<Published Default="true"/>
12+
<Schedule/>
13+
<Template Key="d5d4d7dd-c931-4137-b199-40ae17562532">home</Template>
14+
</Info>
15+
<Properties>
16+
<gridContent>
17+
<Value><![CDATA[{
1818
"layout": {
1919
"Umbraco.BlockGrid": [
2020
{
@@ -51,6 +51,12 @@
5151
],
5252
"columnSpan": 12,
5353
"rowSpan": 1
54+
},
55+
{
56+
"contentUdi": "umb://element/bcfc3a0a1c5044c78eb0ea2b9fa8dadb",
57+
"areas": [],
58+
"columnSpan": 12,
59+
"rowSpan": 1
5460
}
5561
]
5662
},
@@ -78,10 +84,15 @@
7884
{
7985
"contentTypeKey": "98b3a50f-1496-4a9d-b863-f150b1032e83",
8086
"udi": "umb://element/ca8ed1bd7db64271b39e14249904a729"
87+
},
88+
{
89+
"contentTypeKey": "46a370af-6c5a-482e-a0ff-d67a4f027a64",
90+
"udi": "umb://element/bcfc3a0a1c5044c78eb0ea2b9fa8dadb",
91+
"markdown": "# This was a Heading 1\n\n## This was a Heading 2\n\n### This was a Heading 3\n\n**This is bold text**\n\n*This is italic text*\n\n[This is a link](/umbraco)\n\n[This is an external link](https://www.github.com/jcdcdev/jcdcdev.Umbraco.ExtendedMarkdownEditor)\n\n![This is an image](https://raw.githubusercontent.com/jcdcdev/jcdcdev.Umbraco.ExtendedMarkdownEditor/main/docs/icon.png \"Image description\")\n\n- Item 1\n- Item 2\n- Item 3\n\n> This is a blockquote\n\n1. First item\n2. Second item\n3. Third item"
8192
}
8293
],
8394
"settingsData": []
8495
}]]></Value>
85-
</gridContent>
86-
</Properties>
87-
</Content>
96+
</gridContent>
97+
</Properties>
98+
</Content>
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<ContentType Key="46a370af-6c5a-482e-a0ff-d67a4f027a64" Alias="markdownBlock" Level="1">
3+
<Info>
4+
<Name>Markdown Block</Name>
5+
<Icon>icon-document</Icon>
6+
<Thumbnail>folder.png</Thumbnail>
7+
<Description></Description>
8+
<AllowAtRoot>False</AllowAtRoot>
9+
<IsListView>False</IsListView>
10+
<Variations>Nothing</Variations>
11+
<IsElement>true</IsElement>
12+
<HistoryCleanup>
13+
<PreventCleanup>False</PreventCleanup>
14+
<KeepAllVersionsNewerThanDays></KeepAllVersionsNewerThanDays>
15+
<KeepLatestVersionPerDayForDays></KeepLatestVersionPerDayForDays>
16+
</HistoryCleanup>
17+
<Compositions/>
18+
<DefaultTemplate></DefaultTemplate>
19+
<AllowedTemplates/>
20+
</Info>
21+
<Structure/>
22+
<GenericProperties>
23+
<GenericProperty>
24+
<Key>e841e5e9-f5bf-4345-985f-ee687354036c</Key>
25+
<Name>Markdown</Name>
26+
<Alias>markdown</Alias>
27+
<Definition>c322755d-6a6e-4e1b-9026-781ee6dd4944</Definition>
28+
<Type>Umbraco.MarkdownEditor</Type>
29+
<Mandatory>false</Mandatory>
30+
<Validation></Validation>
31+
<Description><![CDATA[]]></Description>
32+
<SortOrder>0</SortOrder>
33+
<Tab Alias="content">Content</Tab>
34+
<Variations>Nothing</Variations>
35+
<MandatoryMessage></MandatoryMessage>
36+
<ValidationRegExpMessage></ValidationRegExpMessage>
37+
<LabelOnTop>false</LabelOnTop>
38+
</GenericProperty>
39+
</GenericProperties>
40+
<Tabs>
41+
<Tab>
42+
<Key>4e6e6104-da67-442e-960d-fc34b249c882</Key>
43+
<Caption>Content</Caption>
44+
<Alias>content</Alias>
45+
<Type>Group</Type>
46+
<SortOrder>0</SortOrder>
47+
</Tab>
48+
</Tabs>
49+
</ContentType>

src/TestSite.10/uSync/v9/DataTypes/BasePageGridContentBlockGrid.config

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<DataType Key="1ae68ea7-fd86-43f4-b9d3-26f1c64e016e" Alias="Base Page - Grid Content - Block Grid" Level="1">
3-
<Info>
4-
<Name>Base Page - Grid Content - Block Grid</Name>
5-
<EditorAlias>Umbraco.BlockGrid</EditorAlias>
6-
<DatabaseType>Ntext</DatabaseType>
7-
</Info>
8-
<Config><![CDATA[{
3+
<Info>
4+
<Name>Base Page - Grid Content - Block Grid</Name>
5+
<EditorAlias>Umbraco.BlockGrid</EditorAlias>
6+
<DatabaseType>Ntext</DatabaseType>
7+
</Info>
8+
<Config><![CDATA[{
99
"BlockGroups": [
1010
{
1111
"key": "e57a07f8-2046-4ac6-8f5d-ce0ae9863ce7",
@@ -117,6 +117,27 @@
117117
"stylesheet": null,
118118
"thumbnail": null,
119119
"view": null
120+
},
121+
{
122+
"allowAtRoot": true,
123+
"allowInAreas": true,
124+
"areaGridColumns": null,
125+
"areas": [],
126+
"backgroundColor": null,
127+
"columnSpanOptions": [],
128+
"contentElementTypeKey": "46a370af-6c5a-482e-a0ff-d67a4f027a64",
129+
"editorSize": "medium",
130+
"forceHideContentEditorInOverlay": false,
131+
"groupKey": "e57a07f8-2046-4ac6-8f5d-ce0ae9863ce7",
132+
"iconColor": null,
133+
"inlineEditing": false,
134+
"label": "",
135+
"rowMaxSpan": 1,
136+
"rowMinSpan": 1,
137+
"settingsElementTypeKey": null,
138+
"stylesheet": null,
139+
"thumbnail": null,
140+
"view": null
120141
}
121142
],
122143
"CreateLabel": null,
@@ -129,4 +150,4 @@
129150
"min": null
130151
}
131152
}]]></Config>
132-
</DataType>
153+
</DataType>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<DataType Key="c322755d-6a6e-4e1b-9026-781ee6dd4944" Alias="Markdown Block - Markdown - Markdown editor" Level="1">
3+
<Info>
4+
<Name>Markdown Block - Markdown - Markdown editor</Name>
5+
<EditorAlias>Umbraco.MarkdownEditor</EditorAlias>
6+
<DatabaseType>Ntext</DatabaseType>
7+
</Info>
8+
<Config><![CDATA[{
9+
"DefaultValue": null,
10+
"DisplayLivePreview": true,
11+
"ExternalLinksOpenInNewTab": true,
12+
"HeaderOffset": 2,
13+
"OverlaySize": "large"
14+
}]]></Config>
15+
</DataType>
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
//------------------------------------------------------------------------------
2+
// <auto-generated>
3+
// This code was generated by a tool.
4+
//
5+
// Umbraco.ModelsBuilder.Embedded v10.4.0+daff988
6+
//
7+
// Changes to this file will be lost if the code is regenerated.
8+
// </auto-generated>
9+
//------------------------------------------------------------------------------
10+
11+
using System;
12+
using System.Linq.Expressions;
13+
using Umbraco.Cms.Core.Models.PublishedContent;
14+
using Umbraco.Cms.Core.PublishedCache;
15+
using Umbraco.Cms.Infrastructure.ModelsBuilder;
16+
using Umbraco.Cms.Core;
17+
using Umbraco.Extensions;
18+
19+
namespace Umbraco.Cms.Web.Common.PublishedModels
20+
{
21+
/// <summary>Markdown Block</summary>
22+
[PublishedModel("markdownBlock")]
23+
public partial class MarkdownBlock : PublishedElementModel
24+
{
25+
// helpers
26+
#pragma warning disable 0109 // new is redundant
27+
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Umbraco.ModelsBuilder.Embedded", "10.4.0+daff988")]
28+
public new const string ModelTypeAlias = "markdownBlock";
29+
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Umbraco.ModelsBuilder.Embedded", "10.4.0+daff988")]
30+
public new const PublishedItemType ModelItemType = PublishedItemType.Content;
31+
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Umbraco.ModelsBuilder.Embedded", "10.4.0+daff988")]
32+
[return: global::System.Diagnostics.CodeAnalysis.MaybeNull]
33+
public new static IPublishedContentType GetModelContentType(IPublishedSnapshotAccessor publishedSnapshotAccessor)
34+
=> PublishedModelUtility.GetModelContentType(publishedSnapshotAccessor, ModelItemType, ModelTypeAlias);
35+
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Umbraco.ModelsBuilder.Embedded", "10.4.0+daff988")]
36+
[return: global::System.Diagnostics.CodeAnalysis.MaybeNull]
37+
public static IPublishedPropertyType GetModelPropertyType<TValue>(IPublishedSnapshotAccessor publishedSnapshotAccessor, Expression<Func<MarkdownBlock, TValue>> selector)
38+
=> PublishedModelUtility.GetModelPropertyType(GetModelContentType(publishedSnapshotAccessor), selector);
39+
#pragma warning restore 0109
40+
41+
private IPublishedValueFallback _publishedValueFallback;
42+
43+
// ctor
44+
public MarkdownBlock(IPublishedElement content, IPublishedValueFallback publishedValueFallback)
45+
: base(content, publishedValueFallback)
46+
{
47+
_publishedValueFallback = publishedValueFallback;
48+
}
49+
50+
// properties
51+
52+
///<summary>
53+
/// Markdown
54+
///</summary>
55+
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Umbraco.ModelsBuilder.Embedded", "10.4.0+daff988")]
56+
[global::System.Diagnostics.CodeAnalysis.MaybeNull]
57+
[ImplementPropertyType("markdown")]
58+
public virtual global::jcdcdev.Umbraco.ExtendedMarkdownEditor.Models.MarkdownValue Markdown => this.Value<global::jcdcdev.Umbraco.ExtendedMarkdownEditor.Models.MarkdownValue>(_publishedValueFallback, "markdown");
59+
}
60+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
@inherits UmbracoViewPage<Umbraco.Cms.Core.Models.Blocks.BlockGridItem<MarkdownBlock>>
2+
3+
@if (!Model.Content.Markdown?.IsValid ?? true)
4+
{
5+
<div class="alert alert-danger">
6+
<strong>Markdown block error:</strong> The markdown block is not valid.
7+
</div>
8+
return;
9+
}
10+
11+
<div>
12+
<div>
13+
<span class="display-1">Markdown Editor - HTML Output</span>
14+
@Html.Raw(Model.Content.Markdown.Html)
15+
</div>
16+
<div>
17+
<span class="display-1">Markdown Editor - Raw Output</span>
18+
<pre><code>@Model.Content.Markdown.Raw</code></pre>
19+
</div>
20+
</div>

src/TestSite.12/uSync/v9/Content/home.config

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,12 @@
5151
],
5252
"columnSpan": 12,
5353
"rowSpan": 1
54+
},
55+
{
56+
"contentUdi": "umb://element/bcfc3a0a1c5044c78eb0ea2b9fa8dadb",
57+
"areas": [],
58+
"columnSpan": 12,
59+
"rowSpan": 1
5460
}
5561
]
5662
},
@@ -78,6 +84,11 @@
7884
{
7985
"contentTypeKey": "98b3a50f-1496-4a9d-b863-f150b1032e83",
8086
"udi": "umb://element/ca8ed1bd7db64271b39e14249904a729"
87+
},
88+
{
89+
"contentTypeKey": "46a370af-6c5a-482e-a0ff-d67a4f027a64",
90+
"udi": "umb://element/bcfc3a0a1c5044c78eb0ea2b9fa8dadb",
91+
"markdown": "# This was a Heading 1\n\n## This was a Heading 2\n\n### This was a Heading 3\n\n**This is bold text**\n\n*This is italic text*\n\n[This is a link](/umbraco)\n\n[This is an external link](https://www.github.com/jcdcdev/jcdcdev.Umbraco.ExtendedMarkdownEditor)\n\n![This is an image](https://raw.githubusercontent.com/jcdcdev/jcdcdev.Umbraco.ExtendedMarkdownEditor/main/docs/icon.png \"Image description\")\n\n- Item 1\n- Item 2\n- Item 3\n\n> This is a blockquote\n\n1. First item\n2. Second item\n3. Third item"
8192
}
8293
],
8394
"settingsData": []

src/TestSite.12/uSync/v9/ContentTypes/home.config

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@
1818
<Composition Key="ed5e3d7d-6e97-4bbb-bcaf-e02a0e0f09bf">basePage</Composition>
1919
</Compositions>
2020
<DefaultTemplate></DefaultTemplate>
21-
<AllowedTemplates/>
21+
<AllowedTemplates>
22+
<Template Key="d5d4d7dd-c931-4137-b199-40ae17562532">home</Template>
23+
</AllowedTemplates>
2224
</Info>
2325
<Structure/>
2426
<GenericProperties/>
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<ContentType Key="46a370af-6c5a-482e-a0ff-d67a4f027a64" Alias="markdownBlock" Level="1">
3+
<Info>
4+
<Name>Markdown Block</Name>
5+
<Icon>icon-document</Icon>
6+
<Thumbnail>folder.png</Thumbnail>
7+
<Description></Description>
8+
<AllowAtRoot>False</AllowAtRoot>
9+
<IsListView>False</IsListView>
10+
<Variations>Nothing</Variations>
11+
<IsElement>true</IsElement>
12+
<HistoryCleanup>
13+
<PreventCleanup>False</PreventCleanup>
14+
<KeepAllVersionsNewerThanDays></KeepAllVersionsNewerThanDays>
15+
<KeepLatestVersionPerDayForDays></KeepLatestVersionPerDayForDays>
16+
</HistoryCleanup>
17+
<Compositions/>
18+
<DefaultTemplate></DefaultTemplate>
19+
<AllowedTemplates/>
20+
</Info>
21+
<Structure/>
22+
<GenericProperties>
23+
<GenericProperty>
24+
<Key>e841e5e9-f5bf-4345-985f-ee687354036c</Key>
25+
<Name>Markdown</Name>
26+
<Alias>markdown</Alias>
27+
<Definition>c322755d-6a6e-4e1b-9026-781ee6dd4944</Definition>
28+
<Type>Umbraco.MarkdownEditor</Type>
29+
<Mandatory>false</Mandatory>
30+
<Validation></Validation>
31+
<Description><![CDATA[]]></Description>
32+
<SortOrder>0</SortOrder>
33+
<Tab Alias="content">Content</Tab>
34+
<Variations>Nothing</Variations>
35+
<MandatoryMessage></MandatoryMessage>
36+
<ValidationRegExpMessage></ValidationRegExpMessage>
37+
<LabelOnTop>false</LabelOnTop>
38+
</GenericProperty>
39+
</GenericProperties>
40+
<Tabs>
41+
<Tab>
42+
<Key>4e6e6104-da67-442e-960d-fc34b249c882</Key>
43+
<Caption>Content</Caption>
44+
<Alias>content</Alias>
45+
<Type>Group</Type>
46+
<SortOrder>0</SortOrder>
47+
</Tab>
48+
</Tabs>
49+
</ContentType>

0 commit comments

Comments
 (0)