Chronostasys / Blazor.Cropper

A blazor library provides component to crop image
MIT License
84 stars 19 forks source link

Error with multiple cropper element in a single page #70

Closed xcodiyapa closed 1 year ago

xcodiyapa commented 1 year ago

When I create a razor page with 2 cropper elements. It would not work. My assumption it happens due to same DOM ID in html end. Is there any way to handle it? image

Chronostasys commented 1 year ago

Hi @xcodiyapa , it seems like a js-interop error. Did you correctly referenced the static js file?

xcodiyapa commented 1 year ago

Hi @Chronostasys , Yes JS file reference is correct. Let me explain little more. The circular image and upload button is combined in a custom component named as AppImageUpload.razor which is added to the the main ui component. Look at the below images (part of my code block)... image

image

When I add AppImageUpload.razor twice, this error occurs due to the html DOM id confliction (probably)

xcodiyapa commented 1 year ago

Hello sir, is there any updates??

Chronostasys commented 1 year ago

Hello sir, is there any updates??

Apologies for the delayed response—I've been rather preoccupied with work recently. For us to best assist you, could you kindly provide a simple, reproducible example of the project? This would significantly expedite the troubleshooting process.

xcodiyapa commented 1 year ago

CropperTest.zip

Here is the sample... Please look at counter page for positive output... And weather page for error output...

Thanks

Chronostasys commented 1 year ago

CropperTest.zip

Here is the sample... Please look at counter page for positive output... And weather page for error output...

Thanks

Just found the problem. I've wrote jsinvokable methods in the component itself, which confuses the runtime when there's multiple cropper elements(as there are multiple methods with same name).

Chronostasys commented 1 year ago

Fixed in 1.2.15.