如何将自定义工具添加到kendo编辑器

vij*_*esh 5 asp.net-mvc customtool kendo-asp.net-mvc kendo-editor

如何向kendo添加自定义工具editor toolbar

我想添加拼写检查器,媒体管理器和剪切,复制,粘贴,剪切,单词复制和其他一些工具.

我在MVC应用程序中使用Kendo编辑器.

小智 4

我正在使用自定义工具通过从现有的链接引用中搜索链接引用来在应用程序中添加链接引用。

这是从我的源代码中截取的代码

@(Html.Kendo()
                  .Editor()
                  .Name("Content")
                  .Tools(tools => tools
                      .Clear()
                      .Bold().Italic().Underline().Strikethrough()
                      .JustifyLeft().JustifyCenter().JustifyRight().JustifyFull()
                      .InsertUnorderedList().InsertOrderedList()
                      .Outdent().Indent()
                      .CreateLink().Unlink()
                      .InsertImage()
                      .SubScript()
                      .SuperScript()
                      .TableEditing()
                      .ViewHtml()
                      .Formatting()
                      .CleanFormatting()
                      .FontName()
                      .FontSize()
                      .FontColor()
                      .BackColor()
                      .CustomButton(cb => cb
                          .Name("Add link to article")
                          .ToolTip("Add link to article")
                          .Exec("execFunction")
                      ))
                      .Encode(false)
                      .ImageBrowser(imageBrowser => imageBrowser
                             .Image("~/Content/Uploads/Images/{0}")
                             .Read("Read", "ImageBrowser")
                             .Create("Create", "ImageBrowser")
                             .Upload("Upload", "ImageBrowser")
                             .Thumbnail("Thumbnail", "ImageBrowser")))
Run Code Online (Sandbox Code Playgroud)

这些是我对编辑器的配置。我认为您只对 .CustomButton(cb => cb.Name / this is required/ cb.Exec / Also neccesary / 感兴趣。在 Exec 中,您传递单击按钮时应执行的 JS 函数的名称。你可以将你的 JS 连接到你的控制器,而不是使用 ajax。我将与你分享我的。

function execFunction(e) {
        $.get('/Articles/BuildLinkView', null, function(data) {
            $('#addLinkHolder').html(data);
            $('#addLinkHolder').css('display', 'table-cell');
        });
    }
Run Code Online (Sandbox Code Playgroud)

当您将其绑定到控制器时,您可以用它做任何您想做的事情。

我希望这能解决您的问题。如果没有,请提供额外信息