Javascript Copy Functionality #1272

Closed
opened 2026-02-05 00:27:41 +03:00 by OVERLORD · 3 comments
Owner

Originally created by @Ducky6944 on GitHub (Jul 24, 2019).

Describe the feature you'd like
I am trying to add a button would copy text to the clipboard. I think this would be a beneficial functionality for a number of users.

Describe the benefits this feature would bring to BookStack users
I believe this is supported in all modern browsers. Use Case: IT Dept Using Bookstack as a Kbase. The Admin creates a page with canned responses. The user simply finds the response clicks a copy button and then can go on and paste that in an email or chat.

Additional context
I've tried to implement it using variations of the HTML and JS here. https://www.w3schools.com/howto/howto_js_copy_clipboard.asp However IDs and Classes and Script seems to be scrubbed out occasionally or changed. I've also tried implementing https://cdn.jsdelivr.net/npm/clipboard@2/dist/clipboard.min.js to no avail.

Originally created by @Ducky6944 on GitHub (Jul 24, 2019). **Describe the feature you'd like** I am trying to add a button would copy text to the clipboard. I think this would be a beneficial functionality for a number of users. **Describe the benefits this feature would bring to BookStack users** I believe this is supported in all modern browsers. Use Case: IT Dept Using Bookstack as a Kbase. The Admin creates a page with canned responses. The user simply finds the response clicks a copy button and then can go on and paste that in an email or chat. **Additional context** I've tried to implement it using variations of the HTML and JS here. https://www.w3schools.com/howto/howto_js_copy_clipboard.asp However IDs and Classes and Script seems to be scrubbed out occasionally or changed. I've also tried implementing https://cdn.jsdelivr.net/npm/clipboard@2/dist/clipboard.min.js to no avail.
OVERLORD added the 🐕 Support Question labels 2026-02-05 00:27:41 +03:00
Author
Owner

@ssddanbrown commented on GitHub (Aug 3, 2019):

Hi @typkrft,

BookStack does already support click-to-copy functionality on code blocks:

image

In you use-case, you could simply format each of your canned responses as a code block which will show this copy button upon hover.

Does this suit your need?

@ssddanbrown commented on GitHub (Aug 3, 2019): Hi @typkrft, BookStack does already support click-to-copy functionality on code blocks: ![image](https://user-images.githubusercontent.com/8343178/62413731-2e0c5880-b60a-11e9-9bb7-b2209638c222.png) In you use-case, you could simply format each of your canned responses as a code block which will show this copy button upon hover. Does this suit your need?
Author
Owner

@Ducky6944 commented on GitHub (Aug 3, 2019):

I think this could work. Thanks for your response and to the Dev teams hard work.
On Aug 3, 2019, 11:18 AM -0400, Dan Brown notifications@github.com, wrote:

Hi @typkrft,
BookStack does already support click-to-copy functionality on code blocks:
In you use-case, you could simply format each of your canned responses as a code block which will show this copy button upon hover.
Does this suit your need?

You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.

@Ducky6944 commented on GitHub (Aug 3, 2019): I think this could work. Thanks for your response and to the Dev teams hard work. On Aug 3, 2019, 11:18 AM -0400, Dan Brown <notifications@github.com>, wrote: > Hi @typkrft, > BookStack does already support click-to-copy functionality on code blocks: > In you use-case, you could simply format each of your canned responses as a code block which will show this copy button upon hover. > Does this suit your need? > — > You are receiving this because you were mentioned. > Reply to this email directly, view it on GitHub, or mute the thread.
Author
Owner

@ssddanbrown commented on GitHub (Aug 3, 2019):

@typkrft No worries! Will therefore close this off.

@ssddanbrown commented on GitHub (Aug 3, 2019): @typkrft No worries! Will therefore close this off.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#1272