主题: 在默认模式下再加一个 独立的图片上传按钮,请帮忙贴出详细调用代码
作者: 第四空间, 发布日期: 2013-11-22 12:15:35, 浏览数: 2837

如图:默认模式下在添加一个独立的图片上传按钮,怎么调用代码,examples里有独立上传按钮的代码,但不知道怎么合并,求大虾帮帮忙。



demp.asp代码:

<script>
KindEditor.ready(function(K) {
var editor1 = K.create('textarea[name="content1"]', {
cssPath : '../plugins/code/prettify.css',
uploadJson : '../asp/upload_json.asp',
fileManagerJson : '../asp/file_manager_json.asp',
allowFileManager : false,
items : [
'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline',
'removeformat', '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist',
'insertunorderedlist', '|', 'emoticons', 'image','multiimage', 'link'],
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();
});
}
});


});
</script>

独立上传图片在examples下的image-dialog.html

http://www.kindsoft.net/ke4/examples/image-dialog.html

作者: 第四空间, 发布日期: 2013-11-22 13:48:54

已找到高手解决,在此谢谢 “分享 stepday.com”


代码:

<!doctype html>
<html>
<head>
    <meta charset="utf-8" />
    <title>Simple Examples</title>
    <style>
        form
        {
            margin: 0;
        }
        textarea
        {
            display: block;
        }
    </style>
    <link rel="stylesheet" href="../themes/default/default.css" />
    <script charset="utf-8" src="../kindeditor.js"></script>
    <script charset="utf-8" src="../lang/zh_CN.js"></script>
    <script>
        var editor;
        KindEditor.ready(function (K) {
            editor = K.create('textarea[name="content"]', {
cssPath : '../plugins/code/prettify.css',
uploadJson : '../asp/upload_json.asp',
                resizeType: 1,
                fullscreenMode: 0, //是否全屏显示
                designMode: 1,
                allowPreviewEmoticons: false,
                allowImageUpload: true,
                allowFileManager: true,
                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();
                            }
                        });
                    });
            });
        });
    </script>
</head>
<body>
    <h3>
        默认模式</h3>
    <div id="divUplaod" style="display: block;">
        <p>
            <input type="text" id="url1" value="" />
            <input type="button" id="image1" value="选择图片" />(网络图片 + 本地上传)</p>
    </div>
    <textarea name="content" style="width: 700px; height: 200px; visibility: hidden;">KindEditor</textarea>
</body>
</html>


回复
作者: stepday, 发布日期: 2013-11-22 14:34:48

这个问题可以得到完美解决,请见:kindeditor编辑器和独立图片上传分开的配置细节曝光

回复
发表新帖 发表回复