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

Copy to Clipboard Functionality #34

Merged
merged 4 commits into from
Oct 19, 2019
Merged

Conversation

JGriffCS
Copy link
Contributor

@boywithsilverwings
I haven't heard back from you regarding issue #10 so I figured I'd go ahead and open a PR and we could communicate here regarding how you'd like it implemented.

I created a new component to handle the copying functionality and placed it in the sidebar. For now I've wrapped it in a FieldSet/Field combo to handle the margins/padding. Initially I tried to find a solution that didn't involve creating a new element from which to select/copy, but as far as I can tell the way the monaco editor is structured makes it impossible to perform these operators directly upon it.

For now the button itself fills the full width of the sidebar and uses the same styles as the "Load" button and "On" switches. Please let me know if you'd like changes made to the positioning, size, styles, wording, etc...

One thing I wasn't able to figure out was how to enable/disable the button based on if the editor had content. If you have any insight into how to do this, please let me know and I'll make the necessary changes. For now the button is always active which doesn't seem to cause any issues.

Copy to Clipboard

@agneym
Copy link
Owner

agneym commented Oct 19, 2019

Hey @JGriffCS! First of all, Thanks for the PR.
This was an issue I had put forward as I reminder for myself and hence the lack of details, sorry about that. I don't think putting the button on the sidebar really cuts it.

We cannot put it atop the sidebar becase:

  1. It's an operation after adding content, would be better either at the bottom or somewhere on right or bottom.
  2. Bottom of the sidebar would mean that the people with small screens have to scroll to see.
  3. Top of sidebar means that moving to a mechanism to show the button only when there is content would have to move the whole content below it.

I will add more comments on the issue itself so that it's more findable.

@JGriffCS
Copy link
Contributor Author

Hey @boywithsilverwings

Per our discussion in #10 I pulled in react-tiny-fab and integrated the editor actions.

Copy to Clipboard v2

Let me know if you have any thoughts on colors/styles or anything else. I was also wondering where you sourced your icons from? I had originally intended to use icons for both the actions, but since the close icon has a border it doesn't look quite right for a "clear" function. Using just an "X" is fine, but I think the buttons might look a bit nicer if the + and x were also icons. Alternatively, if you have any suggestions for icons that more closely match the functions that would be great too.

onClick={clearEditor}
style={actionButtonStyles}
>
X
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you use × instead of a normal X?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great idea! Done.

@agneym agneym merged commit 2fb167f into agneym:master Oct 19, 2019
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

Successfully merging this pull request may close these issues.

2 participants