How to add image in Quill JS?

后端 未结 4 1804
耶瑟儿~
耶瑟儿~ 2021-02-02 14:51

I can\'t figure out how to get images to work like in the example on http://quilljs.com/.

I tried adding

4条回答
  •  时光取名叫无心
    2021-02-02 15:37

    As of Quill version 1.3, none of the answers above work anymore. Unfortunately, the official documentation hasn't progressed much either.

    You have two ways to solve your problem, both work for official themes Snow and Bubble. Either way, you do not have to add the following code:

    'image-tooltip': true,
    'link-tooltip': true
    

    Way 1: Initialize quill as following:

    var editor = new Quill('#editorDiv', 
    {
        modules: {
          toolbar: [
                ...
                ['image'],
                ...
            ],
            //not needed anymore: 'image-tooltip': true,
            //not needed anymore: 'link-tooltip': true
            ...
        },
        ...
    });
    

    Way 2: Initialize quill as following:

    ...
    var editor = new Quill('#editorDiv', 
    {
        modules: {
            toolbar: '#editorToolbarDiv',
            //not needed anymore: 'image-tooltip': true,
            //not needed anymore: 'link-tooltip': true,
            ...
        },
        ...
    });
    

    As of version 1.3, Quill does not support resizing images. One can do it with a custom module, though.

提交回复
热议问题