Add Copy to Clipboard Button for Regex Templates #534
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Firstly, I want to express my admiration for this fantastic and incredibly useful tool you’ve built! Regexr has been an amazing resource for developers like me, and I deeply appreciate the effort and thought that has gone into making such a valuable application.
While using the app, I noticed that there wasn’t an easy way to quickly copy a regex expression after testing or modifying it. I believe this feature would be highly beneficial, as it would allow users to seamlessly copy a regex expression once they’ve validated it, making the tool even more efficient for day-to-day use.
To address this, I’ve added a Copy to Clipboard button next to each regex template. Here’s what this new feature includes:
This small addition aims to improve the user experience by saving time and making the application more convenient.
Code Changes:
The only functional change in the code is within the
_initUI(el)
function, where I added the logic to implement the Copy to Clipboard button. All other changes in the codebase are purely formatting adjustments made automatically by the Prettier extension, so they can be safely ignored.I’ve tested the functionality to ensure it works across different scenarios, and I’ve also styled the button to align with the overall design of the app.
Thank you for considering this contribution! I’m happy to make any adjustments or discuss further if needed.