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

Post message after all copy buttons added #167

Open
ohrely opened this issue Apr 14, 2022 · 3 comments
Open

Post message after all copy buttons added #167

ohrely opened this issue Apr 14, 2022 · 3 comments
Labels
enhancement New feature or request

Comments

@ohrely
Copy link

ohrely commented Apr 14, 2022

Describe the problem/need and solution

Context
We are logging copy events in documentation built with sphinx. We can clumsily capture these events by listening to all click events on a parent node, but we would prefer to add an event listener to each copybutton.

Problem / Idea
Because copy buttons are injected into the page at a non-deterministic time, there is currently no way for us to know when sphinx-copybutton has finished adding all buttons to the document.

Solution
Two potential solutions we've thought of:

  1. Trigger a custom event when all buttons are added
  2. Post a message to window when all buttons are added

Benefit
This would simplify the task of monitoring copybutton click events for analytics and other purposes.

Guide for implementation

We think the event or message would be triggered at the end of this for loop.

Tasks and updates

No response

@ohrely ohrely added the enhancement New feature or request label Apr 14, 2022
@welcome
Copy link

welcome bot commented Apr 14, 2022

Thanks for opening your first issue here! Engagement like this is essential for open source projects! 🤗

If you haven't done so already, check out EBP's Code of Conduct. Also, please try to follow the issue template as it helps other community members to contribute more effectively.

If your issue is a feature request, others may react to it, to raise its prominence (see Feature Voting).

Welcome to the EBP community! 🎉

@ohrely
Copy link
Author

ohrely commented Apr 14, 2022

(We is @fasiha and myself)

If this change would be welcome, we would be happy to take a stab at implementing.

@choldgraf
Copy link
Member

This seems reasonable to me as long as the implementation isn't too complicated to maintain👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants