fxmontigny / quill-image-upload

A module for Quill rich text editor to upload images to be selected from toolbar editor.
107 stars 43 forks source link

Console log works but cant see image #11

Closed JurajJakubov closed 1 year ago

JurajJakubov commented 5 years ago

I wrote once but then i realized i only forgot to use webpack. But now i am trying i cant find a way how to make it works. my plugin And i disable CSRF protection from server

import Quill from 'quill';
import {
  ImageUpload
} from 'quill-image-upload';

Quill.register('modules/imageUpload', ImageUpload);

const quill = new Quill(editor, {
  theme: 'snow',
  modules: {
    toolbar: '#toolbar',
    imageUpload: {
      url: 'http://localhost:3000', // server url. If the url is empty then the base64 returns
      method: 'POST', // change query method, default 'POST'
      name: 'image', // custom form name
      withCredentials: false, // withCredentials
      headers: {}, // add custom headers, example { token: 'your-token'}
      csrf: {
        token: 'token',
        hash: ''
      }, // add custom CSRF
      customUploader: () => {}, // add custom uploader
      // personalize successful callback and call next function to insert new url to the editor
      callbackOK: (serverResponse, next) => {
        next(serverResponse);
      },
      // personalize failed callback
      callbackKO: serverError => {
        alert(serverError);
      },
      // optional
      // add callback when a image have been chosen
      checkBeforeSend: (file, next) => {
        console.log(file);
        next(file); // go back to component and send to the server
      }
    }
  }
});

But all i get is console log with data. File(65201) {name: "ggg.jpg", lastModified: 1542188728626, lastModifiedDate: Wed Nov 14 2018 10:45:28 GMT+0100 (Central European Standard Time), webkitRelativePath: "", size: 65201, …}

I dont know if is this image saved somewhere or if i need to make any script or route for this. I am new in js so maybe i am missing somethin. Thanks for any guidance :)

praswicaksono commented 5 years ago

remove customUploader options