【问题标题】:How to add Custom tools to kendo editor如何将自定义工具添加到剑道编辑器
【发布时间】:2015-08-07 09:13:53
【问题描述】:

如何将自定义工具添加到剑道editor toolbar

我想添加拼写检查器, 媒体管理器和剪切、复制、粘贴和从 word 中剪切、从 word 中复制以及其他一些工具。

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

【问题讨论】:

标签: asp.net-mvc kendo-asp.net-mvc kendo-editor customtool


【解决方案1】:

我正在使用自定义工具在应用程序中添加链接引用,方法是从现有的引用中搜索它们。

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

@(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")))

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

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

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

我希望这可以解决您的问题。如果没有,请提供更多信息

【讨论】:

猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-03-15
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多