Skip to content

Commit 6d69aa0

Browse files
997449: Updated ug content and props based on latest properties.
1 parent 081216e commit 6d69aa0

File tree

52 files changed

+825
-700
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+825
-700
lines changed

ej2-asp-core-mvc/code-snippet/block-editor/appearance/appearance.cs

Lines changed: 35 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,79 @@
1-
using Syncfusion.EJ2.BlockEditor;
1+
public List<BlockModel> BlocksData { get; set; } = new List<BlockModel>();
22

3-
public List<Block> BlocksData { get; set; } = new List<Block>();
3+
public class BlockModel
4+
{
5+
public string id { get; set; }
6+
public string blockType { get; set; }
7+
public object properties { get; set; }
8+
public List<object> content { get; set; }
9+
}
410

511
public ActionResult Appearance()
612
{
7-
BlocksData.Add(new Block
13+
BlocksData.Add(new BlockModel
814
{
9-
Id = "title-block",
10-
Type = BlockType.Heading,
11-
Props = new { level = 1 },
12-
Content = new List<object>()
15+
id = "title-block",
16+
blockType = "Heading",
17+
properties = new { level = 1 },
18+
content = new List<object>()
1319
{
1420
new
1521
{
16-
type = "Text",
22+
contentType = "Text",
1723
content = "Appearance Configuration Demo"
1824
}
1925
}
2026
});
21-
BlocksData.Add(new Block
27+
BlocksData.Add(new BlockModel
2228
{
23-
Id = "intro-block",
24-
Type = BlockType.Paragraph,
25-
Content = new List<object>()
29+
id = "intro-block",
30+
blockType = "Paragraph",
31+
content = new List<object>()
2632
{
2733
new
2834
{
2935
id = "paragraph1-content",
30-
type = "Text",
36+
contentType = "Text",
3137
content = "This demo showcases different appearance configurations including readonly mode and a custom CSS theme."
3238
}
3339
}
3440
});
35-
BlocksData.Add(new Block
41+
BlocksData.Add(new BlockModel
3642
{
37-
Id = "features-heading",
38-
Type = BlockType.Heading,
39-
Props = new { level = 2 },
40-
Content = new List<object>()
43+
id = "features-heading",
44+
blockType = "Heading",
45+
properties = new { level = 2 },
46+
content = new List<object>()
4147
{
4248
new
4349
{
44-
type = "Text",
50+
contentType = "Text",
4551
content = "Configured Custom Theme"
4652
}
4753
}
4854
});
49-
BlocksData.Add(new Block
55+
BlocksData.Add(new BlockModel
5056
{
51-
Id = "theme-list-1",
52-
Type = BlockType.BulletList,
53-
Content = new List<object>()
57+
id = "theme-list-1",
58+
blockType = "BulletList",
59+
content = new List<object>()
5460
{
5561
new
5662
{
57-
type = "Text",
63+
contentType = "Text",
5864
content = "Gradient background with modern styling"
5965
}
6066
}
6167
});
62-
BlocksData.Add(new Block
68+
BlocksData.Add(new BlockModel
6369
{
64-
Id = "readonly-info",
65-
Type = BlockType.Paragraph,
66-
Content = new List<object>()
70+
id = "readonly-info",
71+
blockType = "Paragraph",
72+
content = new List<object>()
6773
{
6874
new
6975
{
70-
type = "Text",
76+
contentType = "Text",
7177
content = "Use the readonly toggle to switch between editable and read-only modes. In readonly mode, you can view content but cannot make changes."
7278
}
7379
}

ej2-asp-core-mvc/code-snippet/block-editor/appearance/tagHelper

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,7 @@
11
@using Syncfusion.EJ2.BlockEditor
22

33
<div id='blockeditor-container'>
4-
<ejs-blockeditor created="onCreated" id="block-editor" focus="displayOutput('Editor focused. You can now type or edit content.')" blur="displayOutput('Editor lost focus.')">
5-
<e-blocks>
6-
@foreach (var block in ViewBag.BlocksData)
7-
{
8-
<e-block id="@block.Id" type="@block.Type.ToString()" content="@block.Content"></e-block>
9-
}
10-
</e-blocks>
11-
</ejs-blockeditor>
4+
<ejs-blockeditor created="onCreated" id="block-editor" blocks="@ViewBag.BlocksData" focus="displayOutput('Editor focused. You can now type or edit content.')" blur="displayOutput('Editor lost focus.')"></ejs-blockeditor>
125
<div id="controls">
136
<h3>Appearance Configuration Demo</h3>
147
<div class="button-group">
@@ -91,10 +84,10 @@
9184
backdrop-filter: blur(10px);
9285
}
9386

94-
.custom-theme .e-block:hover {
95-
transform: translateY(-2px);
96-
transition: all 0.3s ease;
97-
}
87+
.custom-theme .e-block:hover {
88+
transform: translateY(-2px);
89+
transition: all 0.3s ease;
90+
}
9891

9992
.custom-theme .e-block-content {
10093
color: #2d3748;

ej2-asp-core-mvc/code-snippet/block-editor/blocks/blockTypes/callout-block/callout.cs

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,31 @@
11
using Syncfusion.EJ2.BlockEditor;
22

3-
public List<Block> BlocksData { get; set; } = new List<Block>();
3+
public List<BlockModel> BlocksData { get; set; } = new List<BlockModel>();
4+
5+
public class BlockModel
6+
{
7+
public string id { get; set; }
8+
public string blockType { get; set; }
9+
public object properties { get; set; }
10+
public List<object> content { get; set; }
11+
public List<BlockModel> children { get; set; }
12+
}
413

514
public ActionResult Callout()
615
{
7-
BlocksData.Add(new Block() {
8-
Type = BlockType.Callout,
9-
Props= new {
10-
Children = new List<Block>()
16+
BlocksData.Add(new BlockModel() {
17+
blockType = "Callout",
18+
properties = new {
19+
children = new List<BlockModel>()
1120
{
12-
new Block()
21+
new BlockModel()
1322
{
14-
Id = "callout-content-1",
15-
Type = "Paragraph",
16-
Content = new List<object>(){
23+
id = "callout-content-1",
24+
blockType = "Paragraph",
25+
content = new List<object>(){
1726
new{
1827
id = "callout-content-1",
19-
type = "Text",
28+
contentType = "Text",
2029
content = "Important information: This is a callout block used to highlight important content."
2130
}
2231
}

ej2-asp-core-mvc/code-snippet/block-editor/blocks/blockTypes/callout-block/tagHelper

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,7 @@
11
@using Syncfusion.EJ2.BlockEditor
22

33
<div id='blockeditor-container'>
4-
<ejs-blockeditor id="block-editor">
5-
<e-blocks>
6-
@foreach (var block in ViewBag.BlocksData)
7-
{
8-
<e-block id="@block.Id" type="@block.Type.ToString()" content="@block.Content" children="@block.Children"></e-block>
9-
}
10-
</e-blocks>
11-
</ejs-blockeditor>
4+
<ejs-blockeditor id="block-editor" blocks="@ViewBag.BlocksData"></ejs-blockeditor>
125
</div>
136

147
<style>
Lines changed: 45 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,63 @@
11
using Syncfusion.EJ2.BlockEditor;
22

3-
public List<Block> BlocksData { get; set; } = new List<Block>();
3+
public List<BlockModel> BlocksData { get; set; } = new List<BlockModel>();
4+
5+
public class BlockModel
6+
{
7+
public string id { get; set; }
8+
public string blockType { get; set; }
9+
public object properties { get; set; }
10+
public List<object> content { get; set; }
11+
}
12+
13+
public class CodeBlockSettingsModel
14+
{
15+
public string defaultLanguage { get; set; }
16+
public List<object> languages { get; set; }
17+
}
418

519
public ActionResult Code()
620
{
7-
BlocksData.Add(new Block()
21+
BlocksData.Add(new BlockModel()
822
{
9-
Type = BlockType.Code,
10-
Content = new List<object>()
23+
blockType = "Code",
24+
content = new List<object>()
1125
{
1226
new
1327
{
14-
type = "Text",
28+
contentType = "Text",
1529
content = "function greeting() {\n console.log(\"Hello, world!\");\n}"
1630
}
17-
},
18-
Props = new
31+
}
32+
});
33+
var codeBlockSettings = new CodeBlockSettingsModel
34+
{
35+
defaultLanguage = "javascript",
36+
languages = new List<object>
1937
{
20-
defaultLanguage = "javascript",
21-
languages = new List<object>()
38+
new
39+
{
40+
label = "JavaScript",
41+
language = "javascript"
42+
},
43+
new
44+
{
45+
label = "TypeScript",
46+
language = "typescript"
47+
},
48+
new
2249
{
23-
new
24-
{
25-
label = "JavaScript",
26-
language = "javascript"
27-
},
28-
new
29-
{
30-
label = "TypeScript",
31-
language = "typescript"
32-
},
33-
new
34-
{
35-
label = "HTML",
36-
language = "html"
37-
},
38-
new
39-
{
40-
label = "CSS",
41-
language = "css"
42-
}
50+
label = "HTML",
51+
language = "html"
52+
},
53+
new
54+
{
55+
label = "CSS",
56+
language = "css"
4357
}
4458
}
45-
});
59+
};
4660
ViewBag.BlocksData = BlocksData;
61+
ViewBag.CodeBlocksData = codeBlockSettings;
4762
return View();
4863
}

ej2-asp-core-mvc/code-snippet/block-editor/blocks/blockTypes/code-block/tagHelper

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,7 @@
11
@using Syncfusion.EJ2.BlockEditor
22

33
<div id='blockeditor-container'>
4-
<ejs-blockeditor id="block-editor">
5-
<e-blocks>
6-
@foreach (var block in ViewBag.BlocksData)
7-
{
8-
<e-block id="@block.Id" type="@block.Type.ToString()" content="@block.Content" codeSettings="@block.CodeSettings"></e-block>
9-
}
10-
</e-blocks>
11-
</ejs-blockeditor>
4+
<ejs-blockeditor id="block-editor" blocks="@ViewBag.BlocksData" codeBlockSettings="@ViewBag.CodeBlocksData"></ejs-blockeditor>
125
</div>
136

147
<style>

ej2-asp-core-mvc/code-snippet/block-editor/blocks/blockTypes/divider-block/divider.cs

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,41 @@
11
using Syncfusion.EJ2.BlockEditor;
22

3-
public List<Block> BlocksData { get; set; } = new List<Block>();
3+
public List<BlockModel> BlocksData { get; set; } = new List<BlockModel>();
4+
5+
public class BlockModel
6+
{
7+
public string id { get; set; }
8+
public string blockType { get; set; }
9+
public object properties { get; set; }
10+
public List<object> content { get; set; }
11+
}
412

513
public ActionResult Divider()
614
{
7-
BlocksData.Add(new Block()
15+
BlocksData.Add(new BlockModel()
816
{
9-
Type = BlockType.Paragraph,
10-
Content = new List<object>()
17+
blockType = "Paragraph",
18+
content = new List<object>()
1119
{
1220
new
1321
{
14-
type = "Text",
22+
contentType = "Text",
1523
content = "This section discusses the features of the Block Editor."
1624
}
1725
}
1826
});
19-
BlocksData.Add(new Block()
27+
BlocksData.Add(new BlockModel()
2028
{
21-
Type = BlockType.Divider,
29+
blockType = "Divider",
2230
});
23-
BlocksData.Add(new Block()
31+
BlocksData.Add(new BlockModel()
2432
{
25-
Type = BlockType.Paragraph,
26-
Content = new List<object>()
33+
blockType = "Paragraph",
34+
content = new List<object>()
2735
{
2836
new
2937
{
30-
type = "Text",
38+
contentType = "Text",
3139
content = "This section covers implementation details and usage examples."
3240
}
3341
}

ej2-asp-core-mvc/code-snippet/block-editor/blocks/blockTypes/divider-block/tagHelper

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,7 @@
11
@using Syncfusion.EJ2.BlockEditor
22

33
<div id='blockeditor-container'>
4-
<ejs-blockeditor id="block-editor">
5-
<e-blocks>
6-
@foreach (var block in ViewBag.BlocksData)
7-
{
8-
<e-block id="@block.Id" type="@block.Type.ToString()" content="@block.Content"></e-block>
9-
}
10-
</e-blocks>
11-
</ejs-blockeditor>
4+
<ejs-blockeditor id="block-editor" blocks="@ViewBag.BlocksData"></ejs-blockeditor>
125
</div>
136

147
<style>

0 commit comments

Comments
 (0)