function () {
        const editor = this.editor

        // 禁用 document 拖拽事件
        const $document = $(document)
        $document.on('dragleave drop dragenter dragover', function (e) {
            e.preventDefault()
        })

        // 添加编辑区域拖拽事件
        const $textElem = editor.$textElem
        $textElem.on('drop', function (e) {
            e.preventDefault()
            const files = e.dataTransfer && e.dataTransfer.files
            if (!files || !files.length) {
                return
            }

            // 上传图片
            const uploadImg = editor.uploadImg
            uploadImg.uploadImg(files)
        })
    }
function () {
        const editor = this.editor

        // 禁用 document 拖拽事件
        const $document = $(document)
        $document.on('dragleave drop dragenter dragover', function (e) {
            e.preventDefault()
        })

        // 添加编辑区域拖拽事件
        const $textElem = editor.$textElem
        $textElem.on('drop', function (e) {
            e.preventDefault()
            const files = e.dataTransfer && e.dataTransfer.files
            if (!files || !files.length) {
                return
            }

            // 上传图片
            const uploadImg = editor.uploadImg
            uploadImg.uploadImg(files)
        })
    }
function ( ) { const editor = this . editor // 禁用 document 拖拽事件 const $document = $ ( document ) $document . on ( 'dragleave drop dragenter dragover' , function ( e ) { e . preventDefault ( ) } ) // 添加编辑区域拖拽事件 const $textElem = editor . $textElem $textElem . on ( 'drop' , function ( e ) { e . preventDefault ( ) const files = e . dataTransfer && e . dataTransfer . files if ( ! files || ! files . length ) { return } // 上传图片 const uploadImg = editor . uploadImg uploadImg . uploadImg ( files ) } ) }
拖拽事件
拖拽事件
upload img file