Skip to content

Commit 478aa56

Browse files
authored
Merge pull request #6977 from syncfusion-content/968323-DragDrop
968323: Added documentation for audio and video drag-and-drop.
2 parents b49e09e + 92eb950 commit 478aa56

File tree

4 files changed

+113
-0
lines changed

4 files changed

+113
-0
lines changed

blazor/rich-text-editor/tools/audio.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,35 @@ N> The default `layoutOption` property is set to `Inline`.
193193
{% endhighlight %}
194194
{% endtabs %}
195195

196+
## Drag and drop audio insertion
197+
198+
Default upload: Insert audio directly from your local file system (e.g., File Explorer, Finder) into the editor.
199+
200+
Server upload: Use the `SaveUrl` property to upload audio files to your server before inserting them into the editor.
201+
202+
{% tabs %}
203+
{% highlight cshtml %}
204+
205+
{% include_relative code-snippet/audio-drag-and-drop.razor %}
206+
207+
{% endhighlight %}
208+
{% endtabs %}
209+
210+
### Disabling audio drag and drop
211+
212+
You can prevent drag-and-drop action by setting the `OnMediaDrop` argument cancel value to true. The following code shows how to prevent the drag-and-drop.
213+
214+
```
215+
<RichTextEditorEvents OnMediaDrop="@OnMediaDrop"></RichTextEditorEvents>
216+
@code{
217+
private void OnMediaDrop(MediaDropEventArgs args)
218+
{
219+
if (args.MediaType == "Audio") {
220+
args.Cancel = true;
221+
}
222+
}
223+
}
224+
```
196225
## Rename audio before inserting
197226

198227
Using the [RichTextEditorAudioSettings](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.RichTextEditor.RichTextEditorAudioSettings.html) property, specify the server handler to upload the selected audio. Then, by binding the `FileUploadSuccess` event, you will receive the modified file name from the server and update it in the Rich Text Editor's insert audio dialog.
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
@using Syncfusion.Blazor.RichTextEditor;
2+
3+
<SfRichTextEditor>
4+
<RichTextEditorToolbarSettings Items="@Items" />
5+
<RichTextEditorAudioSettings SaveUrl="@saveUrl" Path="@path"></RichTextEditorAudioSettings>
6+
<p>
7+
The Rich Text Editor supports seamless audio insertion through drag-and-drop functionality. Users can quickly insert audio files into their content with a simple drag-and-drop action.
8+
</p>
9+
<p><b>Key features:</b></p>
10+
<ul>
11+
<li>Supports local upload: Drag audio files from your local system (e.g., File Explorer, Finder) and drop them
12+
directly into the editor.</li>
13+
<li>Supports server upload: Configure the <code>SaveUrl</code> property to upload audio files to your server
14+
before inserting them into the editor.</li>
15+
<li>Supports common audio formats such as MP3, WAV, and M4A ,WMA</li>
16+
<li>Fully customizable upload settings, including size limits and validation.</li>
17+
</ul>
18+
</SfRichTextEditor>
19+
@code {
20+
private string saveUrl = "https://blazor.syncfusion.com/services/production/api/RichTextEditor/SaveFile";
21+
private string path = "https://blazor.syncfusion.com/services/production/RichTextEditor/";
22+
private List<ToolbarItemModel> Items = new List<ToolbarItemModel>()
23+
{
24+
new ToolbarItemModel() { Command = ToolbarCommand.Audio }
25+
};
26+
}
27+
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
@using Syncfusion.Blazor.RichTextEditor;
2+
3+
<SfRichTextEditor>
4+
<RichTextEditorToolbarSettings Items="@Items" />
5+
<RichTextEditorVideoSettings SaveUrl="@saveUrl" Path="@path"></RichTextEditorVideoSettings>
6+
<p>
7+
The Rich Text Editor supports seamless video insertion through drag-and-drop functionality. Users can quickly insert video files into their content with a simple drag-and-drop action.
8+
</p>
9+
<p><b>Key features:</b></p>
10+
<ul>
11+
<li>Supports local upload: Drag video files from your local system (e.g., File Explorer, Finder) and drop them
12+
directly into the editor.</li>
13+
<li>Supports server upload: Configure the <code>SaveUrl</code> property to upload video files to your server
14+
before inserting them into the editor.</li>
15+
<li>Supports common video formats such as MP4, WMV, AVI and MOV</li>
16+
<li>Fully customizable upload settings, including size limits and validation.</li>
17+
</ul>
18+
</SfRichTextEditor>
19+
@code {
20+
private string saveUrl = "https://blazor.syncfusion.com/services/production/api/RichTextEditor/SaveFile";
21+
private string path = "https://blazor.syncfusion.com/services/production/RichTextEditor/";
22+
private List<ToolbarItemModel> Items = new List<ToolbarItemModel>()
23+
{
24+
new ToolbarItemModel() { Command = ToolbarCommand.Video }
25+
};
26+
}
27+

blazor/rich-text-editor/tools/video.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,36 @@ N> The default `layoutOption` property is set to `Inline`.
215215
{% endhighlight %}
216216
{% endtabs %}
217217

218+
## Drag and drop video insertion
219+
220+
Default upload: Insert video directly from your local file system (e.g., File Explorer, Finder) into the editor.
221+
222+
Server upload: Use the `SaveUrl` property to upload video files to your server before inserting them into the editor.
223+
224+
{% tabs %}
225+
{% highlight cshtml %}
226+
227+
{% include_relative code-snippet/video-drag-and-drop.razor %}
228+
229+
{% endhighlight %}
230+
{% endtabs %}
231+
232+
### Disabling videos drag and drop
233+
234+
You can prevent drag-and-drop action by setting the `OnMediaDrop` argument cancel value to true. The following code shows how to prevent the drag-and-drop.
235+
236+
```
237+
<RichTextEditorEvents OnMediaDrop="@OnMediaDrop"></RichTextEditorEvents>
238+
@code{
239+
private void OnMediaDrop(MediaDropEventArgs args)
240+
{
241+
if (args.MediaType == "Video") {
242+
args.Cancel = true;
243+
}
244+
}
245+
}
246+
```
247+
218248
## Resize video
219249

220250
The Rich Text Editor has built-in video resizing support, which is enabled for the video elements added. The resize points will appear on each corner of the video when focusing so users can easily resize the video using mouse points or thumb through the resize points. Also, the resize calculation will be done based on the aspect ratio.

0 commit comments

Comments
 (0)