Skip to content

Conversation

@captainbrosset
Copy link
Contributor

@github-actions github-actions bot added the feature definition Creating or defining new features or groups of features. label Sep 3, 2024
@autonome
Copy link
Contributor

autonome commented Sep 6, 2024

We added this in #1703.

(I didn't realize how new this is, will fix a regular web papercut for me!)

@ddbeck
Copy link
Collaborator

ddbeck commented Sep 12, 2024

I'm going to close this as a duplicate of #1703. If you still think this should be a standalone feature, please merge main into your branch and reopen for discussion/review. Thank you!

@ddbeck ddbeck closed this Sep 12, 2024
@captainbrosset
Copy link
Contributor Author

I don't think web devs know that the clipboard API doesn't support all formats by default. I don't think many of them know that it only supports text, html, and png out of the box. And, on top of this, that browsers sanitize the html and png data to avoid security problems, so you don't even get to read the same HTML code that you wrote in the clipboard earlier.

Because of this fact, and because the addition of SVG, and web custom formats happened much later than the bulk of the clipboard API, I would still prefer to track these as separate features. I think splitting these gives a better chance for devs to understand the limits of the clipboard API, and the additional features they need to achieve their particular use case (for example, a Figma-like app would want to check the Baseline status for both a clipboard, and a clipboard-svg feature. Or, an excel-like app would want to check the status of a clipboard-web-custom-format feature, to know whether they can pass their custom spreadsheet+macro code, unsanitized, in the clipboard, between a native and a web app).

@ddbeck
Copy link
Collaborator

ddbeck commented Sep 12, 2024

OK, please reopen after you've merged in main and resolved the errors. The existing PR will fail on merge, due to duplicate keys.

@captainbrosset
Copy link
Contributor Author

Here is a summary of my changes, in line with my understanding of the clipboard API:

  • Removed the BCD keys for web custom formats and SVG from the main async-clipboard feature. The feature was usable before those optional types were added. The clipboard API only supports html, text, and png, and sanitizes content for security reasons (e.g. removes script tags from HTML content).

  • Added a new clipboard-custom-format feature, which captures support for the ability to write and read custom web data, which mime-type starts with the prefix web . This allows apps, like Excel online for example, to store custom cell data, potentially together with scripts and such, in an unsanitized way in the system clipboard. This way you can pass this complex data without the browser trying to strip away bits of it between Excel desktop and Excel online.

  • Add a new clipboard-svg feature, which captures support for the ability to write and read svg data. Useful for apps like Figma, Word, PowerPoint and such, which natively support copy/pasting SVG figures, but which was, so far impossible on the web.

  • Slightly rephrased the clipboard-unsanitized-formats to only apply to HTML, according to spec. This unsanitized parameter is a convenience to pass raw HTML around in the system clipboard (without UA sanitization), because this use case is pretty common, for example for online text editors.

Co-authored-by: Dietrich Ayala <50103+autonome@users.noreply.github.com>
Copy link
Collaborator

@ddbeck ddbeck left a comment

Choose a reason for hiding this comment

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

Some nitpicking on the names and descriptions, but this looks like a good forward. Thank you, Patrick!

captainbrosset and others added 2 commits September 24, 2024 14:58
@ddbeck ddbeck merged commit 862d5af into main Sep 24, 2024
@ddbeck ddbeck deleted the svg-clipboard branch September 24, 2024 15:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature definition Creating or defining new features or groups of features.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants