Giter Club home page Giter Club logo

quill-image-extend-module's People

Contributors

guangzhouleihou avatar nextboy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

quill-image-extend-module's Issues

粘贴图片失效

Hi

我看readme里面有说支持 复制插入 功能,代码 里面却把这个功能给屏蔽了,这是有什么坑吗?

引入imageResize后显示imports not defined

import { quillEditor, Quill } from 'vue-quill-editor'
import { container, ImageExtend, QuillWatch } from 'quill-image-extend-module'

import ImageResize from 'quill-image-resize-module'

Quill.register('modules/ImageExtend', ImageExtend)
Quill.register('modules/ImageResize', ImageResize)

error when drag a image to a new place

when I drag a image to another place, it has the following error in chrome:

Uncaught TypeError: Failed to execute 'readAsDataURL' on 'FileReader': parameter 1 is not of type 'Blob'. at ImageExtend.toBase64 (index.js?187d:119) at ImageExtend.dropHandle (index.js?187d:104)

and another error:

Uncaught TypeError: Cannot read property 'size' of undefined at ImageExtend.dropHandle

I have no idea to solve it, anybody has the same question?

同一页面多个富文本上传图片问题

场景:同一个页面初始化了三个quill富文本,应用了你的上传图片modules
问题:不管点击第几个富文本的上传图片按钮,都上传的是第一个富文本编辑器,三个富文本配置都一样,一开始用的是同一个配置对象,考虑到可能是this指向问题,换成了三个一样的配置对象,分开配置,但是还是上述情况,希望作者有空看一下是否有这种情况
@NextBoy

在打包时出现错误

您好,我在使用你的插件时,开发模式可以正常使用。但是无法打包生成,build时候报错如下:
default

请问是否兼容React

除视图层外的js代码是否兼容React,若不行,亲亲可以把视图和逻辑拆分封装成通用版嘛

Upload error for response code 201

If my back-end for upload images returns code 201(created), instead of 200(success) the editor is showing uploading error.
I think, it's better to have more flexible response codes configurations(in callbacks, may be), or at least, to treat 2** codes as success, as it is stated in the docs.

编辑器的监听事件可能了,自己的写的上传图片的那套事件不执行了

文件上传后已经return了后端返回的图片url,在response里面也可以取到,但终究无法添加到content里

上传后的值img的标签里面不是返回的url。而是像这样,小白求解

content的内容一直是这样,而且手动插入图片标签也无法显示
<p><br></p><p><img src="//:0"></p>
手动在success事件后添加context也不行,都会变成//:0
源代码:

`

<div> 
<div  class="quilledit">
  
        <quill-editor

:options="editorOption"
@blur="save()"
v-model="content">


<script> import 'quill/dist/quill.core.css' import 'quill/dist/quill.snow.css' import 'quill/dist/quill.bubble.css' import {quillEditor, Quill} from 'vue-quill-editor' import {container, ImageExtend, QuillWatch} from 'quill-image-extend-module' Quill.register('modules/ImageExtend', ImageExtend) export default { data () { return { content:"", filePath:'', editorOption: { modules: { ImageExtend: { loading: true, name: 'upload_file', action: '/manage/product/richTextImgUpload.do', response: (res) => { this.filePath=res.file_path; return res.file_path }, success: () => { }, }, toolbar: { container: [//工具栏 [{ 'color': [] }, { 'background': [] }], ['blockquote', 'code-block'], [{ 'size': ['small', false, 'large'] }], ['bold', 'italic'], [{ 'list': 'ordered'}, { 'list': 'bullet' }], ['link', 'image'] ], handlers: { 'image': function () { QuillWatch.emit(this.quill.id) } } } } } } }, components: { quillEditor }, methods:{ save(){ console.log(this.content) } } } </script> <style scoped> .quilledit{ width: 60%; height: 500px; float: right; } </style>

`

IE change event is emitted twice when uploading image

Browser: IE10 IE11

Problem

Clearing the value of file input will cause MS Edge / IE10 IE11 to trigger a new change event. However, the new change event contain no file, since it has just been cleared and cause the subsequent code to fail to execute.

Related code:

https://github.com/NextBoy/quill-image-extend-module/blob/ff6a0f2/index.js#L257

fileInput.addEventListener('change', function () {
    let self = QuillWatch.active
    self.file = fileInput.files[0]
    fileInput.value = '' // <-- Clearing the value of file input will cause MS Edge / IE10 to trigger a new `change` event.

自定义上传图片

用toolbar功能实现自定义上传图片,使用OSS上传后得到图片URL,如何插入到content?Thx

设置文件格式

可以添加文件格式一定为为图片的机能吗?
类似于fileInput.setAttribute('accept', 'image/*');
或者提供一个接口自定义文件格式?

config.error() is called twice during network error

Expected behaviour

When an error has occurred, self.config.error should only be called once.

Current behaviour

  1. If the browser is offline, uploading a file will cause a network error.
  2. This cause both upload.onerror and xhr.onreadystatechange to trigger self.config.error

Related code:

考虑加入babel编译将es6转换成es5么

我最近在使用nuxt.js 进行开发,用到了vue-quill-editor,并加入了该模块。
但实际使用过程中,刷新都会抛出 Unexpected token export 的语法错误异常
反复检查后发现是由于quill-image-extend-module里的es6的写法造成的

110802

经过babel编译后,修复了此问题
望转义成es2015的写法

sizeError为什么是异步的?

2018-12-03 4 54 51
我测试了一下,如果第一次传大于size的图,那么sizeError不执行,并且传图成功,此次以后不管你传大于或小于size限制的图,只要你传图sizeError每次都必执行,并且不执行传图。

npm install failed

sudo npm install quill-image-extend-module --save-dev

npm ERR! Cannot read property '0' of undefined

npm ERR! A complete log of this run can be found in:
npm ERR! /Users/quqiufeng/.npm/_logs/2018-05-01T09_55_37_041Z-debug.log

看见好多人都在用七牛,简单写了一个上传七牛的例子

本人非专业前端,也没有具体学习过, 勿喷
并且好多用法都不科学,还请大神多多指教

1.定义一个七牛对象以及基础属性
let qiniu = {'action': '//upload.qiniup.com/', 'baseUrl': '//7xk3lh.com1.z0.glb.clouddn.com/', 'token': ''};
2.定义一个获取token方法 以便后续刷新使用
let getToken = function () { axios.get('Qiniu/token').then(res => { qiniu.token = res.data.data.token; }); };
3.调用获取token方法
getToken();
4.改造example/example1.vue里的用法

export default {
        components: {quillEditor},
        data () {
            return {
                content: ' ',
                editorOption: {
                    modules: {
                        ImageExtend: {
                            loading: true,
                            name: 'file',
                            size: 3,
                            action: qiniu.action,
                            response: (res) => {
                                return qiniu.baseUrl + res.key;
                            },
                            headers: (xhr) => {
                            },
                            start: () => {
                            },
                            end: () => {
                                getToken(); // 每次完成后刷新token
                            },
                            error: () => {
                            },
                            change: (xhr, formData) => {
                                // 跟随form 提交必要参数
                                const file = formData.get('file');
                                const suffix = file.name.split('.');
                                const ext = suffix.splice(suffix.length - 1, 1)[0];
                                //  文件名称
                                formData.append('key', `image/${suffix.join('.')}_${new Date().getTime()}.${ext}`);
                                formData.append('token', qiniu.token);
                            }
                        },
                        toolbar: {
                            container: container,
                            handlers: {
                                'image': function () {
                                    QuillWatch.emit(this.quill.id);
                                }
                            }
                        }
                    }
                }
            };
        }
    };

全部代码

<template>
    <div class="quill-wrap">
        <quill-editor
                v-model="content"
                ref="myQuillEditor"
                :options="editorOption"
        >
        </quill-editor>
    </div>
</template>
<script>
    import axios from 'axios';
    import {quillEditor, Quill} from 'vue-quill-editor';
    import {container, ImageExtend, QuillWatch} from 'quill-image-extend-module';
    // require styles
    import 'quill/dist/quill.core.css';
    import 'quill/dist/quill.snow.css';
    import 'quill/dist/quill.bubble.css';

    Quill.register('modules/ImageExtend', ImageExtend);

    let qiniu = {'action': '//upload.qiniup.com/', 'baseUrl': '//7xk3lh.com1.z0.glb.clouddn.com/', 'token': ''};
    let getToken = function () {
        axios.get('Qiniu/token').then(res => {
            qiniu.token = res.data.data.token;
        });
    };
    getToken();
    export default {
        components: {quillEditor},
        data () {
            return {
                content: ' ',
                editorOption: {
                    modules: {
                        ImageExtend: {
                            loading: true,
                            name: 'file',
                            size: 3,
                            action: qiniu.action,
                            response: (res) => {
                                return qiniu.baseUrl + res.key;
                            },
                            headers: (xhr) => {
                            },
                            start: () => {
                            },
                            end: () => {
                                getToken();
                            },
                            error: () => {
                            },
                            change: (xhr, formData) => {
                                const file = formData.get('file');
                                const suffix = file.name.split('.');
                                const ext = suffix.splice(suffix.length - 1, 1)[0];
                                formData.append('key', `image/${suffix.join('.')}_${new Date().getTime()}.${ext}`);
                                formData.append('token', qiniu.token);
                            }
                        },
                        toolbar: {
                            container: container,
                            handlers: {
                                'image': function () {
                                    QuillWatch.emit(this.quill.id);
                                }
                            }
                        }
                    }
                }
            };
        }
    };
</script>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.