webbingbrasil / filament-copyactions

A easy-to-use copy actions for Filament Admin Pages, Tables and Form Fields.
56 stars 15 forks source link

It doesn't copy anything #9

Closed Abdo-Shaibany closed 6 months ago

Abdo-Shaibany commented 1 year ago

Describe the bug I install the plugin and It worked as expected from the UI, except that it didn't copy anything to Clipboard

magarrent commented 1 year ago

Same here. I've tried the Column and Action and don't do anything

magarrent commented 1 year ago

Hey, is it possible that this plugin works only using Admin panel?

You're using Filament::registerRenderHook('scripts.end' and we don't have it using the single package (I think) and it's not loading any js

magarrent commented 1 year ago

Hey, is it possible that this plugin works only using Admin panel?

You're using Filament::registerRenderHook('scripts.end' and we don't have it using the single package (I think) and it's not loading any js

Yep, I've just added this into my component or blade and it works @AbdoShiabany

@push('js')
    <script>
        document.addEventListener('clipboard', function (e) {
            window.navigator.clipboard.writeText(e.detail);
        });
    </script>
@endpush
jdbravo commented 1 year ago

I'm using the Admin panel, and it's not working for me.

Hey, is it possible that this plugin works only using Admin panel?

You're using Filament::registerRenderHook('scripts.end' and we don't have it using the single package (I think) and it's not loading any js

bernhardh commented 1 year ago

same here...

dmandrade commented 1 year ago

Sorry for the delay in reply, can you give me information about the browser, OS, and filament version?

jdbravo commented 1 year ago

I'm using chrome, macOS Monterey and the version of filament is 2.4.2. I think it's related with the absence of a SSL certificate, but I have to check: https://stackoverflow.com/questions/51805395/navigator-clipboard-is-undefined/51823007#51823007

dmandrade commented 1 year ago

I'm using chrome, macOS Monterey and the version of filament is 2.4.2. I think it's related with the absence of a SSL certificate, but I have to check: https://stackoverflow.com/questions/51805395/navigator-clipboard-is-undefined/51823007#51823007

Yea, clipboard api only works on localhost or https context. If you are running you project on local env using a custom domain (I think this is the case) you need to setup an ssl.

dmandrade commented 1 year ago

If anyone has the problem of not being able to copy anything in safari, the problem has been fixed in the latest version. Also, the package dont inject script using filament hook anymore, instead the clipboard api is called direct on click.

Last version: v1.1.0