Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add onSelectFile config option to ImageConfig #95

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mernxl
Copy link

@mernxl mernxl commented Jul 23, 2020

This config option, if passed will be invoked on clicking "select an image". This callback receive the current imageTool as parameter, in order to permit user carry call methods like onUpload with the response object ({ success: true, file: ... })

This should close #56

This config option, if passed will be invoked on clicking "select an image". This callback receive the current imageTool as parameter, in order to permit user carry call methods like onUpload with the response object (`{ success: true, file: ... }`)

This should close editor-js#56
@mernxl
Copy link
Author

mernxl commented Jul 23, 2020

I use this on my website, and it works perfectly.

const imageToolConfig = {
  class: EditorJSImage,
  config: {
    onSelectFile: tool => {
      toggleLibrary(img => {
        const data = tool.data;

        data.file = img; // set image
        data.caption = data.caption || img.meta;

        tool.data = data;
        toggleLibrary(undefined);
      });
      },
    uploader: {
       uploadByFile: ...
       uploadByUrl: ...
    }
  }
}

@O4epegb
Copy link

O4epegb commented Oct 13, 2020

Would be great to have it merged, very useful feature to have. Right it's impossible to integrate image uploading with CMS, Strapi for example.

@neSpecc
Copy link
Contributor

neSpecc commented Dec 7, 2022

in order to permit user carry call methods like onUpload

Please, clarify. Why not use a custom uploader?

@kuzkov kuzkov mentioned this pull request Dec 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

How to use with existing file manager
3 participants