使用 KindEditor 的 单独调用组件

来源:互联网 发布:类似focusky的软件 编辑:程序博客网 时间:2024/04/30 04:02

转载: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>


原创粉丝点击