Skip to content

Commit dac1472

Browse files
committed
Added Blazor Block Editor sample
1 parent 9a8b9b0 commit dac1472

File tree

140 files changed

+120801
-0
lines changed

Some content is hidden

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

140 files changed

+120801
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net10.0</TargetFramework>
5+
<ImplicitUsings>enable</ImplicitUsings>
6+
<Nullable>enable</Nullable>
7+
<NoDefaultLaunchSettingsFile>true</NoDefaultLaunchSettingsFile>
8+
<StaticWebAssetProjectMode>Default</StaticWebAssetProjectMode>
9+
<BlazorDisableThrowNavigationException>true</BlazorDisableThrowNavigationException>
10+
</PropertyGroup>
11+
12+
<ItemGroup>
13+
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="10.0.0" />
14+
<PackageReference Include="Syncfusion.Blazor.BlockEditor" Version="32.1.19" />
15+
<PackageReference Include="Syncfusion.Blazor.Themes" Version="32.1.19" />
16+
</ItemGroup>
17+
18+
</Project>
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
@page "/"
2+
@rendermode InteractiveAuto
3+
4+
<SfBlockEditor Blocks="blockDataOverview">
5+
</SfBlockEditor>
6+
7+
@code {
8+
private List<BlockModel> blockDataOverview = new EditorBlockData().GetBlockDataOverview();
9+
10+
public class EditorBlockData
11+
{
12+
public List<BlockModel> GetBlockDataOverview()
13+
{
14+
List<BlockModel> blockDataOverview = new List<BlockModel>
15+
{
16+
new BlockModel
17+
{
18+
BlockType = BlockType.Heading,
19+
Properties = new HeadingBlockSettings{ Level=2 },
20+
Content =
21+
{
22+
new ContentModel
23+
{
24+
ContentType = ContentType.Text,
25+
Content = "Getting Started with Block Editor"
26+
}
27+
}
28+
},
29+
new BlockModel
30+
{
31+
BlockType = BlockType.Paragraph,
32+
Content =
33+
{
34+
new ContentModel{ ContentType=ContentType.Text, Content="Welcome to"},
35+
new ContentModel{ ContentType=ContentType.Text, Content=" Block Editor", Properties=new TextContentSettings{Styles=new StyleModel{Bold=true}}},
36+
new ContentModel{ ContentType=ContentType.Text, Content=" - your flexible, modular workspace for creating rich, structured content. whether you're drafting documents, brainstorming ideas, or collaborating with your team, Block Editor makes it simple and intuitive."}
37+
}
38+
},
39+
new BlockModel{ BlockType = BlockType.Paragraph, Content = new List<ContentModel>() }
40+
};
41+
return blockDataOverview;
42+
}
43+
}
44+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
2+
using Syncfusion.Blazor;
3+
var builder = WebAssemblyHostBuilder.CreateDefault(args);
4+
builder.Services.AddSyncfusionBlazor();
5+
await builder.Build().RunAsync();
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
@using System.Net.Http
2+
@using System.Net.Http.Json
3+
@using Microsoft.AspNetCore.Components.Forms
4+
@using Microsoft.AspNetCore.Components.Routing
5+
@using Microsoft.AspNetCore.Components.Web
6+
@using static Microsoft.AspNetCore.Components.Web.RenderMode
7+
@using Microsoft.AspNetCore.Components.Web.Virtualization
8+
@using Microsoft.JSInterop
9+
@using BlockEditorWebAppSample.Client
10+
@using Syncfusion.Blazor
11+
@using Syncfusion.Blazor.BlockEditor
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"Logging": {
3+
"LogLevel": {
4+
"Default": "Information",
5+
"Microsoft.AspNetCore": "Warning"
6+
}
7+
}
8+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"Logging": {
3+
"LogLevel": {
4+
"Default": "Information",
5+
"Microsoft.AspNetCore": "Warning"
6+
}
7+
}
8+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<Solution>
2+
<Project Path="BlockEditorWebAppSample.Client/BlockEditorWebAppSample.Client.csproj" />
3+
<Project Path="BlockEditorWebAppSample/BlockEditorWebAppSample.csproj" />
4+
</Solution>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<Project Sdk="Microsoft.NET.Sdk.Web">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net10.0</TargetFramework>
5+
<Nullable>enable</Nullable>
6+
<ImplicitUsings>enable</ImplicitUsings>
7+
<BlazorDisableThrowNavigationException>true</BlazorDisableThrowNavigationException>
8+
</PropertyGroup>
9+
10+
<ItemGroup>
11+
<ProjectReference Include="..\BlockEditorWebAppSample.Client\BlockEditorWebAppSample.Client.csproj" />
12+
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="10.0.0" />
13+
</ItemGroup>
14+
15+
</Project>
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
4+
<head>
5+
<meta charset="utf-8" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7+
<base href="/" />
8+
<ResourcePreloader />
9+
<link rel="stylesheet" href="@Assets["lib/bootstrap/dist/css/bootstrap.min.css"]" />
10+
<link rel="stylesheet" href="@Assets["app.css"]" />
11+
<link rel="stylesheet" href="@Assets["BlockEditorWebAppSample.styles.css"]" />
12+
<link href="_content/Syncfusion.Blazor.Themes/bootstrap5.css" rel="stylesheet" />
13+
<ImportMap />
14+
<link rel="icon" type="image/png" href="favicon.png" />
15+
<HeadOutlet />
16+
</head>
17+
18+
<body>
19+
<Routes />
20+
<ReconnectModal />
21+
<script src="@Assets["_framework/blazor.web.js"]"></script>
22+
<script src="_content/Syncfusion.Blazor.Core/scripts/syncfusion-blazor.min.js" type="text/javascript"></script>
23+
</body>
24+
25+
</html>
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
@inherits LayoutComponentBase
2+
3+
<div class="page">
4+
<div class="sidebar">
5+
<NavMenu />
6+
</div>
7+
8+
<main>
9+
<div class="top-row px-4">
10+
<a href="https://learn.microsoft.com/aspnet/core/" target="_blank">About</a>
11+
</div>
12+
13+
<article class="content px-4">
14+
@Body
15+
</article>
16+
</main>
17+
</div>
18+
19+
<div id="blazor-error-ui" data-nosnippet>
20+
An unhandled error has occurred.
21+
<a href="." class="reload">Reload</a>
22+
<span class="dismiss">🗙</span>
23+
</div>

0 commit comments

Comments
 (0)