0

我想在剑道编辑器中添加自定义工具。通过指令在 jQuery 方法中非常好,但是模型绑定有问题。

看来我必须使用这样的角度方法:

<textarea naccordion id="htmleditor" ng-model="Model._Active.Paragraph" class="editor" k-options="accordion" k-encoded="false" kendo-editor k-tools="['fontName','bold','italic','underline','strikethrough','fontSize','justifyLeft','justifyCenter','justifyRight','justifyFull','foreColor','insertUnorderedList','insertOrderedList','indent','outdent','createLink','unlink','insertImage','cleanFormatting','backColor','viewHtml','formatting']"></textarea>

所以,我把我的 k-options 代码放在控制器中:

        $scope.accordion = {
        tools:
            {
                name: "accordion",
                tooltip: "Accordion items",
                exec: function (e) {
                    var editor = $(this).data("kendoEditor");
                    editor.exec("inserthtml", {
                        value: "<accordion close-others='true'><accordion-group is-open='Model._openSettings'><accordion-heading>[Title]</accordion-heading><br>[Text]</accordion-group></accordion>"
                    });
                }
            }

    };

这不是工作。我不知道手风琴范围是对还是不对?任何想法?

4

1 回答 1

0

tools 需要是一个数组:

 $scope.accordion = {
    tools:[
      {
       name: "accordion",
            tooltip: "Accordion items",
            exec: function (e) {
                var editor = $(this).data("kendoEditor");
                editor.exec("inserthtml", {
                    value: "<accordion close-others='true'><accordion-group is-open='Model._openSettings'><accordion-heading>[Title]</accordion-heading><br>[Text]</accordion-group></accordion>"
                });
            }
      }
    ]

};
于 2016-09-26T06:24:46.983 回答