-
Notifications
You must be signed in to change notification settings - Fork 1
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
feat: Web Share (#286) #341
Conversation
* due to annoying errors appearing in VSCode about missing rules
might want to use this https://github.com/1904labs/dom-to-image-more for the ChartView component to produce a single image instead of extracting all the d3 vizualization SVG elements in the ChartView and creating an image for each one |
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.
The button at the top right works fine for me, but the other "Share" buttons in the viz/tables are not visible on my machine (Linux, Firefox or Chromium), even though they are listed in the component hierarchy of vue-dev-utils. Do you have an idea of what could be the problem? Edit: Ok it seems that Edit 2: Maybe this will be fixed with your PRs in the polyfill repo ? |
You are right Florian that if there is no share button the export button is not needed but I found it clumsy and even more inconsistent to remove it... Also, the code becomes cleaner and the old workaround for the export+download in 1 click of the download button is not needed... Downside is that the user needs to first export and then download... Edit: |
Ok, that is not good I have to take a better look |
+ Add ChartViewVRowWebShare component that is a VRow with a VCol at the end for image exporting, downloading and sharing of the VRow node + Create a mixin for the export image functionality and use it both for chart views and vega visualizations + Use dom-to-image-more library to export a DOM node to an image
@ffsinger Now the SVGs are not exported separately but the entire Finally, the background of the images is white now and not transparent. |
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.
ChartViewSunburst
should also use ChartViewVRowWebShare
Otherwise it looks good now
@andreaskundig your review is pending |
@valentinoli I took this week off, but one approval is enough for a pull request, you can merge it. |
Implemented a share button that uses the Web Share API with a polyfill.
See issue
I've implemented a
BaseShareButton
component. It can be used for file sharing too when the device/browser supports it. I added the share button toUnitFilterableTable
to share the exported CSV of a data table, and toUnitVegaViz
to share the viz as an image. The share button in the top right corner of an experience is just for sharing meta-info about the experience page -url
,title
,text
. I append thehashtags
to thetext
. These properties are also included when a file is shared but can be overwritten.The Windows native share dialog is quite limiting. I know that the Twitter Windows app supports it (although CSV sharing does not seem to work). For Windows we might want to consider turning it off and using the polyfill instead but this we can discuss.
Polyfill
Note that the polyfill package does not support file sharing and has some bugs (I have submitted PRs for some) but it is pretty nice!
My PRs:
https://github.com/on2-dev/share-api-polyfill/pulls/valentinoli