<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>wangEditor 上传图片</title>
</head>
<body>
    <p>wangEditor 上传图片到服务器</p>
    <div id="div3">
        <p>欢迎使用 wangEditor 富文本编辑器</p>
    </div>

    <p>wangEditor 以base64保存图片文件</p>
    <div id="div4">
        <p>欢迎使用 wangEditor 富文本编辑器</p>
    </div>

    <p>wangEditor 自定义上传图片</p>
    <div id="div5">
        <p>欢迎使用 wangEditor 富文本编辑器</p>
    </div>

    <script type="text/javascript" src="/wangEditor.js"></script>
    <script type="text/javascript">
        var E = window.wangEditor

        var editor2 = new E('#div3')
        editor2.customConfig.uploadImgServer = '/upload-img'
        editor2.customConfig.uploadImgHooks = {
            // customInsert: function (insertImg, result, editor) {
            //     console.log(JSON.stringify(result))
            //     insertImg(result.data[0])
            // },

            // customInsert: function (insertImg, result, editor) {
            //     console.log(result)
            // }
        }
        // editor2.customConfig.uploadImgParams = {
        //     a: 123,
        //     b: 'vvv'
        // }
        // editor2.customConfig.uploadImgParamsWithUrl = true
        editor2.create()

        var editor1 = new E('#div4')
        editor1.customConfig.uploadImgShowBase64 = true
        editor1.create()

        var editor = new E('#div5')
        editor.customConfig.customUploadImg = function (files, insert) {
            console.log(files)
            insert('https://ss0.bdstatic.com/5aV1bjqh_Q23odCf/static/superman/img/logo/bd_logo1_31bdc765.png')
        }
        editor.create()
    </script>
</body>
</html>