Skip to content

Commit 9dde2cd

Browse files
Merge branch '979389-block-editor' of https://github.com/syncfusion-content/blazor-docs into 979389-block-editor
2 parents 1ea99c1 + 533a4e2 commit 9dde2cd

File tree

2 files changed

+168
-1
lines changed

2 files changed

+168
-1
lines changed

blazor-toc.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -970,8 +970,8 @@
970970
<li><a href="/blazor/blockeditor/built-in-blocks/built-in-blocks">Built-in Blocks</a>
971971
<ul>
972972
<li><a href="/blazor/blockeditor/built-in-blocks/typography">Typography</a></li>
973-
<li><a href="/blazor/blockeditor/built-in-blocks/list-types">List-Types</a></li>
974973
<li><a href="/blazor/blockeditor/built-in-blocks/table-block">Table Blocks</a></li>
974+
<li><a href="/blazor/blockeditor/built-in-blocks/list-types">List-Types</a></li>
975975
<li><a href="/blazor/blockeditor/built-in-blocks/inline-content">Inline Content</a></li>
976976
<li><a href="/blazor/blockeditor/built-in-blocks/embed">Embeds</a></li>
977977
</ul>
@@ -980,6 +980,7 @@
980980
<li><a href="/blazor/blockeditor/paste-cleanup">Paste Cleanup</a></li>
981981
<li><a href="/blazor/blockeditor/undo-redo">Undo and redo</a></li>
982982
<li><a href="/blazor/blockeditor/globalization">Globalization</a></li>
983+
<li><a href="/blazor/blockeditor/events">Events</a></li>
983984
</ul>
984985
</li>
985986
<li>Breadcrumb

blazor/blockeditor/events.md

Lines changed: 166 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,166 @@
1+
---
2+
layout: post
3+
title: Events in Blazor Block Editor Component | Syncfusion
4+
description: Checkout and learn about Events with Blazor Block Editor component in Blazor WebAssembly App.
5+
platform: Blazor
6+
control: Block Editor
7+
documentation: ug
8+
---
9+
10+
# Events in Blazor Block Editor Component
11+
12+
The Block Editor component provides a comprehensive set of events that allow you to monitor and respond to various user interactions and editor state changes. These events enable you to implement custom behaviors, validation, logging, and integration with other systems.
13+
14+
## Created
15+
16+
The `Created` event is triggered when the Block Editor component is successfully initialized and ready for use. This event is useful for performing setup operations or initializing additional features after the editor is created.
17+
18+
```cshtml
19+
20+
@using Syncfusion.Blazor.Block Editor;
21+
22+
<div id="container">
23+
<SfBlock Editor ID="blockeditor" Created="@OnCreated">
24+
</SfBlock Editor>
25+
</div>
26+
@code {
27+
28+
private void OnCreated()
29+
{
30+
// Your required actions here
31+
}
32+
}
33+
34+
```
35+
36+
## BlockChanged
37+
38+
The `BlockChanged` event is triggered whenever the editor blocks are changed. This includes block additions, deletions, or any structural modifications to the document. Its event handler receives details about the changes.
39+
40+
```cshtml
41+
42+
@using Syncfusion.Blazor.Block Editor;
43+
44+
<div id="container">
45+
<SfBlock Editor ID="blockeditor" BlockChanged="@BlockChanged">
46+
</SfBlock Editor>
47+
</div>
48+
@code {
49+
50+
private void BlockChanged(BlockChangedEventArgs args)
51+
{
52+
// Your required actions here
53+
}
54+
}
55+
56+
```
57+
58+
## SelectionChanged
59+
60+
The `SelectionChanged` event is triggered when the user's text selection changes within the editor. The event arguments contain details about the new selection, which can be useful for updating UI elements.
61+
62+
```cshtml
63+
64+
@using Syncfusion.Blazor.Block Editor;
65+
66+
<div id="container">
67+
<SfBlock Editor ID="blockeditor" SelectionChanged="@SelectionChanged">
68+
</SfBlock Editor>
69+
</div>
70+
@code {
71+
72+
private void SelectionChanged(SelectionChangedEventArgs args)
73+
{
74+
// Your required actions here
75+
}
76+
}
77+
78+
```
79+
80+
## Focus
81+
82+
The `Focus` event is triggered when the editor gains focus. This is useful for updating UI states and managing editor interactions.
83+
84+
```cshtml
85+
86+
@using Syncfusion.Blazor.Block Editor;
87+
88+
<div id="container">
89+
<SfBlock Editor ID="blockeditor" Focus="@Focus">
90+
</SfBlock Editor>
91+
</div>
92+
@code {
93+
94+
private void Focus(FocusEventArgs args)
95+
{
96+
// Your required actions here
97+
}
98+
}
99+
100+
```
101+
102+
## Blur
103+
104+
The `Blur` event is triggered when the editor loses focus. This is commonly used for auto-saving content or hiding UI elements that should only be visible when the editor is active.
105+
106+
```cshtml
107+
108+
@using Syncfusion.Blazor.Block Editor;
109+
110+
<div id="container">
111+
<SfBlock Editor ID="blockeditor" Blur="@Blur">
112+
</SfBlock Editor>
113+
</div>
114+
@code {
115+
116+
private void Blur(BlurEventArgs args)
117+
{
118+
// Your required actions here
119+
}
120+
}
121+
122+
```
123+
124+
## PasteCleanupStarting
125+
126+
The `PasteCleanupStarting` event is triggered before content is pasted into the editor. This event allows you to inspect, modify, or cancel the paste operation via its event arguments.
127+
128+
```cshtml
129+
130+
@using Syncfusion.Blazor.Block Editor;
131+
132+
<div id="container">
133+
<SfBlock Editor ID="blockeditor" PasteCleanupStarting="@PasteCleanupStarting">
134+
</SfBlock Editor>
135+
</div>
136+
@code {
137+
138+
private void PasteCleanupStarting(PasteCleanupStartingEventArgs args)
139+
{
140+
// Your required actions here
141+
}
142+
}
143+
144+
```
145+
146+
## PasteCleanupCompleted
147+
148+
The `PasteCleanupCompleted` event is triggered after content has been successfully pasted into the editor. This is useful for post-processing pasted content or updating related UI elements.
149+
150+
```cshtml
151+
152+
@using Syncfusion.Blazor.Block Editor;
153+
154+
<div id="container">
155+
<SfBlock Editor ID="blockeditor" PasteCleanupCompleted="@PasteCleanupCompleted">
156+
</SfBlock Editor>
157+
</div>
158+
@code {
159+
160+
private void PasteCleanupCompleted(PasteCleanupCompletedEventArgs args)
161+
{
162+
// Your required actions here
163+
}
164+
}
165+
166+
```

0 commit comments

Comments
 (0)