您的位置:首页 > 其它

使用 KindEditor 的 单独调用组件

2013-11-15 14:57 260 查看
转载:http://hkstb.blog.163.com/blog/static/46096793201392313257298/

<script>

     KindEditor.ready(function (K) {

         var editor1 = K.create('#<%=Describe.ClientID%>', {

             cssPath: '../kindeditor/plugins/code/prettify.css',

             uploadJson: '../kindeditor/asp.net/upload_json.ashx',

             fileManagerJson: '../kindeditor/asp.net/file_manager_json.ashx',

             allowFileManager: true,

             afterCreate: function () {

                 var self = this;

                 K.ctrl(document, 13, function () {

                     self.sync();

                     K('form[name=form1]')[0].submit();

                 });

                 K.ctrl(self.edit.doc, 13, function () {

                     self.sync();

                     K('form[name=form1]')[0].submit();

                 });

             }

         });

 

//注意:这里的editor1要和上面的editor1对应

         K('#image1').click(function () {

             editor1.loadPlugin('image', function () {

                 editor1.plugin.imageDialog({

                     imageUrl: K('#<%=SmallImg.ClientID%>').val(),

                     clickFn: function (url, title, width, height, border, align) {

                         K('#<%=SmallImg.ClientID%>').val(url);

                         editor1.hideDialog();

                     }

                 });

             });

         });

         prettyPrint();

     });

 </script>

--------------------------------------

<tr>

                <th>缩略图:</th><td><asp:TextBox ID="SmallImg" runat="server" EnableViewState="False"></asp:TextBox> <input type="button" id="image1" value="选择图片" /></td>

            </tr>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: