react-email-editor icon indicating copy to clipboard operation
react-email-editor copied to clipboard

Api call happening on using registerCallback images

Open yogiis98 opened this issue 3 years ago • 15 comments

Why api call is happening to https://api.tools.unlayer.com/v1/image?url=customImageUrl when using custom image library.

Is there any way to disable this call happening to unlayer server.

yogiis98 avatar Apr 27 '23 19:04 yogiis98

We use it this editor for private mailers and don't want anything to go to any external service, currently unlayer editor is making call for images.

yogiis98 avatar Apr 27 '23 20:04 yogiis98

@adeelraza @lucasbesen @umairsiddique Is there any way we can disable these proxy calls happening because right now we are using custom image chooser where we are passing the image url back to done callback on registerCallback('images')

Currently it is looking like things are unnecessarily making api call when they are not being used as well. or Is it a bug. Please help.

yogiis98 avatar May 18 '23 07:05 yogiis98

I'm looking for the same issue Is there any way we can upload images to our domain and giver URL here?

Shashankd48 avatar Jul 17 '23 10:07 Shashankd48

selectImage callback will place you in direct control of the image uploading and management. https://docs.unlayer.com/docs/custom-image-library

unlayer.registerCallback('selectImage', function (data, done) { // Open your image library // Once a user picks an image, call the done function with URL done({ url: "IMAGE URL GOES HERE" }); });

SebastianLindback avatar Sep 12 '23 12:09 SebastianLindback

to use your own storage you can use the "image" callback.

const onReady = async () => {

emailEditorRef?.current?.registerCallback(
  "image",
  async function (file, done) {
    var dataa = new FormData();
    dataa.append("file", file.attachments[0]);
    done({ progress: 0 });

    axios
      .post(`/files/v1`, dataa, {
        headers: {
          "Content-Type": "multipart/form-data",
        },
      })
      .then(({ data }) => done({ progress: 100, url: data?.url }));
  }
);

.....

<EmailEditor ref={emailEditorRef} onReady={() => onReady()} />

SebastianLindback avatar Sep 12 '23 12:09 SebastianLindback

even when using the image callback for custom image handling, I observe that a request is still made to:

https://api.tools.unlayer.com/v1/image?url=...

greedysiru avatar Oct 29 '24 05:10 greedysiru

This call happens when you try to edit the image. This is because the image editor in browser does not allow CORS URLs so Unlayer has to proxy the image from our servers.

Do you want to disable the image editor in the builder?

adeelraza avatar Oct 29 '24 08:10 adeelraza

Are you still getting the issue @greedysiru ? I am getting this issue. It was working fine, but now I noticed that the request is being made to unlayer.

prabinKshrestha avatar Jan 23 '25 23:01 prabinKshrestha

to use your own storage you can use the "image" callback.

const onReady = async () => {

emailEditorRef?.current?.registerCallback(
  "image",
  async function (file, done) {
    var dataa = new FormData();
    dataa.append("file", file.attachments[0]);
    done({ progress: 0 });

    axios
      .post(`/files/v1`, dataa, {
        headers: {
          "Content-Type": "multipart/form-data",
        },
      })
      .then(({ data }) => done({ progress: 100, url: data?.url }));
  }
);

.....

<EmailEditor ref={emailEditorRef} onReady={() => onReady()} />

As of 2025 this callback doesn't work, anyone knows a workaround?

Edit: I've just found out that it's no longer supported on the free plan. Time to move on.

Valkhan avatar Feb 10 '25 11:02 Valkhan

As of 2025 this callback doesn't work, anyone knows a workaround?

Edit: I've just found out that it's no longer supported on the free plan. Time to move on.

@Valkhan I cannot seem to find anywhere in the documentation when it mentions that is is no longer supported on the free plan, I was hoping you'd be able to give me some information as to where I can find that pls.

but honestly, why would that be the case? does it cost them more with the callback or something? this is truly disappointing

hopefully it is just a temporary issue and they change it back or something.

Adriantobi avatar Feb 12 '25 11:02 Adriantobi

As of 2025 this callback doesn't work, anyone knows a workaround? Edit: I've just found out that it's no longer supported on the free plan. Time to move on.

@Valkhan I cannot seem to find anywhere in the documentation when it mentions that is is no longer supported on the free plan, I was hoping you'd be able to give me some information as to where I can find that pls.

but honestly, why would that be the case? does it cost them more with the callback or something? this is truly disappointing

hopefully it is just a temporary issue and they change it back or something.

They recently released the new version and by default the stable version is used. The new version seems to have an issue. I followed https://docs.unlayer.com/builder/version-management#version-locking to specify the old version I was using, and it started working as expected. I would explore more in new version before switching back to the stable version. Passing the project id may fix the issue in new version, but I have not tried it.

prabinKshrestha avatar Feb 12 '25 12:02 prabinKshrestha

As of 2025 this callback doesn't work, anyone knows a workaround? Edit: I've just found out that it's no longer supported on the free plan. Time to move on.

@Valkhan I cannot seem to find anywhere in the documentation when it mentions that is is no longer supported on the free plan, I was hoping you'd be able to give me some information as to where I can find that pls.

but honestly, why would that be the case? does it cost them more with the callback or something? this is truly disappointing

hopefully it is just a temporary issue and they change it back or something.

Go to your unlayer console and try upgrading your free plan, you'll get the message:

You’re missing out on many powerful features. Upgrade today to get:

  • Unlimited Users
  • Roles & Permissions
  • Custom Tools
  • Custom Blocks
  • Custom File Storage <<<
  • Collaborators
  • Cloud API
  • Priority Support

I Don't think it costs more, but surely they earn less, in terms of costs using their AWS account will add costs, but using a custom file storage they can no longer measure how much images and traffic you'll get from your e-mails since they are providing you a "free" editor only, and surely that's not what they want, they need data to offer you a "better" paid plan.

Valkhan avatar Feb 12 '25 12:02 Valkhan

This is the config I use:

{
        version: '1.157.0',
        appearance: {
            theme: "modern_light"
        },
        env: {
            API_V1_BASE_URL: "http://127.0.0.1",
            API_V2_BASE_URL: "http://127.0.0.1",
            EVENTS_API_BASE_URL: "http://127.0.0.1",
            TOOLS_API_V1_BASE_URL: "http://127.0.0.1",
            TOOLS_CDN_BASE_URL: "http://127.0.0.1",
            CONSOLE_BASE_URL: "http://127.0.0.1"
       }
}

using this all old features work and there are no requests to unlayer.com. There is still a failed http://127.0.0.1/editor/auth request, but no other requests are made (e.g. for autosave or image uploads). Also there's no "powered by" notice on the bottom right.

rallisf1 avatar Mar 27 '25 16:03 rallisf1

This is the config I use:

{ version: '1.157.0', appearance: { theme: "modern_light" }, env: { API_V1_BASE_URL: "http://127.0.0.1", API_V2_BASE_URL: "http://127.0.0.1", EVENTS_API_BASE_URL: "http://127.0.0.1", TOOLS_API_V1_BASE_URL: "http://127.0.0.1", TOOLS_CDN_BASE_URL: "http://127.0.0.1", CONSOLE_BASE_URL: "http://127.0.0.1" } } using this all old features work and there are no requests to unlayer.com. There is still a failed http://127.0.0.1/editor/auth request, but no other requests are made (e.g. for autosave or image uploads). Also there's no "powered by" notice on the bottom right.

Thank u, it works, It just calls api registered and doesn't call unlayer apis

lenguyet-ha avatar Jul 14 '25 13:07 lenguyet-ha

will the 1.157.0 version supported in future too

BharathSubu avatar Jan 30 '26 10:01 BharathSubu