【问题标题】:Create custom tool for kendo editor angular mode为剑道编辑器角度模式创建自定义工具
【发布时间】:2016-05-26 07:26:43
【问题描述】:

我想在剑道编辑器中添加自定义工具。 通过指令的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>"
                    });
                }
            }

    };

这是行不通的。 我不知道手风琴范围是对还是不对? 有什么想法吗?

【问题讨论】:

    标签: javascript jquery angularjs kendo-editor


    【解决方案1】:

    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>"
                    });
                }
          }
        ]
    
    };
    

    【讨论】:

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