-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Feature/clipboard-html #2652
Feature/clipboard-html #2652
Conversation
Thanks @Lxstr - two very nice features! I think though that we had better make copy-on-change opt-in, or it could cause unintended copying in existing apps, which may have been created to constantly be updating this content as other things happen in the app. What if we make a new prop like
That last option could be added later, but at least the |
@alexcjohnson Glad it's helpful! I think that sounds pretty reasonable to me |
This may warrant a separate issue but I'm wondering if we are going a bit overboard on the props in general in Dash because we can't directly call methods like copyToClipboard in this case. (or can we? I'm not sure) I noticed something similar when trying to use the autoSizeAllColumns function in AGGrid. AGGrid has many great methods I would love to directly trigger https://www.ag-grid.com/javascript-data-grid/column-api/ This issue shows the syntax I was originally expecting to be able to use. plotly/dash-ag-grid#99 Ideally, I would like to be able to simply call using the below code rather than using a new prop. I'm guessing passing parameters might be off the table initially, with types going from Python to JS. Passing an empty tuple or True would work initially for many.
|
9c28972
to
26bf6ab
Compare
29902ad
to
c119924
Compare
@alexcjohnson Hi I've updated the code to trigger copy on a change to n_clicks, that way existing behaviour shouldn't change? |
@Lxstr that's a great idea! So then we don't need a I'm not sure why so many tests are failing - may just be due to something else we've already fixed, if so updating with the latest changes from the |
Thanks @alexcjohnson! I've rebased my branch onto dev and then I ran npm lint, 9 files where changed, all in the tests folder and mostly spacing. I don't understand why so many files would be changed when I've only altered 2? Pre-commit hook still failed after doing this saying
|
c119924
to
2ffada3
Compare
3ce952e
to
44639eb
Compare
That message is from @T4rk1n would you be able to look at what's going on with the |
Hmph weird, not sure what was happening with the unit tests before but they're passing now 🤷 as is your new test 🎉 So now all we need is a changelog entry and this should be good to merge! |
Just updated with a changelog. Can I edit the docs somewhere? |
That's a lot of changes to the changelog - most of them look good but a few I'm not sure about, looks like some of the structure may be changing in unintended ways. I'd rather this PR just add its own line, and we can take a second PR to clean up the changelog formatting. Dash docs currently live in a private repo, unfortunately. The new docstrings will be picked up automatically but if you want to add new examples, easiest would be to just describe the example here and we can incorporate it into the docs (cc @LiamConnors) |
OOPS sorry I must have accidentally saved with formatting, I'll revert now. For the docs I think what the docstring picks up should be fine, people will see the new prop and also the n_clicks behaviour is what I was anticipating originally anyway |
34e939a
to
9469c58
Compare
Just updated now. Thanks for all the help |
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.
💃 Excellent, thanks so much! I'll merge once the tests pass 🎉
This allows the clipboard to firstly support HTML MIME type. This allows us to copy to clipboard for example, both df.to_string and df.to_html and be able to get the full table on paste where HTML is accepted such as email or other apps. This is optional and independent prop called html_content.
Secondly, the clipboard will now copy on a change to it's content. Previously you could only copy if you clicked on the clipboard item itself. The clipboard item may not be suited for some UIs and so now you can use another component to trigger the copy, such as a button. This behaviour is in line with dcc.Download and many other components.
optionals
CHANGELOG.md