Refactor and enhance RadzenHtmlEditor table tools

- Introduced `HtmlEditorTableStrings` for centralized localization.
- Added `RadzenHtmlEditorTableTools` for grouped table commands.
- Refactored `HtmlEditorTests.cs` to reduce duplication.
- Improved table manipulation logic in `Radzen.Blazor.js`.
- Consolidated repetitive logic for better maintainability.
- Updated tests to validate new table commands and localization.
This commit is contained in:
Frank Leib
2026-04-27 10:59:54 +02:00
committed by Vladimir Enchev
parent 0922d8cf3b
commit 614d28f788
8 changed files with 892 additions and 786 deletions

View File

@@ -8,14 +8,20 @@ namespace Radzen.Blazor.Tests
{
public class HtmlEditorTests
{
[Fact]
public void HtmlEditor_Renders_WithClassName()
static TestContext CreateContext()
{
using var ctx = new TestContext();
var ctx = new TestContext();
ctx.JSInterop.Mode = JSRuntimeMode.Loose;
ctx.Services.AddScoped<DialogService>();
ctx.Services.AddScoped<ContextMenuService>();
ctx.Services.AddScoped<NotificationService>();
return ctx;
}
[Fact]
public void HtmlEditor_Renders_WithClassName()
{
using var ctx = CreateContext();
var component = ctx.RenderComponent<RadzenHtmlEditor>();
Assert.Contains(@"rz-html-editor", component.Markup);
@@ -24,11 +30,7 @@ namespace Radzen.Blazor.Tests
[Fact]
public void HtmlEditor_Renders_ShowToolbar_True()
{
using var ctx = new TestContext();
ctx.JSInterop.Mode = JSRuntimeMode.Loose;
ctx.Services.AddScoped<DialogService>();
ctx.Services.AddScoped<ContextMenuService>();
ctx.Services.AddScoped<NotificationService>();
using var ctx = CreateContext();
var component = ctx.RenderComponent<RadzenHtmlEditor>(parameters =>
{
parameters.Add(p => p.ShowToolbar, true);
@@ -40,11 +42,7 @@ namespace Radzen.Blazor.Tests
[Fact]
public void HtmlEditor_Renders_ShowToolbar_False()
{
using var ctx = new TestContext();
ctx.JSInterop.Mode = JSRuntimeMode.Loose;
ctx.Services.AddScoped<DialogService>();
ctx.Services.AddScoped<ContextMenuService>();
ctx.Services.AddScoped<NotificationService>();
using var ctx = CreateContext();
var component = ctx.RenderComponent<RadzenHtmlEditor>(parameters =>
{
parameters.Add(p => p.ShowToolbar, false);
@@ -56,11 +54,7 @@ namespace Radzen.Blazor.Tests
[Fact]
public void HtmlEditor_Renders_Mode_Design()
{
using var ctx = new TestContext();
ctx.JSInterop.Mode = JSRuntimeMode.Loose;
ctx.Services.AddScoped<DialogService>();
ctx.Services.AddScoped<ContextMenuService>();
ctx.Services.AddScoped<NotificationService>();
using var ctx = CreateContext();
var component = ctx.RenderComponent<RadzenHtmlEditor>(parameters =>
{
parameters.Add(p => p.Mode, HtmlEditorMode.Design);
@@ -73,11 +67,7 @@ namespace Radzen.Blazor.Tests
[Fact]
public void HtmlEditor_Renders_Mode_Source()
{
using var ctx = new TestContext();
ctx.JSInterop.Mode = JSRuntimeMode.Loose;
ctx.Services.AddScoped<DialogService>();
ctx.Services.AddScoped<ContextMenuService>();
ctx.Services.AddScoped<NotificationService>();
using var ctx = CreateContext();
var component = ctx.RenderComponent<RadzenHtmlEditor>(parameters =>
{
parameters.Add(p => p.Mode, HtmlEditorMode.Source);
@@ -90,11 +80,7 @@ namespace Radzen.Blazor.Tests
[Fact]
public void HtmlEditor_Renders_Disabled_Attribute()
{
using var ctx = new TestContext();
ctx.JSInterop.Mode = JSRuntimeMode.Loose;
ctx.Services.AddScoped<DialogService>();
ctx.Services.AddScoped<ContextMenuService>();
ctx.Services.AddScoped<NotificationService>();
using var ctx = CreateContext();
var component = ctx.RenderComponent<RadzenHtmlEditor>(parameters =>
{
parameters.Add(p => p.Disabled, true);
@@ -106,11 +92,7 @@ namespace Radzen.Blazor.Tests
[Fact]
public void HtmlEditor_Renders_ContentArea()
{
using var ctx = new TestContext();
ctx.JSInterop.Mode = JSRuntimeMode.Loose;
ctx.Services.AddScoped<DialogService>();
ctx.Services.AddScoped<ContextMenuService>();
ctx.Services.AddScoped<NotificationService>();
using var ctx = CreateContext();
var component = ctx.RenderComponent<RadzenHtmlEditor>();
Assert.Contains("rz-html-editor-content", component.Markup);
@@ -119,11 +101,7 @@ namespace Radzen.Blazor.Tests
[Fact]
public void HtmlEditor_DefaultToolbar_Renders_TableTools()
{
using var ctx = new TestContext();
ctx.JSInterop.Mode = JSRuntimeMode.Loose;
ctx.Services.AddScoped<DialogService>();
ctx.Services.AddScoped<ContextMenuService>();
ctx.Services.AddScoped<NotificationService>();
using var ctx = CreateContext();
var component = ctx.RenderComponent<RadzenHtmlEditor>();
@@ -135,9 +113,7 @@ namespace Radzen.Blazor.Tests
[Fact]
public void HtmlEditorTable_Renders_PropertyPanelLabels()
{
using var ctx = new TestContext();
ctx.JSInterop.Mode = JSRuntimeMode.Loose;
ctx.Services.AddScoped<DialogService>();
using var ctx = CreateContext();
var component = ctx.RenderComponent<RadzenHtmlEditorTable>();
@@ -150,9 +126,7 @@ namespace Radzen.Blazor.Tests
[Fact]
public void HtmlEditorTable_Renders_BorderSideDefaults()
{
using var ctx = new TestContext();
ctx.JSInterop.Mode = JSRuntimeMode.Loose;
ctx.Services.AddScoped<DialogService>();
using var ctx = CreateContext();
var component = ctx.RenderComponent<RadzenHtmlEditorTable>();
@@ -165,11 +139,7 @@ namespace Radzen.Blazor.Tests
[Fact]
public void HtmlEditorTableCommandButton_Disabled_WithoutTableSelection()
{
using var ctx = new TestContext();
ctx.JSInterop.Mode = JSRuntimeMode.Loose;
ctx.Services.AddScoped<DialogService>();
ctx.Services.AddScoped<ContextMenuService>();
ctx.Services.AddScoped<NotificationService>();
using var ctx = CreateContext();
var component = ctx.RenderComponent<RadzenHtmlEditor>(parameters => parameters
.AddChildContent<RadzenHtmlEditorTableCommandButton>(childParameters => childParameters
@@ -182,6 +152,19 @@ namespace Radzen.Blazor.Tests
Assert.True(button.HasAttribute("disabled"));
}
[Fact]
public void HtmlEditorTableTools_Renders_TableButtons()
{
using var ctx = CreateContext();
var component = ctx.RenderComponent<RadzenHtmlEditor>(parameters => parameters
.AddChildContent<RadzenHtmlEditorTableTools>());
Assert.Contains("table_chart", component.Markup);
Assert.Contains("merge_type", component.Markup);
Assert.Contains("call_split", component.Markup);
}
[Fact]
public void HtmlEditorCommandState_Defaults_ToSuccessfulResult()
{
@@ -194,11 +177,7 @@ namespace Radzen.Blazor.Tests
[Fact]
public async Task HtmlEditor_ExecuteTableCommandAsync_UsesLocalizedBlockedMessage()
{
using var ctx = new TestContext();
ctx.JSInterop.Mode = JSRuntimeMode.Loose;
ctx.Services.AddScoped<DialogService>();
ctx.Services.AddScoped<ContextMenuService>();
ctx.Services.AddScoped<NotificationService>();
using var ctx = CreateContext();
ctx.JSInterop.Setup<RadzenHtmlEditorCommandState>("Radzen.execTableCommand", _ => true)
.SetResult(new RadzenHtmlEditorCommandState
@@ -211,8 +190,11 @@ namespace Radzen.Blazor.Tests
.SetResult(new HtmlEditorTableSelection());
var component = ctx.RenderComponent<RadzenHtmlEditor>(parameters => parameters
.Add(p => p.TableActionBlockedText, "Aktion blockiert")
.Add(p => p.TablePasteBlockedText, "Einfügen ist für diese Zellstruktur nicht möglich."));
.Add(p => p.TableStrings, new HtmlEditorTableStrings
{
ActionBlocked = "Aktion blockiert",
PasteBlocked = "Einfügen ist für diese Zellstruktur nicht möglich."
}));
await component.InvokeAsync(() => component.Instance.ExecuteTableCommandAsync("pasteCells"));
@@ -223,40 +205,137 @@ namespace Radzen.Blazor.Tests
Assert.Equal("Einfügen ist für diese Zellstruktur nicht möglich.", message.Detail);
}
[Theory]
[InlineData("insertTable")]
[InlineData("updateTable")]
[InlineData("addRowBefore")]
[InlineData("addRowAfter")]
[InlineData("addColumnBefore")]
[InlineData("addColumnAfter")]
[InlineData("deleteRow")]
[InlineData("deleteColumn")]
[InlineData("mergeCellRight")]
[InlineData("mergeCellDown")]
[InlineData("splitCell")]
[InlineData("deleteTable")]
public async Task HtmlEditor_ExecuteTableCommandAsync_RoundTrips_CommandState(string command)
{
using var ctx = CreateContext();
ctx.JSInterop.Setup<RadzenHtmlEditorCommandState>("Radzen.execTableCommand", invocation =>
invocation.Arguments.Count >= 2 && invocation.Arguments[1]?.ToString() == command)
.SetResult(new RadzenHtmlEditorCommandState
{
Success = true,
Html = $"<p>{command}</p>"
});
var component = ctx.RenderComponent<RadzenHtmlEditor>(parameters => parameters
.Add(p => p.Value, "<p>initial</p>"));
await component.InvokeAsync(() => component.Instance.ExecuteTableCommandAsync(command));
Assert.True(component.Instance.State.Success);
Assert.Equal($"<p>{command}</p>", component.Instance.State.Html);
}
[Fact]
public async Task HtmlEditor_ContextMenuTableCommand_DoesNotShowBlockedNotification_WhenCommandSucceeds()
{
using var ctx = CreateContext();
ctx.JSInterop.Setup<RadzenHtmlEditorCommandState>("Radzen.execTableCommand", invocation =>
invocation.Arguments.Count >= 2 && invocation.Arguments[1]?.ToString() == "addRowAfter")
.SetResult(new RadzenHtmlEditorCommandState
{
Success = true,
Html = "<table><tbody><tr><td>Cell</td></tr><tr><td>&nbsp;</td></tr></tbody></table>"
});
var component = ctx.RenderComponent<RadzenHtmlEditor>();
await component.InvokeAsync(() => component.Instance.ExecuteTableCommandAsync("addRowAfter"));
var notificationService = ctx.Services.GetRequiredService<NotificationService>();
Assert.Empty(notificationService.Messages);
Assert.True(component.Instance.State.Success);
}
[Fact]
public async Task HtmlEditor_GetTableSelectionAsync_RoundTrips_StyleFields()
{
using var ctx = CreateContext();
ctx.JSInterop.Setup<HtmlEditorTableSelection>("Radzen.getTableSelection", _ => true)
.SetResult(new HtmlEditorTableSelection
{
InTable = true,
ColumnWidthPx = 120,
CellPaddingPx = 8,
CellBorder = "1px solid red",
BorderStyle = "dashed",
BorderWidthPx = 2,
BorderColor = "red",
BorderTop = true,
BorderRight = true,
BorderBottom = false,
BorderLeft = true
});
var component = ctx.RenderComponent<RadzenHtmlEditor>();
var selection = await component.InvokeAsync(() => component.Instance.GetTableSelectionAsync().AsTask());
Assert.True(selection.InTable);
Assert.Equal(120, selection.ColumnWidthPx);
Assert.Equal(8, selection.CellPaddingPx);
Assert.Equal("1px solid red", selection.CellBorder);
Assert.Equal("dashed", selection.BorderStyle);
Assert.Equal(2, selection.BorderWidthPx);
Assert.Equal("red", selection.BorderColor);
Assert.True(selection.BorderTop);
Assert.True(selection.BorderRight);
Assert.False(selection.BorderBottom);
Assert.True(selection.BorderLeft);
}
[Fact]
public void HtmlEditorTable_UsesEditorTableTextFallbacks()
{
var editor = new RadzenHtmlEditor
{
TableDialogTitleText = "Tabelle einfügen",
TableRowsText = "Zeilen",
TableColumnsText = "Spalten",
TableWidthText = "Breite",
TableBorderText = "Rahmen",
TableHeaderRowText = "Kopfzeile einschließen",
TableEditText = "Tabelle bearbeiten",
TableOkText = "Einfügen",
TableUpdateText = "Aktualisieren",
TableCancelText = "Abbrechen",
TableInsertRowAboveText = "Zeile oben einfügen",
TableInsertColumnLeftText = "Spalte links einfügen",
TableColumnWidthText = "Spaltenbreite",
TableCellBackgroundText = "Zellhintergrund",
TableCellPaddingText = "Zellenabstand",
TableCellTextAlignText = "Horizontal",
TableCellVerticalAlignText = "Vertikal",
TableCellBorderText = "Zellrahmen",
TableColumnWidthPxText = "Spaltenbreite (px)",
TableCellPaddingPxText = "Zellenabstand (px)",
TableBorderStyleText = "Rahmenstil",
TableBorderWidthPxText = "Rahmenbreite (px)",
TableBorderColorText = "Rahmenfarbe",
TableBorderTopText = "Oben",
TableBorderRightText = "Rechts",
TableBorderBottomText = "Unten",
TableBorderLeftText = "Links",
TableDeleteText = "Tabelle entfernen",
TableMergeRightText = "Nach rechts verbinden"
TableStrings = new HtmlEditorTableStrings
{
DialogTitle = "Tabelle einfügen",
Rows = "Zeilen",
Columns = "Spalten",
Width = "Breite",
Border = "Rahmen",
HeaderRow = "Kopfzeile einschließen",
Edit = "Tabelle bearbeiten",
OK = "Einfügen",
Update = "Aktualisieren",
Cancel = "Abbrechen",
InsertRowAbove = "Zeile oben einfügen",
InsertColumnLeft = "Spalte links einfügen",
ColumnWidth = "Spaltenbreite",
CellBackground = "Zellhintergrund",
CellPadding = "Zellenabstand",
CellTextAlign = "Horizontal",
CellVerticalAlign = "Vertikal",
CellBorder = "Zellrahmen",
ColumnWidthPx = "Spaltenbreite (px)",
CellPaddingPx = "Zellenabstand (px)",
BorderStyle = "Rahmenstil",
BorderWidthPx = "Rahmenbreite (px)",
BorderColor = "Rahmenfarbe",
BorderTop = "Oben",
BorderRight = "Rechts",
BorderBottom = "Unten",
BorderLeft = "Links",
DeleteTable = "Tabelle entfernen",
MergeRight = "Nach rechts verbinden"
}
};
var component = new RadzenHtmlEditorTable

View File

@@ -0,0 +1,92 @@
namespace Radzen.Blazor;
/// <summary>
/// Provides localizable strings used by the table tools of <see cref="RadzenHtmlEditor" />.
/// </summary>
public class HtmlEditorTableStrings
{
/// <summary>Gets or sets the title used by the table dialog.</summary>
public string DialogTitle { get; set; } = "Insert table";
/// <summary>Gets or sets the rows label used by the table dialog.</summary>
public string Rows { get; set; } = "Rows";
/// <summary>Gets or sets the columns label used by the table dialog.</summary>
public string Columns { get; set; } = "Columns";
/// <summary>Gets or sets the width label used by the table dialog.</summary>
public string Width { get; set; } = "Width";
/// <summary>Gets or sets the border label used by the table dialog.</summary>
public string Border { get; set; } = "Border";
/// <summary>Gets or sets the header row toggle text used by the table dialog.</summary>
public string HeaderRow { get; set; } = "Include header row";
/// <summary>Gets or sets the edit section label used by the table dialog.</summary>
public string Edit { get; set; } = "Edit table";
/// <summary>Gets or sets the insert confirmation button text used by the table dialog.</summary>
public string OK { get; set; } = "OK";
/// <summary>Gets or sets the update confirmation button text used by the table dialog.</summary>
public string Update { get; set; } = "Update";
/// <summary>Gets or sets the cancel button text used by the table dialog.</summary>
public string Cancel { get; set; } = "Cancel";
/// <summary>Gets or sets the copy cells command text.</summary>
public string CopyCells { get; set; } = "Copy cells";
/// <summary>Gets or sets the paste cells command text.</summary>
public string PasteCells { get; set; } = "Paste cells";
/// <summary>Gets or sets the insert row above command text.</summary>
public string InsertRowAbove { get; set; } = "Insert row above";
/// <summary>Gets or sets the insert row below command text.</summary>
public string InsertRowBelow { get; set; } = "Insert row below";
/// <summary>Gets or sets the insert column left command text.</summary>
public string InsertColumnLeft { get; set; } = "Insert column left";
/// <summary>Gets or sets the insert column right command text.</summary>
public string InsertColumnRight { get; set; } = "Insert column right";
/// <summary>Gets or sets the delete row command text.</summary>
public string DeleteRow { get; set; } = "Delete row";
/// <summary>Gets or sets the delete column command text.</summary>
public string DeleteColumn { get; set; } = "Delete column";
/// <summary>Gets or sets the merge right command text.</summary>
public string MergeRight { get; set; } = "Merge right";
/// <summary>Gets or sets the merge down command text.</summary>
public string MergeDown { get; set; } = "Merge down";
/// <summary>Gets or sets the split cell command text.</summary>
public string SplitCell { get; set; } = "Split cell";
/// <summary>Gets or sets the delete table command text.</summary>
public string DeleteTable { get; set; } = "Delete table";
/// <summary>Gets or sets the column width label used by the table dialog.</summary>
public string ColumnWidth { get; set; } = "Column width";
/// <summary>Gets or sets the cell background label used by the table dialog.</summary>
public string CellBackground { get; set; } = "Cell background";
/// <summary>Gets or sets the cell padding label used by the table dialog.</summary>
public string CellPadding { get; set; } = "Cell padding";
/// <summary>Gets or sets the horizontal cell alignment label used by the table dialog.</summary>
public string CellTextAlign { get; set; } = "Horizontal align";
/// <summary>Gets or sets the vertical cell alignment label used by the table dialog.</summary>
public string CellVerticalAlign { get; set; } = "Vertical align";
/// <summary>Gets or sets the cell border label used by the table dialog.</summary>
public string CellBorder { get; set; } = "Cell border";
/// <summary>Gets or sets the column width in pixels label used by the table dialog.</summary>
public string ColumnWidthPx { get; set; } = "Column width (px)";
/// <summary>Gets or sets the cell padding in pixels label used by the table dialog.</summary>
public string CellPaddingPx { get; set; } = "Cell padding (px)";
/// <summary>Gets or sets the border style label used by the table dialog.</summary>
public string BorderStyle { get; set; } = "Border style";
/// <summary>Gets or sets the border width in pixels label used by the table dialog.</summary>
public string BorderWidthPx { get; set; } = "Border width (px)";
/// <summary>Gets or sets the border color label used by the table dialog.</summary>
public string BorderColor { get; set; } = "Border color";
/// <summary>Gets or sets the top border toggle text used by the table dialog.</summary>
public string BorderTop { get; set; } = "Top";
/// <summary>Gets or sets the right border toggle text used by the table dialog.</summary>
public string BorderRight { get; set; } = "Right";
/// <summary>Gets or sets the bottom border toggle text used by the table dialog.</summary>
public string BorderBottom { get; set; } = "Bottom";
/// <summary>Gets or sets the left border toggle text used by the table dialog.</summary>
public string BorderLeft { get; set; } = "Left";
/// <summary>Gets or sets the notification summary shown when a table action is blocked.</summary>
public string ActionBlocked { get; set; } = "Table action blocked";
/// <summary>Gets or sets the message shown when a table command requires the caret to be inside a table.</summary>
public string ActionRequiresTable { get; set; } = "Place the caret inside a table to use table actions.";
/// <summary>Gets or sets the message shown when the selected cells do not form a rectangular copy range.</summary>
public string CopyInvalidSelection { get; set; } = "Select a rectangular range of table cells before copying.";
/// <summary>Gets or sets the message shown when pasted cells would overlap merged cells or an irregular selection.</summary>
public string PasteBlocked { get; set; } = "The copied cells cannot be pasted over merged cells or an irregular selection.";
/// <summary>Gets or sets the message shown when the selected cells cannot be merged because they are not rectangular.</summary>
public string MergeInvalidSelection { get; set; } = "The selected cells must form a valid rectangular range before they can be merged.";
}

View File

@@ -45,16 +45,7 @@
<RadzenHtmlEditorLink />
<RadzenHtmlEditorUnlink />
<RadzenHtmlEditorImage />
<RadzenHtmlEditorTable />
<RadzenHtmlEditorTableCommandButton TableCommand="addRowBefore" Icon="north" Title="Insert row above" />
<RadzenHtmlEditorTableCommandButton TableCommand="addRowAfter" Icon="south" Title="Insert row below" />
<RadzenHtmlEditorTableCommandButton TableCommand="addColumnBefore" Icon="west" Title="Insert column left" />
<RadzenHtmlEditorTableCommandButton TableCommand="addColumnAfter" Icon="east" Title="Insert column right" />
<RadzenHtmlEditorTableCommandButton TableCommand="deleteRow" Icon="horizontal_rule" Title="Delete row" />
<RadzenHtmlEditorTableCommandButton TableCommand="deleteColumn" Icon="vertical_align_center" Title="Delete column" />
<RadzenHtmlEditorTableCommandButton TableCommand="mergeCellRight" Icon="merge_type" Title="Merge right" />
<RadzenHtmlEditorTableCommandButton TableCommand="mergeCellDown" Icon="merge" Title="Merge down" />
<RadzenHtmlEditorTableCommandButton TableCommand="splitCell" Icon="call_split" Title="Split cell" />
<RadzenHtmlEditorTableTools />
<RadzenHtmlEditorFontName />
<RadzenHtmlEditorFontSize />
<RadzenHtmlEditorFormatBlock />

View File

@@ -163,256 +163,10 @@ namespace Radzen.Blazor
public EventCallback<HtmlEditorExecuteEventArgs> Execute { get; set; }
/// <summary>
/// Specifies the title used by the table dialog.
/// Gets or sets localizable strings used by the table tools.
/// </summary>
[Parameter]
public string TableDialogTitleText { get; set; } = "Insert table";
/// <summary>
/// Specifies the text of the rows label used by the table dialog.
/// </summary>
[Parameter]
public string TableRowsText { get; set; } = "Rows";
/// <summary>
/// Specifies the text of the columns label used by the table dialog.
/// </summary>
[Parameter]
public string TableColumnsText { get; set; } = "Columns";
/// <summary>
/// Specifies the text of the width label used by the table dialog.
/// </summary>
[Parameter]
public string TableWidthText { get; set; } = "Width";
/// <summary>
/// Specifies the text of the border label used by the table dialog.
/// </summary>
[Parameter]
public string TableBorderText { get; set; } = "Border";
/// <summary>
/// Specifies the text of the header row toggle used by the table dialog.
/// </summary>
[Parameter]
public string TableHeaderRowText { get; set; } = "Include header row";
/// <summary>
/// Specifies the text of the edit section label used by the table dialog.
/// </summary>
[Parameter]
public string TableEditText { get; set; } = "Edit table";
/// <summary>
/// Specifies the text of the insert confirmation button used by the table dialog.
/// </summary>
[Parameter]
public string TableOkText { get; set; } = "OK";
/// <summary>
/// Specifies the text of the update confirmation button used by the table dialog.
/// </summary>
[Parameter]
public string TableUpdateText { get; set; } = "Update";
/// <summary>
/// Specifies the text of the cancel button used by the table dialog.
/// </summary>
[Parameter]
public string TableCancelText { get; set; } = "Cancel";
/// <summary>
/// Specifies the text of the column width label used by the table dialog.
/// </summary>
[Parameter]
public string TableColumnWidthText { get; set; } = "Column width";
/// <summary>
/// Specifies the text of the cell background label used by the table dialog.
/// </summary>
[Parameter]
public string TableCellBackgroundText { get; set; } = "Cell background";
/// <summary>
/// Specifies the text of the cell padding label used by the table dialog.
/// </summary>
[Parameter]
public string TableCellPaddingText { get; set; } = "Cell padding";
/// <summary>
/// Specifies the text of the horizontal cell alignment label used by the table dialog.
/// </summary>
[Parameter]
public string TableCellTextAlignText { get; set; } = "Horizontal align";
/// <summary>
/// Specifies the text of the vertical cell alignment label used by the table dialog.
/// </summary>
[Parameter]
public string TableCellVerticalAlignText { get; set; } = "Vertical align";
/// <summary>
/// Specifies the text of the cell border label used by the table dialog.
/// </summary>
[Parameter]
public string TableCellBorderText { get; set; } = "Cell border";
/// <summary>
/// Specifies the text of the column width in pixels label used by the table dialog.
/// </summary>
[Parameter]
public string TableColumnWidthPxText { get; set; } = "Column width (px)";
/// <summary>
/// Specifies the text of the cell padding in pixels label used by the table dialog.
/// </summary>
[Parameter]
public string TableCellPaddingPxText { get; set; } = "Cell padding (px)";
/// <summary>
/// Specifies the text of the border style label used by the table dialog.
/// </summary>
[Parameter]
public string TableBorderStyleText { get; set; } = "Border style";
/// <summary>
/// Specifies the text of the border width in pixels label used by the table dialog.
/// </summary>
[Parameter]
public string TableBorderWidthPxText { get; set; } = "Border width (px)";
/// <summary>
/// Specifies the text of the border color label used by the table dialog.
/// </summary>
[Parameter]
public string TableBorderColorText { get; set; } = "Border color";
/// <summary>
/// Specifies the text of the top border toggle used by the table dialog.
/// </summary>
[Parameter]
public string TableBorderTopText { get; set; } = "Top";
/// <summary>
/// Specifies the text of the right border toggle used by the table dialog.
/// </summary>
[Parameter]
public string TableBorderRightText { get; set; } = "Right";
/// <summary>
/// Specifies the text of the bottom border toggle used by the table dialog.
/// </summary>
[Parameter]
public string TableBorderBottomText { get; set; } = "Bottom";
/// <summary>
/// Specifies the text of the left border toggle used by the table dialog.
/// </summary>
[Parameter]
public string TableBorderLeftText { get; set; } = "Left";
/// <summary>
/// Specifies the notification summary shown when a table action is blocked.
/// </summary>
[Parameter]
public string TableActionBlockedText { get; set; } = "Table action blocked";
/// <summary>
/// Specifies the text of the context menu item which copies the selected table cells.
/// </summary>
[Parameter]
public string TableCopyCellsText { get; set; } = "Copy cells";
/// <summary>
/// Specifies the text of the context menu item which pastes copied table cells.
/// </summary>
[Parameter]
public string TablePasteCellsText { get; set; } = "Paste cells";
/// <summary>
/// Specifies the text of the context menu item which inserts a row above the current row.
/// </summary>
[Parameter]
public string TableInsertRowAboveText { get; set; } = "Insert row above";
/// <summary>
/// Specifies the text of the context menu item which inserts a row below the current row.
/// </summary>
[Parameter]
public string TableInsertRowBelowText { get; set; } = "Insert row below";
/// <summary>
/// Specifies the text of the context menu item which inserts a column to the left.
/// </summary>
[Parameter]
public string TableInsertColumnLeftText { get; set; } = "Insert column left";
/// <summary>
/// Specifies the text of the context menu item which inserts a column to the right.
/// </summary>
[Parameter]
public string TableInsertColumnRightText { get; set; } = "Insert column right";
/// <summary>
/// Specifies the text of the context menu item which deletes the current row.
/// </summary>
[Parameter]
public string TableDeleteRowText { get; set; } = "Delete row";
/// <summary>
/// Specifies the text of the context menu item which deletes the current column.
/// </summary>
[Parameter]
public string TableDeleteColumnText { get; set; } = "Delete column";
/// <summary>
/// Specifies the text of the context menu item which merges the current cell with the cell to the right.
/// </summary>
[Parameter]
public string TableMergeRightText { get; set; } = "Merge right";
/// <summary>
/// Specifies the text of the context menu item which merges the current cell with the cell below.
/// </summary>
[Parameter]
public string TableMergeDownText { get; set; } = "Merge down";
/// <summary>
/// Specifies the text of the context menu item which splits the current merged cell.
/// </summary>
[Parameter]
public string TableSplitCellText { get; set; } = "Split cell";
/// <summary>
/// Specifies the text of the context menu item which deletes the current table.
/// </summary>
[Parameter]
public string TableDeleteText { get; set; } = "Delete table";
/// <summary>
/// Specifies the message shown when a table command requires the caret to be inside a table.
/// </summary>
[Parameter]
public string TableActionRequiresTableText { get; set; } = "Place the caret inside a table to use table actions.";
/// <summary>
/// Specifies the message shown when the selected cells do not form a rectangular copy range.
/// </summary>
[Parameter]
public string TableCopyInvalidSelectionText { get; set; } = "Select a rectangular range of table cells before copying.";
/// <summary>
/// Specifies the message shown when pasted cells would overlap merged cells or an irregular selection.
/// </summary>
[Parameter]
public string TablePasteBlockedText { get; set; } = "The copied cells cannot be pasted over merged cells or an irregular selection.";
/// <summary>
/// Specifies the message shown when the selected cells cannot be merged because they are not rectangular.
/// </summary>
[Parameter]
public string TableMergeInvalidSelectionText { get; set; } = "The selected cells must form a valid rectangular range before they can be merged.";
public HtmlEditorTableStrings TableStrings { get; set; } = new();
/// <summary>
/// Specifies the URL to which RadzenHtmlEditor will submit files.
@@ -506,18 +260,18 @@ namespace Radzen.Blazor
var items = new List<ContextMenuItem>
{
new ContextMenuItem { Text = TableCopyCellsText, Value = "copyCells", Icon = "content_copy" },
new ContextMenuItem { Text = TablePasteCellsText, Value = "pasteCells", Icon = "content_paste" },
new ContextMenuItem { Text = TableInsertRowAboveText, Value = "addRowBefore", Icon = "north" },
new ContextMenuItem { Text = TableInsertRowBelowText, Value = "addRowAfter", Icon = "south" },
new ContextMenuItem { Text = TableInsertColumnLeftText, Value = "addColumnBefore", Icon = "west" },
new ContextMenuItem { Text = TableInsertColumnRightText, Value = "addColumnAfter", Icon = "east" },
new ContextMenuItem { Text = TableDeleteRowText, Value = "deleteRow", Icon = "horizontal_rule" },
new ContextMenuItem { Text = TableDeleteColumnText, Value = "deleteColumn", Icon = "vertical_align_center" },
new ContextMenuItem { Text = TableMergeRightText, Value = "mergeCellRight", Icon = "merge_type", Disabled = !TableSelection.CanMergeRight },
new ContextMenuItem { Text = TableMergeDownText, Value = "mergeCellDown", Icon = "merge", Disabled = !TableSelection.CanMergeDown },
new ContextMenuItem { Text = TableSplitCellText, Value = "splitCell", Icon = "call_split", Disabled = !TableSelection.CanSplit },
new ContextMenuItem { Text = TableDeleteText, Value = "deleteTable", Icon = "delete", IconColor = "var(--rz-danger)", Disabled = !TableSelection.InTable }
new ContextMenuItem { Text = TableStrings.CopyCells, Value = "copyCells", Icon = "content_copy" },
new ContextMenuItem { Text = TableStrings.PasteCells, Value = "pasteCells", Icon = "content_paste" },
new ContextMenuItem { Text = TableStrings.InsertRowAbove, Value = "addRowBefore", Icon = "north" },
new ContextMenuItem { Text = TableStrings.InsertRowBelow, Value = "addRowAfter", Icon = "south" },
new ContextMenuItem { Text = TableStrings.InsertColumnLeft, Value = "addColumnBefore", Icon = "west" },
new ContextMenuItem { Text = TableStrings.InsertColumnRight, Value = "addColumnAfter", Icon = "east" },
new ContextMenuItem { Text = TableStrings.DeleteRow, Value = "deleteRow", Icon = "horizontal_rule" },
new ContextMenuItem { Text = TableStrings.DeleteColumn, Value = "deleteColumn", Icon = "vertical_align_center" },
new ContextMenuItem { Text = TableStrings.MergeRight, Value = "mergeCellRight", Icon = "merge_type", Disabled = !TableSelection.CanMergeRight },
new ContextMenuItem { Text = TableStrings.MergeDown, Value = "mergeCellDown", Icon = "merge", Disabled = !TableSelection.CanMergeDown },
new ContextMenuItem { Text = TableStrings.SplitCell, Value = "splitCell", Icon = "call_split", Disabled = !TableSelection.CanSplit },
new ContextMenuItem { Text = TableStrings.DeleteTable, Value = "deleteTable", Icon = "delete", IconColor = "var(--rz-danger)", Disabled = !TableSelection.InTable }
};
var args = new MouseEventArgs { ClientX = clientX, ClientY = clientY, Button = 2, Type = "contextmenu" };
@@ -665,7 +419,7 @@ namespace Radzen.Blazor
if (State?.Success == false && !string.IsNullOrEmpty(State.Message))
{
NotificationService?.Notify(NotificationSeverity.Warning, TableActionBlockedText, GetTableCommandMessage(State.Message), 4000);
NotificationService?.Notify(NotificationSeverity.Warning, TableStrings.ActionBlocked, GetTableCommandMessage(State.Message), 4000);
await UpdateTableSelectionAsync();
StateHasChanged();
return;
@@ -710,10 +464,10 @@ namespace Radzen.Blazor
{
return message switch
{
"table.action.requiresTable" => TableActionRequiresTableText,
"table.copy.invalidSelection" => TableCopyInvalidSelectionText,
"table.paste.blocked" => TablePasteBlockedText,
"table.merge.invalidSelection" => TableMergeInvalidSelectionText,
"table.action.requiresTable" => TableStrings.ActionRequiresTable,
"table.copy.invalidSelection" => TableStrings.CopyInvalidSelection,
"table.paste.blocked" => TableStrings.PasteBlocked,
"table.merge.invalidSelection" => TableStrings.MergeInvalidSelection,
_ => message
};
}

View File

@@ -27,316 +27,316 @@ namespace Radzen.Blazor
/// <summary>
/// Specifies the title (tooltip) displayed when the user hovers the tool.
/// Falls back to <see cref="RadzenHtmlEditor.TableDialogTitleText"/> when available, otherwise <c>"Insert table"</c>.
/// Falls back to <see cref="RadzenHtmlEditor.TableStrings"/> when available, otherwise <c>"Insert table"</c>.
/// </summary>
[Parameter]
public string Title { get => title ?? Editor?.TableDialogTitleText ?? "Insert table"; set => title = value; }
public string Title { get => title ?? Editor?.TableStrings.DialogTitle ?? "Insert table"; set => title = value; }
string? rowsText;
/// <summary>
/// Specifies the text of the label for the number of rows.
/// Falls back to <see cref="RadzenHtmlEditor.TableRowsText"/> when available, otherwise <c>"Rows"</c>.
/// Falls back to <see cref="RadzenHtmlEditor.TableStrings"/> when available, otherwise <c>"Rows"</c>.
/// </summary>
[Parameter]
public string RowsText { get => rowsText ?? Editor?.TableRowsText ?? "Rows"; set => rowsText = value; }
public string RowsText { get => rowsText ?? Editor?.TableStrings.Rows ?? "Rows"; set => rowsText = value; }
string? columnsText;
/// <summary>
/// Specifies the text of the label for the number of columns.
/// Falls back to <see cref="RadzenHtmlEditor.TableColumnsText"/> when available, otherwise <c>"Columns"</c>.
/// Falls back to <see cref="RadzenHtmlEditor.TableStrings"/> when available, otherwise <c>"Columns"</c>.
/// </summary>
[Parameter]
public string ColumnsText { get => columnsText ?? Editor?.TableColumnsText ?? "Columns"; set => columnsText = value; }
public string ColumnsText { get => columnsText ?? Editor?.TableStrings.Columns ?? "Columns"; set => columnsText = value; }
string? widthText;
/// <summary>
/// Specifies the text of the label for the table width.
/// Falls back to <see cref="RadzenHtmlEditor.TableWidthText"/> when available, otherwise <c>"Width"</c>.
/// Falls back to <see cref="RadzenHtmlEditor.TableStrings"/> when available, otherwise <c>"Width"</c>.
/// </summary>
[Parameter]
public string WidthText { get => widthText ?? Editor?.TableWidthText ?? "Width"; set => widthText = value; }
public string WidthText { get => widthText ?? Editor?.TableStrings.Width ?? "Width"; set => widthText = value; }
string? borderText;
/// <summary>
/// Specifies the text of the label for the table border.
/// Falls back to <see cref="RadzenHtmlEditor.TableBorderText"/> when available, otherwise <c>"Border"</c>.
/// Falls back to <see cref="RadzenHtmlEditor.TableStrings"/> when available, otherwise <c>"Border"</c>.
/// </summary>
[Parameter]
public string BorderText { get => borderText ?? Editor?.TableBorderText ?? "Border"; set => borderText = value; }
public string BorderText { get => borderText ?? Editor?.TableStrings.Border ?? "Border"; set => borderText = value; }
string? headerRowText;
/// <summary>
/// Specifies the text of the header row checkbox.
/// Falls back to <see cref="RadzenHtmlEditor.TableHeaderRowText"/> when available, otherwise <c>"Include header row"</c>.
/// Falls back to <see cref="RadzenHtmlEditor.TableStrings"/> when available, otherwise <c>"Include header row"</c>.
/// </summary>
[Parameter]
public string HeaderRowText { get => headerRowText ?? Editor?.TableHeaderRowText ?? "Include header row"; set => headerRowText = value; }
public string HeaderRowText { get => headerRowText ?? Editor?.TableStrings.HeaderRow ?? "Include header row"; set => headerRowText = value; }
string? editText;
/// <summary>
/// Specifies the text of the table edit section.
/// Falls back to <see cref="RadzenHtmlEditor.TableEditText"/> when available, otherwise <c>"Edit table"</c>.
/// Falls back to <see cref="RadzenHtmlEditor.TableStrings"/> when available, otherwise <c>"Edit table"</c>.
/// </summary>
[Parameter]
public string EditText { get => editText ?? Editor?.TableEditText ?? "Edit table"; set => editText = value; }
public string EditText { get => editText ?? Editor?.TableStrings.Edit ?? "Edit table"; set => editText = value; }
string? okText;
/// <summary>
/// Specifies the text of button which inserts the table.
/// Falls back to <see cref="RadzenHtmlEditor.TableOkText"/> when available, otherwise <c>"OK"</c>.
/// Falls back to <see cref="RadzenHtmlEditor.TableStrings"/> when available, otherwise <c>"OK"</c>.
/// </summary>
[Parameter]
public string OkText { get => okText ?? Editor?.TableOkText ?? "OK"; set => okText = value; }
public string OkText { get => okText ?? Editor?.TableStrings.OK ?? "OK"; set => okText = value; }
string? updateText;
/// <summary>
/// Specifies the text of button which updates the selected table.
/// Falls back to <see cref="RadzenHtmlEditor.TableUpdateText"/> when available, otherwise <c>"Update"</c>.
/// Falls back to <see cref="RadzenHtmlEditor.TableStrings"/> when available, otherwise <c>"Update"</c>.
/// </summary>
[Parameter]
public string UpdateText { get => updateText ?? Editor?.TableUpdateText ?? "Update"; set => updateText = value; }
public string UpdateText { get => updateText ?? Editor?.TableStrings.Update ?? "Update"; set => updateText = value; }
string? cancelText;
/// <summary>
/// Specifies the text of button which cancels table insertion and closes the dialog.
/// Falls back to <see cref="RadzenHtmlEditor.TableCancelText"/> when available, otherwise <c>"Cancel"</c>.
/// Falls back to <see cref="RadzenHtmlEditor.TableStrings"/> when available, otherwise <c>"Cancel"</c>.
/// </summary>
[Parameter]
public string CancelText { get => cancelText ?? Editor?.TableCancelText ?? "Cancel"; set => cancelText = value; }
public string CancelText { get => cancelText ?? Editor?.TableStrings.Cancel ?? "Cancel"; set => cancelText = value; }
string? insertRowAboveText;
/// <summary>
/// Specifies the text of the button which inserts a row above the current row.
/// Falls back to <see cref="RadzenHtmlEditor.TableInsertRowAboveText"/> when available, otherwise <c>"Insert row above"</c>.
/// Falls back to <see cref="RadzenHtmlEditor.TableStrings"/> when available, otherwise <c>"Insert row above"</c>.
/// </summary>
[Parameter]
public string InsertRowAboveText { get => insertRowAboveText ?? Editor?.TableInsertRowAboveText ?? "Insert row above"; set => insertRowAboveText = value; }
public string InsertRowAboveText { get => insertRowAboveText ?? Editor?.TableStrings.InsertRowAbove ?? "Insert row above"; set => insertRowAboveText = value; }
string? insertRowBelowText;
/// <summary>
/// Specifies the text of the button which inserts a row below the current row.
/// Falls back to <see cref="RadzenHtmlEditor.TableInsertRowBelowText"/> when available, otherwise <c>"Insert row below"</c>.
/// Falls back to <see cref="RadzenHtmlEditor.TableStrings"/> when available, otherwise <c>"Insert row below"</c>.
/// </summary>
[Parameter]
public string InsertRowBelowText { get => insertRowBelowText ?? Editor?.TableInsertRowBelowText ?? "Insert row below"; set => insertRowBelowText = value; }
public string InsertRowBelowText { get => insertRowBelowText ?? Editor?.TableStrings.InsertRowBelow ?? "Insert row below"; set => insertRowBelowText = value; }
string? insertColumnLeftText;
/// <summary>
/// Specifies the text of the button which inserts a column to the left.
/// Falls back to <see cref="RadzenHtmlEditor.TableInsertColumnLeftText"/> when available, otherwise <c>"Insert column left"</c>.
/// Falls back to <see cref="RadzenHtmlEditor.TableStrings"/> when available, otherwise <c>"Insert column left"</c>.
/// </summary>
[Parameter]
public string InsertColumnLeftText { get => insertColumnLeftText ?? Editor?.TableInsertColumnLeftText ?? "Insert column left"; set => insertColumnLeftText = value; }
public string InsertColumnLeftText { get => insertColumnLeftText ?? Editor?.TableStrings.InsertColumnLeft ?? "Insert column left"; set => insertColumnLeftText = value; }
string? insertColumnRightText;
/// <summary>
/// Specifies the text of the button which inserts a column to the right.
/// Falls back to <see cref="RadzenHtmlEditor.TableInsertColumnRightText"/> when available, otherwise <c>"Insert column right"</c>.
/// Falls back to <see cref="RadzenHtmlEditor.TableStrings"/> when available, otherwise <c>"Insert column right"</c>.
/// </summary>
[Parameter]
public string InsertColumnRightText { get => insertColumnRightText ?? Editor?.TableInsertColumnRightText ?? "Insert column right"; set => insertColumnRightText = value; }
public string InsertColumnRightText { get => insertColumnRightText ?? Editor?.TableStrings.InsertColumnRight ?? "Insert column right"; set => insertColumnRightText = value; }
string? deleteRowText;
/// <summary>
/// Specifies the text of the button which deletes the current row.
/// Falls back to <see cref="RadzenHtmlEditor.TableDeleteRowText"/> when available, otherwise <c>"Delete row"</c>.
/// Falls back to <see cref="RadzenHtmlEditor.TableStrings"/> when available, otherwise <c>"Delete row"</c>.
/// </summary>
[Parameter]
public string DeleteRowText { get => deleteRowText ?? Editor?.TableDeleteRowText ?? "Delete row"; set => deleteRowText = value; }
public string DeleteRowText { get => deleteRowText ?? Editor?.TableStrings.DeleteRow ?? "Delete row"; set => deleteRowText = value; }
string? deleteColumnText;
/// <summary>
/// Specifies the text of the button which deletes the current column.
/// Falls back to <see cref="RadzenHtmlEditor.TableDeleteColumnText"/> when available, otherwise <c>"Delete column"</c>.
/// Falls back to <see cref="RadzenHtmlEditor.TableStrings"/> when available, otherwise <c>"Delete column"</c>.
/// </summary>
[Parameter]
public string DeleteColumnText { get => deleteColumnText ?? Editor?.TableDeleteColumnText ?? "Delete column"; set => deleteColumnText = value; }
public string DeleteColumnText { get => deleteColumnText ?? Editor?.TableStrings.DeleteColumn ?? "Delete column"; set => deleteColumnText = value; }
string? deleteTableText;
/// <summary>
/// Specifies the text of the button which deletes the current table.
/// Falls back to <see cref="RadzenHtmlEditor.TableDeleteText"/> when available, otherwise <c>"Delete table"</c>.
/// Falls back to <see cref="RadzenHtmlEditor.TableStrings"/> when available, otherwise <c>"Delete table"</c>.
/// </summary>
[Parameter]
public string DeleteTableText { get => deleteTableText ?? Editor?.TableDeleteText ?? "Delete table"; set => deleteTableText = value; }
public string DeleteTableText { get => deleteTableText ?? Editor?.TableStrings.DeleteTable ?? "Delete table"; set => deleteTableText = value; }
string? mergeRightText;
/// <summary>
/// Specifies the text of the button which merges the current cell with the cell to the right.
/// Falls back to <see cref="RadzenHtmlEditor.TableMergeRightText"/> when available, otherwise <c>"Merge right"</c>.
/// Falls back to <see cref="RadzenHtmlEditor.TableStrings"/> when available, otherwise <c>"Merge right"</c>.
/// </summary>
[Parameter]
public string MergeRightText { get => mergeRightText ?? Editor?.TableMergeRightText ?? "Merge right"; set => mergeRightText = value; }
public string MergeRightText { get => mergeRightText ?? Editor?.TableStrings.MergeRight ?? "Merge right"; set => mergeRightText = value; }
string? mergeDownText;
/// <summary>
/// Specifies the text of the button which merges the current cell with the cell below.
/// Falls back to <see cref="RadzenHtmlEditor.TableMergeDownText"/> when available, otherwise <c>"Merge down"</c>.
/// Falls back to <see cref="RadzenHtmlEditor.TableStrings"/> when available, otherwise <c>"Merge down"</c>.
/// </summary>
[Parameter]
public string MergeDownText { get => mergeDownText ?? Editor?.TableMergeDownText ?? "Merge down"; set => mergeDownText = value; }
public string MergeDownText { get => mergeDownText ?? Editor?.TableStrings.MergeDown ?? "Merge down"; set => mergeDownText = value; }
string? splitCellText;
/// <summary>
/// Specifies the text of the button which splits the current merged cell.
/// Falls back to <see cref="RadzenHtmlEditor.TableSplitCellText"/> when available, otherwise <c>"Split cell"</c>.
/// Falls back to <see cref="RadzenHtmlEditor.TableStrings"/> when available, otherwise <c>"Split cell"</c>.
/// </summary>
[Parameter]
public string SplitCellText { get => splitCellText ?? Editor?.TableSplitCellText ?? "Split cell"; set => splitCellText = value; }
public string SplitCellText { get => splitCellText ?? Editor?.TableStrings.SplitCell ?? "Split cell"; set => splitCellText = value; }
string? columnWidthText;
/// <summary>
/// Specifies the text of the label for the selected column width.
/// Falls back to <see cref="RadzenHtmlEditor.TableColumnWidthText"/> when available, otherwise <c>"Column width"</c>.
/// Falls back to <see cref="RadzenHtmlEditor.TableStrings"/> when available, otherwise <c>"Column width"</c>.
/// </summary>
[Parameter]
public string ColumnWidthText { get => columnWidthText ?? Editor?.TableColumnWidthText ?? "Column width"; set => columnWidthText = value; }
public string ColumnWidthText { get => columnWidthText ?? Editor?.TableStrings.ColumnWidth ?? "Column width"; set => columnWidthText = value; }
string? cellBackgroundText;
/// <summary>
/// Specifies the text of the label for the selected cell background.
/// Falls back to <see cref="RadzenHtmlEditor.TableCellBackgroundText"/> when available, otherwise <c>"Cell background"</c>.
/// Falls back to <see cref="RadzenHtmlEditor.TableStrings"/> when available, otherwise <c>"Cell background"</c>.
/// </summary>
[Parameter]
public string CellBackgroundText { get => cellBackgroundText ?? Editor?.TableCellBackgroundText ?? "Cell background"; set => cellBackgroundText = value; }
public string CellBackgroundText { get => cellBackgroundText ?? Editor?.TableStrings.CellBackground ?? "Cell background"; set => cellBackgroundText = value; }
string? cellPaddingText;
/// <summary>
/// Specifies the text of the label for the selected cell padding.
/// Falls back to <see cref="RadzenHtmlEditor.TableCellPaddingText"/> when available, otherwise <c>"Cell padding"</c>.
/// Falls back to <see cref="RadzenHtmlEditor.TableStrings"/> when available, otherwise <c>"Cell padding"</c>.
/// </summary>
[Parameter]
public string CellPaddingText { get => cellPaddingText ?? Editor?.TableCellPaddingText ?? "Cell padding"; set => cellPaddingText = value; }
public string CellPaddingText { get => cellPaddingText ?? Editor?.TableStrings.CellPadding ?? "Cell padding"; set => cellPaddingText = value; }
string? cellTextAlignText;
/// <summary>
/// Specifies the text of the label for horizontal cell alignment.
/// Falls back to <see cref="RadzenHtmlEditor.TableCellTextAlignText"/> when available, otherwise <c>"Horizontal align"</c>.
/// Falls back to <see cref="RadzenHtmlEditor.TableStrings"/> when available, otherwise <c>"Horizontal align"</c>.
/// </summary>
[Parameter]
public string CellTextAlignText { get => cellTextAlignText ?? Editor?.TableCellTextAlignText ?? "Horizontal align"; set => cellTextAlignText = value; }
public string CellTextAlignText { get => cellTextAlignText ?? Editor?.TableStrings.CellTextAlign ?? "Horizontal align"; set => cellTextAlignText = value; }
string? cellVerticalAlignText;
/// <summary>
/// Specifies the text of the label for vertical cell alignment.
/// Falls back to <see cref="RadzenHtmlEditor.TableCellVerticalAlignText"/> when available, otherwise <c>"Vertical align"</c>.
/// Falls back to <see cref="RadzenHtmlEditor.TableStrings"/> when available, otherwise <c>"Vertical align"</c>.
/// </summary>
[Parameter]
public string CellVerticalAlignText { get => cellVerticalAlignText ?? Editor?.TableCellVerticalAlignText ?? "Vertical align"; set => cellVerticalAlignText = value; }
public string CellVerticalAlignText { get => cellVerticalAlignText ?? Editor?.TableStrings.CellVerticalAlign ?? "Vertical align"; set => cellVerticalAlignText = value; }
string? cellBorderText;
/// <summary>
/// Specifies the text of the label for the selected cell border.
/// Falls back to <see cref="RadzenHtmlEditor.TableCellBorderText"/> when available, otherwise <c>"Cell border"</c>.
/// Falls back to <see cref="RadzenHtmlEditor.TableStrings"/> when available, otherwise <c>"Cell border"</c>.
/// </summary>
[Parameter]
public string CellBorderText { get => cellBorderText ?? Editor?.TableCellBorderText ?? "Cell border"; set => cellBorderText = value; }
public string CellBorderText { get => cellBorderText ?? Editor?.TableStrings.CellBorder ?? "Cell border"; set => cellBorderText = value; }
string? columnWidthPxText;
/// <summary>
/// Specifies the text of the label for column width in pixels.
/// Falls back to <see cref="RadzenHtmlEditor.TableColumnWidthPxText"/> when available, otherwise <c>"Column width (px)"</c>.
/// Falls back to <see cref="RadzenHtmlEditor.TableStrings"/> when available, otherwise <c>"Column width (px)"</c>.
/// </summary>
[Parameter]
public string ColumnWidthPxText { get => columnWidthPxText ?? Editor?.TableColumnWidthPxText ?? "Column width (px)"; set => columnWidthPxText = value; }
public string ColumnWidthPxText { get => columnWidthPxText ?? Editor?.TableStrings.ColumnWidthPx ?? "Column width (px)"; set => columnWidthPxText = value; }
string? cellPaddingPxText;
/// <summary>
/// Specifies the text of the label for cell padding in pixels.
/// Falls back to <see cref="RadzenHtmlEditor.TableCellPaddingPxText"/> when available, otherwise <c>"Cell padding (px)"</c>.
/// Falls back to <see cref="RadzenHtmlEditor.TableStrings"/> when available, otherwise <c>"Cell padding (px)"</c>.
/// </summary>
[Parameter]
public string CellPaddingPxText { get => cellPaddingPxText ?? Editor?.TableCellPaddingPxText ?? "Cell padding (px)"; set => cellPaddingPxText = value; }
public string CellPaddingPxText { get => cellPaddingPxText ?? Editor?.TableStrings.CellPaddingPx ?? "Cell padding (px)"; set => cellPaddingPxText = value; }
string? borderStyleText;
/// <summary>
/// Specifies the text of the label for the border style.
/// Falls back to <see cref="RadzenHtmlEditor.TableBorderStyleText"/> when available, otherwise <c>"Border style"</c>.
/// Falls back to <see cref="RadzenHtmlEditor.TableStrings"/> when available, otherwise <c>"Border style"</c>.
/// </summary>
[Parameter]
public string BorderStyleText { get => borderStyleText ?? Editor?.TableBorderStyleText ?? "Border style"; set => borderStyleText = value; }
public string BorderStyleText { get => borderStyleText ?? Editor?.TableStrings.BorderStyle ?? "Border style"; set => borderStyleText = value; }
string? borderWidthPxText;
/// <summary>
/// Specifies the text of the label for the border width in pixels.
/// Falls back to <see cref="RadzenHtmlEditor.TableBorderWidthPxText"/> when available, otherwise <c>"Border width (px)"</c>.
/// Falls back to <see cref="RadzenHtmlEditor.TableStrings"/> when available, otherwise <c>"Border width (px)"</c>.
/// </summary>
[Parameter]
public string BorderWidthPxText { get => borderWidthPxText ?? Editor?.TableBorderWidthPxText ?? "Border width (px)"; set => borderWidthPxText = value; }
public string BorderWidthPxText { get => borderWidthPxText ?? Editor?.TableStrings.BorderWidthPx ?? "Border width (px)"; set => borderWidthPxText = value; }
string? borderColorText;
/// <summary>
/// Specifies the text of the label for the border color.
/// Falls back to <see cref="RadzenHtmlEditor.TableBorderColorText"/> when available, otherwise <c>"Border color"</c>.
/// Falls back to <see cref="RadzenHtmlEditor.TableStrings"/> when available, otherwise <c>"Border color"</c>.
/// </summary>
[Parameter]
public string BorderColorText { get => borderColorText ?? Editor?.TableBorderColorText ?? "Border color"; set => borderColorText = value; }
public string BorderColorText { get => borderColorText ?? Editor?.TableStrings.BorderColor ?? "Border color"; set => borderColorText = value; }
string? borderTopText;
/// <summary>
/// Specifies the text of the top border checkbox.
/// Falls back to <see cref="RadzenHtmlEditor.TableBorderTopText"/> when available, otherwise <c>"Top"</c>.
/// Falls back to <see cref="RadzenHtmlEditor.TableStrings"/> when available, otherwise <c>"Top"</c>.
/// </summary>
[Parameter]
public string BorderTopText { get => borderTopText ?? Editor?.TableBorderTopText ?? "Top"; set => borderTopText = value; }
public string BorderTopText { get => borderTopText ?? Editor?.TableStrings.BorderTop ?? "Top"; set => borderTopText = value; }
string? borderRightText;
/// <summary>
/// Specifies the text of the right border checkbox.
/// Falls back to <see cref="RadzenHtmlEditor.TableBorderRightText"/> when available, otherwise <c>"Right"</c>.
/// Falls back to <see cref="RadzenHtmlEditor.TableStrings"/> when available, otherwise <c>"Right"</c>.
/// </summary>
[Parameter]
public string BorderRightText { get => borderRightText ?? Editor?.TableBorderRightText ?? "Right"; set => borderRightText = value; }
public string BorderRightText { get => borderRightText ?? Editor?.TableStrings.BorderRight ?? "Right"; set => borderRightText = value; }
string? borderBottomText;
/// <summary>
/// Specifies the text of the bottom border checkbox.
/// Falls back to <see cref="RadzenHtmlEditor.TableBorderBottomText"/> when available, otherwise <c>"Bottom"</c>.
/// Falls back to <see cref="RadzenHtmlEditor.TableStrings"/> when available, otherwise <c>"Bottom"</c>.
/// </summary>
[Parameter]
public string BorderBottomText { get => borderBottomText ?? Editor?.TableBorderBottomText ?? "Bottom"; set => borderBottomText = value; }
public string BorderBottomText { get => borderBottomText ?? Editor?.TableStrings.BorderBottom ?? "Bottom"; set => borderBottomText = value; }
string? borderLeftText;
/// <summary>
/// Specifies the text of the left border checkbox.
/// Falls back to <see cref="RadzenHtmlEditor.TableBorderLeftText"/> when available, otherwise <c>"Left"</c>.
/// Falls back to <see cref="RadzenHtmlEditor.TableStrings"/> when available, otherwise <c>"Left"</c>.
/// </summary>
[Parameter]
public string BorderLeftText { get => borderLeftText ?? Editor?.TableBorderLeftText ?? "Left"; set => borderLeftText = value; }
public string BorderLeftText { get => borderLeftText ?? Editor?.TableStrings.BorderLeft ?? "Left"; set => borderLeftText = value; }
/// <summary>
/// Specifies the default number of rows. Set to <c>2</c> by default.

View File

@@ -0,0 +1,16 @@
@inherits RadzenHtmlEditorButtonBase
<RadzenHtmlEditorTable />
<RadzenHtmlEditorTableCommandButton TableCommand="addRowBefore" Icon="north" Title="@Strings.InsertRowAbove" />
<RadzenHtmlEditorTableCommandButton TableCommand="addRowAfter" Icon="south" Title="@Strings.InsertRowBelow" />
<RadzenHtmlEditorTableCommandButton TableCommand="addColumnBefore" Icon="west" Title="@Strings.InsertColumnLeft" />
<RadzenHtmlEditorTableCommandButton TableCommand="addColumnAfter" Icon="east" Title="@Strings.InsertColumnRight" />
<RadzenHtmlEditorTableCommandButton TableCommand="deleteRow" Icon="horizontal_rule" Title="@Strings.DeleteRow" />
<RadzenHtmlEditorTableCommandButton TableCommand="deleteColumn" Icon="vertical_align_center" Title="@Strings.DeleteColumn" />
<RadzenHtmlEditorTableCommandButton TableCommand="mergeCellRight" Icon="merge_type" Title="@Strings.MergeRight" />
<RadzenHtmlEditorTableCommandButton TableCommand="mergeCellDown" Icon="merge" Title="@Strings.MergeDown" />
<RadzenHtmlEditorTableCommandButton TableCommand="splitCell" Icon="call_split" Title="@Strings.SplitCell" />
@code {
HtmlEditorTableStrings Strings => TableStrings ?? Editor?.TableStrings ?? new HtmlEditorTableStrings();
}

View File

@@ -0,0 +1,16 @@
using Microsoft.AspNetCore.Components;
namespace Radzen.Blazor
{
/// <summary>
/// A built-in HTML editor toolbar group for table insertion and table commands.
/// </summary>
public partial class RadzenHtmlEditorTableTools : RadzenHtmlEditorButtonBase
{
/// <summary>
/// Gets or sets localizable strings used by the table tools. Falls back to <see cref="RadzenHtmlEditor.TableStrings" />.
/// </summary>
[Parameter]
public HtmlEditorTableStrings? TableStrings { get; set; }
}
}

File diff suppressed because it is too large Load Diff