限制 Kendo UI 编辑器中可用的工具

Limit which tools are available in Kendo UI Editor

我有以下代码....

<textarea name="description" data-role="editor" class="k-textbox" data-bind="value:description"></textarea>

这会生成一个 kendo 编辑器来代替文本区域,一切都很好,除了我想限制可用的工具。

我有: 粗体、斜体、下划线、删除线、左对齐、右对齐、居中对齐、对齐、有序列表、无序列表、缩进、减少缩进、Link、取消链接和 Table creator/editor.

我只需要粗体、斜体、下划线、有序列表、无序列表、缩进、不缩进、Link、取消链接和 Table creator/editor.

我如何实现这个....注意我必须使用 data-role="editor" 方法作为文本区域,如果在 kendo编辑器模板.

只需设置 tools 选项。

您似乎在使用 MVVM,因此您可以将其设置为:

<textarea name="description" class="k-textbox"
    data-role="editor"
    data-tools="['bold', 'italic', 'underline', 'insertOrderedList', 'insertUnorderedList', 'indent', 'outdent', 'createLink', 'unlink', 'createTable', 'addColumnLeft', 'addColumnRight', 'addRowAbove', 'addRowBelow', 'deleteRow', 'deleteColumn']"
    data-bind="value:description"></textarea>

使用文本区域将插入一个 iframe。您可以使用 div 代替。在这两种情况下,我们都可以在编辑器中操作工具,例如

                    <div id="topEditor"></div>
                    <div class="column"></div>



                    $("#topEditor").kendoEditor({
                    tools: [
                        "bold",
                        "italic",
                        "underline",
                        "strikethrough",
                        "justifyLeft",
                        "justifyCenter",
                        "justifyRight",
                        "justifyFull",
                        "createLink",
                        "unlink",
                        "insertImage",
                        "createTable",
                        "addColumnLeft",
                        "addColumnRight",
                        "addRowAbove",
                        "addRowBelow",
                        "deleteRow",
                        "deleteColumn",
                        "foreColor",
                        "backColor"
                    ]
                });

                $(".column").kendoEditor({
                    tools: [
                        "bold",
                        "italic",
                        "underline",
                        "createLink",
                        "unlink",
                        "insertImage"
                    ]
                });