Jungwoo-An / react-editor-js

⚛️📝The unofficial editor-js component for React
https://codesandbox.io/s/react-editor-js-v2-34bfl
MIT License
945 stars 77 forks source link

Support custom image loader #173

Closed aiavci closed 2 years ago

aiavci commented 2 years ago

It would be great to have support for custom image URL loaders. One example for this user case is if the image is loaded from a protected endpoint.

Jungwoo-An commented 2 years ago

@aiavci Thank you for your good suggestion. Unfortunately, our job is just to help the editor-js use well in react. Could you create a issue into https://github.com/editor-js/image ?

aiavci commented 2 years ago

@aiavci Thank you for your good suggestion. Unfortunately, our job is just to help the editor-js use well in react. Could you create a issue into https://github.com/editor-js/image ?

I just did. Thank you

aiavci commented 2 years ago

@Jungwoo- Do you know if its possible to change these to image blobs instead of URLs by any chance?

Jungwoo-An commented 2 years ago

@aiavci I think you can use https://developer.mozilla.org/ko/docs/Web/API/URL/createObjectURL API.

uploadByFile(file) {
  const URL = URL.createObjectURL(file);
  return {
    success: 1,
    file: {
      url: URL,
    }
  };
}
aiavci commented 2 years ago

Thank you @Jungwoo-An. And for previewing a saved page, simply looping through and replacing all URLs before rendering?

Jungwoo-An commented 2 years ago

@aiavci If you want to show saved page, You need image upload server.

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.