主题: 批量上传 添加图片按扭不显示
作者: 龙的传人, 发布日期: 2013-01-11 15:02:35, 浏览数: 3021

 

 

js

 

  KindEditor.ready(function (K) {
        var editor = K.create('#content', {
            //上传管理
            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=example]')[0].submit();
                });
                K.ctrl(self.edit.doc, 13, function () {
                    self.sync();
                    K('form[name=example]')[0].submit();
                });
            },
            //上传文件后执行的回调函数,获取上传图片的路径
            afterUpload: function (url) {
                alert(url);
            },
            //编辑器高度
            width: '700px',
            //编辑器宽度
            height: '450px;',
            //配置编辑器的工具栏
            items: [
                'source', '|', 'undo', 'redo', '|', 'preview', 'print', 'template', 'code', 'cut', 'copy', 'paste',
                'plainpaste', 'wordpaste', '|', 'justifyleft', 'justifycenter', 'justifyright',
                'justifyfull', 'insertorderedlist', 'insertunorderedlist', 'indent', 'outdent', 'subscript',
                'superscript', 'clearhtml', 'quickformat', 'selectall', '|', 'fullscreen', '/',
                'formatblock', 'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold',
                'italic', 'underline', 'strikethrough', 'lineheight', 'removeformat', '|', 'image', 'multiimage',
                'flash', 'media', 'insertfile', 'table', 'hr', 'emoticons', 'baidumap', 'pagebreak',
                'anchor', 'link', 'unlink', '|', 'about'
                ]
        });
        K('#image1').click(function () {
            editor.loadPlugin('image', function () {
                editor.plugin.imageDialog({
                    imageUrl: K('#url1').val(),
                    clickFn: function (url, title, width, height, border, align) {
                        K('#url1').val(url);
                        editor.hideDialog();
                    }
                });
            });
        });
        K('#J_selectImage').click(function () {
            editor.loadPlugin('multiimage', function () {
                editor.plugin.multiImageDialog({
                    clickFn: function (urlList) {
                        var div = K('#J_imageView');
                        div.html('');
                        K.each(urlList, function (i, data) {
                            div.append('<img src="' + data.url + '">');
                        });
                        editor.hideDialog();
                    }
                });
            });
        });
        prettyPrint();
    });

 

 

html

 

  <input type="button" id="J_selectImage" value="批量上传" />
                    <div id="J_imageView">
                    </div>

 

发表新帖 发表回复