mirror of
https://github.com/radzenhq/radzen-blazor.git
synced 2026-02-04 05:35:44 +00:00
Htmledit on input (#1070)
* adding a paramter for allow for no-tool HTMLEditors. * Adding input event to the HTMLEditor
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
{
|
||||
@ChildContent
|
||||
}
|
||||
else
|
||||
else if (!NoTools)
|
||||
{
|
||||
<RadzenHtmlEditorUndo />
|
||||
<RadzenHtmlEditorRedo />
|
||||
|
||||
@@ -18,6 +18,12 @@ namespace Radzen.Blazor
|
||||
/// </example>
|
||||
public partial class RadzenHtmlEditor : FormComponent<string>
|
||||
{
|
||||
/// <summary>
|
||||
/// Allows for no-tool HTML editors.
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
public bool NoTools { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the mode of the editor.
|
||||
/// </summary>
|
||||
@@ -39,6 +45,13 @@ namespace Radzen.Blazor
|
||||
[Parameter]
|
||||
public IDictionary<string, string> UploadHeaders { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the input.
|
||||
/// </summary>
|
||||
/// <value>The input.</value>
|
||||
[Parameter]
|
||||
public EventCallback<string> Input { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// A callback that will be invoked when the user pastes content in the editor. Commonly used to filter unwanted HTML.
|
||||
/// </summary>
|
||||
@@ -274,6 +287,7 @@ namespace Radzen.Blazor
|
||||
public void OnChange(string html)
|
||||
{
|
||||
Html = html;
|
||||
Input.InvokeAsync(html);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<RadzenHtmlEditor @bind-Value=@htmlValue style="height: 300px;" Change=@OnChange Paste=@OnPaste Execute=@OnExecute UploadUrl="upload/image" />
|
||||
<RadzenHtmlEditor @bind-Value=@htmlValue style="height: 300px;" Input=@OnInput Change=@OnChange Paste=@OnPaste Execute=@OnExecute UploadUrl="upload/image" />
|
||||
|
||||
<EventConsole @ref=@console />
|
||||
|
||||
@@ -17,6 +17,11 @@
|
||||
console.Log($"Change: {html}");
|
||||
}
|
||||
|
||||
void OnInput(string html)
|
||||
{
|
||||
console.Log($"Input: {html}");
|
||||
}
|
||||
|
||||
void OnExecute(HtmlEditorExecuteEventArgs args)
|
||||
{
|
||||
console.Log($"Execute: {args.CommandName}");
|
||||
|
||||
Reference in New Issue
Block a user