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

Paste into input fields not possible anymore #1

Open
HenriWahl opened this issue Feb 16, 2023 · 4 comments
Open

Paste into input fields not possible anymore #1

HenriWahl opened this issue Feb 16, 2023 · 4 comments

Comments

@HenriWahl
Copy link

Hi there,

I use your CopyClipboardJS happily because it makes it so easy to add click-and-copy functionality. I recently found that it causes normal fields in forms to become unable to receive a paste from the clipboard. Do you have any idea why and how to fix this?

Regards

@BaseMax
Copy link
Owner

BaseMax commented Feb 16, 2023

Hi Henri, Thank you for your message. Can you please send more details about the problem?
We need more details and an example of the problem, for checking it.

Best

@HenriWahl
Copy link
Author

HenriWahl commented Feb 16, 2023

Wow what a fast response :-)

I use ClipBoardJS in addition to htmx like this:

<html>
  <head>
    <script src="/static/js/CopyClipboard.js"></script>
  </head>
  <body>
     <input type="search"
                 hx-boost="true"
                 hx-post="/search/"
                 hx-target="#content"
                 hx-swap="innerHTML scroll:top"
                 hx-trigger="keyup changed, keydown[key=='Enter'], search">
      <span data-copy-text="dummy-text" onclick="copy.text(this);">dummy-text</span>
  </body>
</html>

This works nicely - one click onto the dummy-text and it gets copied.

But, the input field does not accept any paste via ctrl+v or by context menu. Might the htmx stuff be the one to blame?

Thanks for any hint!

@BaseMax
Copy link
Owner

BaseMax commented Feb 16, 2023

So you want to keep the paste feature for the input tag while we have a copy to clipboard feature for the button(here is the span tag). yes?

@HenriWahl
Copy link
Author

Yes, exactly.

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