Editor Tools

1 Answer 128 Views
Editor Toolbar
Harry Anderson
Top achievements
Rank 1
Harry Anderson asked on 29 Sep 2021, 02:00 PM
How do I have the .Tools read in as a template stored externally to the page?  In short our code scanner does not like files over 100 lines, if you define .tools you easily get over 100 lines.  Code formatting breaks lines into items for readability, thus adversely impacting the scanner.

1 Answer, 1 is accepted

Sort by
0
Aleksandar
Telerik team
answered on 04 Oct 2021, 08:20 AM

Hi Harry,

The Tools() configuration method expects an Action<Kendo.Mvc.UI.Fluent.EditorToolFactory> as a parameter, so you can extract the definition of the Editor Tools the following way, for example:

Controller:

public class HomeController : Controller
{
        Action<Kendo.Mvc.UI.Fluent.EditorToolFactory> columnTools = tools => tools
            .Clear()
            .Bold()
            .Italic()
            .Underline()
            .JustifyLeft()
            .JustifyCenter()
            .JustifyRight()
            .InsertUnorderedList()
            .InsertOrderedList()
            .SuperScript()
            .SubScript()
            .CreateLink()
            .CleanFormatting();

        public IActionResult Index()
        {
            ViewData["tools"] = columnTools;
            return View();
        }
}
View:
@(Html.Kendo().Editor()
        .Name("editor")
        .Tools((Action<Kendo.Mvc.UI.Fluent.EditorToolFactory>)ViewData["tools"])
    )

I hope this helps.

Regards,
Aleksandar
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
Editor Toolbar
Asked by
Harry Anderson
Top achievements
Rank 1
Answers by
Aleksandar
Telerik team
Share this question
or