-
-
Notifications
You must be signed in to change notification settings - Fork 179
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
Implement copy button #880
Conversation
…of the translations Since there are button settings in the "Navigation" section of buttons, it seems clearer to rename "Navigation" in the settings list to "Navigation and Buttons". There are many languages I have not added this to yet, but I can complete the translations soon.
Add new setting for showing/hiding the copy button in the output. Also add dividers between options to match other settings.
Implement copy button functionality. When copy button is clicked, output labels of currently selected symbols to clipboard
Create CopyButton component that follows BackspaceButton as template.
Add CopyButton to SymbolOutput to the left of backspace and clear. CopyButton is only displayed when enabled in navigationSettings (copyShowActive). CopyButton is also only displayed when at least one symbol has been selected (symbols.length > 0).
Add text to display for the setting that enables/disables showing the CopyButton. Note: these messages need translations!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@aushaag Terrific job!! Congrats!
My only comment is that you don't need to worry about the translation files. You only need to add any new string to be translated into the cboard\src\translations\src\cboard.json
file. before the production release, an automation script will take care of the translations.
Curly brackets are unnecessary
These are the descriptions next to the toggle to enable/disable the copy button in the output panel
I believe this will be overridden by the translation script anyway, but I realized there was a typo and "Display" should be "Navigation".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the great first contribution @aushaag :-)
@@ -179,6 +181,14 @@ export class OutputContainer extends Component { | |||
this.clearOutput(); | |||
}; | |||
|
|||
handleCopyClick = () => { | |||
const { intl, showNotification } = this.props; | |||
let labels = []; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know this was merged already, but I have a very small comment.
It would be simpler to assign the value when declaring the variable, and it's usually preferable to use forEach
over map
when we don't care about the function's return value.
const labels = this.props.output.map(symbol => symbol.label);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That makes sense. Just submitted a request for this update, thanks!
Create new copy button in the symbol output (disabled by default). When users click the copy button, copy the labels of the selected symbols to the clipboard:
Disable CopyButton by default, and give users the option to enable it in Settings/Navigation/ShowCopyButton: