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

use inlineContainer with CldUploadWidget #562

Open
colbyfayock opened this issue Oct 31, 2024 Discussed in #560 · 2 comments
Open

use inlineContainer with CldUploadWidget #562

colbyfayock opened this issue Oct 31, 2024 Discussed in #560 · 2 comments

Comments

@colbyfayock
Copy link
Collaborator

Discussed in #560

Originally posted by gabriel-mopereira October 30, 2024
Is it possible to use the component always rendered inside the page or do I have to manually create the widget (i.e not using this library components)?

@gabriel-mopereira
Copy link

gabriel-mopereira commented Nov 1, 2024

Hey, I think I might have come with a workaround for this, which is basically:

{typeof children === "function" && children({ cloudinary: cloudinary.current, widget: widget.current, results, error, isLoading: isScriptLoading, ...instanceMethods, })}
First I commented this out. In my particular code it wasn't necessary and the only use would be the open function, but it kept saying that open was undefined. I'm aware this is important to many but I don't know how I could make this work.

function createWidget() { return cloudinary.current?.createUploadWidget(uploadOptions, resultsCallback); }
Changing createUploadWidget to openUploadWidget, so it creates the widget and open it automatically.

And finally I used the inlineContainer as usual, but only "#container-id" worked. When using the document.getElementById method, it made the Widget popup in a modal.

I know this is not ideal, I would like to contribute but I'm sure how it should be done.

@colbyfayock
Copy link
Collaborator Author

i would suggest checking for the existence of inlineContainer and handling it differently depending on that

further, an alternative approach, is to add an inline prop, which instead of forcing someone to manually define these values, could return an element somewhere which would act as the inline container

we would then set the inlineContainer ourselves and change any logic to open the widget based on that nested location

does that make sense?

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

No branches or pull requests

2 participants