且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

无法向同步富文本编辑器添加表格选项

更新时间:2023-12-06 14:18:28

从版本 16.3.21 开始提供对 EJ2 富文本编辑器控件中表格的支持.有关详细信息,请参阅发行说明.

The support for tables in EJ2 Rich Text Editor control was provided from the version 16.3.21. Refer to the release notes for more information.

您可以使用特定于版本的 CDN 文件来确保您最终使用它.请参考以下链接:

You can use a version specific CDN files to ensure it in your end. Refer to the following links:

脚本:http://cdn.syncfusion.com/ej2/16.3.21/dist/ej2.min.js
主题:https://cdn.syncfusion.com/ej2/16.3.21/材质.css

要在 RTE 的工具栏中启用表格,您需要将其添加到工具列表中,如以下代码所示.

To enable tables in the RTE’s toolbar, you need to add it to the toolslist as shown in the following code.

[查看]

@Html.EJS().RichTextEditor("default").ToolbarSettings(e => e.Items((object)ViewBag.tools)).Value((string)ViewBag.value).Render() 

[控制器]

public ActionResult Index() 
{ 
    ViewBag.value = @"<p>The rich text editor is WYSIWYG ('what you see is what you get') editor useful to create and edit content</p>"; 

    ViewBag.tools = new[] { "Bold", "Italic", "Underline", "StrikeThrough", 
                    "FontName", "FontSize", "FontColor", "BackgroundColor", 
                    "LowerCase", "UpperCase", "|", 
                    "Formats", "Alignments", "OrderedList", "UnorderedList", 
                    "Outdent", "Indent", "|", 
                    "CreateTable", "CreateLink", "Image", "|", "ClearFormat", "Print", 
                    "SourceCode", "FullScreen", "|", "Undo", "Redo" }; 
    return View(); 
}

确保您已在 _layout.cshtml 页面中包含相关脚本和主题文件.如需更多信息,请参阅入门文档

Make sure that you have included the dependent scripts and theme files in the _layout.cshtml page. For further information, refer to the Getting Started documentation

示例