-
Notifications
You must be signed in to change notification settings - Fork 9
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
For people who generate the links later with Livewire, give a JavaScript method to add event to the buttons. #1
Comments
Hi @ronald2wing, Thank you for your suggestion. I need some time to think about how to implement it in a better way. |
I was going to try: https://laracasts.com/discuss/channels/livewire/how-to-call-alpine-js-method-from-livewire |
Another I will do is to use $wire.methods() to call the Livewire method in the frontend directly and then call the button update method. Thank you for looking into this. |
Hello @ronald2wing, I played around with Livewire 2/3 for a couple of days and I didn't discover any issues with "DOMContentLoaded" event. Even if I render the code of the buttons through the Livewire Could you please provide more information about your issue? |
It could be related to using Alpine.js with Livewire. I will test it again on my local tonight. The Livewire was rerendered on the page after input changes. DOMContentLoaded is only loaded after the page is loaded, but some of my contents are loaded based on the input changes. I am trying to share my code, but it looks like some text is being hidden in the editor:
<script src="https://cdn.plyr.io/3.7.8/plyr.js"></script>
<script src="{{ asset('js/share-buttons.js') }}"></script>
`
Search
The End of the List
@else
Loading...
@endif
/
|
Hello @ronald2wing, Did you get a chance to test it again? |
@kudashevs |
Hello @ronald2wing, Now I see the issue. Thanks for sharing the link. |
@ronald2wing here is a new version of vanilla document.addEventListener('click', function (e) {
socialButtonClickHandler(e);
}) Could you please try to play around with it and let me know if it works? |
Hello, the new changes do not work. Now even the default DOMContentLoaded does not set the events either. However, the events are registered in the element after inspection: popcreme.com |
@ronald2wing I didn't take into account additional classes on links. Could you please check it out? |
I think the socialButtonClickHandler is only available in the JS file because, after file compression, the function will be renamed. |
@ronald2wing the compressed (minified) version works well. As I see, the issue is related with with As you can see in the pictures, there is a |
@ronald2wing I added a prevention of other event listeners to the share-buttons.js file. Theoretically, this should do the trick. Could you please check it out? |
Sure. Thank you. I will check tonight.
…On Sat, Aug 12, 2023, 11:54 AM Sergey Kudashev ***@***.***> wrote:
@ronald2wing <https://github.com/ronald2wing> I added a prevention of
other event listeners to the share-buttons.js
<https://github.com/kudashevs/laravel-share-buttons/blob/master/resources/assets/js/share-buttons.js>
file. Theoretically, this should do the trick.
Could you please check it out?
—
Reply to this email directly, view it on GitHub
<#1 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AD7QPSOXIUSQP4R3KFY6GWLXU6RMLANCNFSM6AAAAAA3GDFIIM>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
It works after applying the new changes and setting the function to the window because static file compression changed its name. |
Nice. @ronald2wing I want to close the issue, but before closing it I have two questions:
|
1) That's the new method I wanted.
2) You can leave them.
…On Sun, Aug 13, 2023, 2:16 AM Sergey Kudashev ***@***.***> wrote:
Nice. @ronald2wing <https://github.com/ronald2wing> I want to close the
issue, but before closing it I have two questions:
- this new method is what you wanted or you have other suggestions?
- should I delete the images of your project of should I leave them?
—
Reply to this email directly, view it on GitHub
<#1 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AD7QPSL7FQ5QGITRC4HFN43XVBWKJANCNFSM6AAAAAA3GDFIIM>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
The requested functionality was added in the v4.0.0 release. @ronald2wing thank you for your contribution. |
Thank you as well.
…On Mon, Aug 14, 2023 at 5:39 PM Sergey Kudashev ***@***.***> wrote:
The requested functionality was added in the v4.0.0
<https://github.com/kudashevs/laravel-share-buttons/releases/tag/v4.0.0>
release.
@ronald2wing <https://github.com/ronald2wing> thank you for your
contribution.
—
Reply to this email directly, view it on GitHub
<#1 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AD7QPSI336TGVVVIOQ7CE73XVKLHRANCNFSM6AAAAAA3GDFIIM>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Since the JavaScript methods fired on Dom load, the buttons generated later will not have the functionality.
Please create a JavaScript method for people to add events to the buttons later.
The text was updated successfully, but these errors were encountered: