删除ckeditor实例时无法清除类

时间:2018-08-13 10:12:24

标签: model-view-controller ckeditor ckeditor4.x

我有一个表单,需要在其中添加两个文本字段的ckeditor。我正在按以下方式致电ckeditor:

  <tr>
                                    <td class="tch col-sm-3 col-xs-4">
                                        @Html.LabelFor(model => model.offer_details)
                                    </td>
                                    <td class="tc1 col-sm-9 col-xs-8" colspan="3">
                                        @Html.TextAreaFor(model => model.offer_details, new { @class = "form-control offer_details", @id = "offer_details" })
                                        @Html.ValidationMessageFor(model => model.offer_details, "", new { @class = "text-danger" })
                                    </td>
                                </tr>
                                <tr>
                                    <td class="tch col-sm-3 col-xs-4">
                                        @Html.LabelFor(model => model.offer_contact_info)
                                    </td>
                                    <td class="tc1 col-sm-9 col-xs-8" colspan="3">
                                        @Html.TextAreaFor(model => model.offer_contact_info, new { @class = "form-control offer_contact_info", @id = "offer_contact_info", @rows = 5 })
                                        @Html.ValidationMessageFor(model => model.offer_contact_info, "", new { @class = "text-danger" })
                                    </td>
                                </tr>

并且脚本如下

 <script>
                            $('.offer_details').click(function () {
                                DestroyAllCKEDITOR("offer_details");
                                editor = CKEDITOR.replace('offer_details', {
                                    filebrowserUploadUrl: "../../ckeditor/Upload.ashx"
                                });  
                            });
                            $('.offer_contact_info').click(function () {
                                DestroyAllCKEDITOR("offer_contact_info");
                                editor = CKEDITOR.replace('offer_contact_info', {
                                    filebrowserUploadUrl: "../../ckeditor/Upload.ashx"
                                });
                            });
                            function DestroyAllCKEDITOR(editorname) {
                                //Destroy all existing instances
                                for (name in CKEDITOR.instances) {
                                    if (name != editorname) {
                                        var editor = CKEDITOR.instances[name];
                                        if ((typeof (editor) != 'undefined') && (editor != null)) {
                                            editor.destroy(true);
                                            editor = undefined;
                                        }
                                    }
                                };
                            }
                        </script>

我正在销毁ckeditor实例,但是单击文本区域的次数下显示了一个名为“ Response Visibilty”的选项卡。我该如何解决。 enter image description here

0 个答案:

没有答案