mirror of
https://github.com/radzenhq/radzen-blazor.git
synced 2026-07-08 18:16:08 +00:00
33 lines
874 B
Plaintext
33 lines
874 B
Plaintext
@using Radzen.Blazor.Rendering
|
|
@inherits RadzenHtmlEditorButtonBase
|
|
|
|
<EditorButton Title=@Title Click=@OnClick Icon=@Icon Disabled=@IsDisabled />
|
|
|
|
@code {
|
|
bool IsDisabled => Editor == null || Editor.Disabled || !CanExecute();
|
|
|
|
protected override async Task OnClick()
|
|
{
|
|
if (Editor != null && !string.IsNullOrEmpty(TableCommand))
|
|
{
|
|
await Editor.ExecuteTableCommandAsync(TableCommand);
|
|
}
|
|
}
|
|
|
|
bool CanExecute()
|
|
{
|
|
if (Editor?.TableSelection == null || !Editor.TableSelection.InTable)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
return TableCommand switch
|
|
{
|
|
"mergeCellRight" => Editor.TableSelection.CanMergeRight,
|
|
"mergeCellDown" => Editor.TableSelection.CanMergeDown,
|
|
"splitCell" => Editor.TableSelection.CanSplit,
|
|
_ => true
|
|
};
|
|
}
|
|
}
|