Re: [w3c/editing] Additional documents for unsanitized HTML read/write (PR #422)

@snianu commented on this pull request.



> @@ -0,0 +1,40 @@
+# How to use the Async Clipboard API to read and write unsanitized HTML
+**Last updated: March, 2023**
+
+Reading and writing unsanitized HTML to and from the clipboard is currently available in Chromium-based browsers in 113 and later behind the flag `ClipboardUnsanitizedContent`.
+1. Download Microsoft Edge ([Canary Channel](https://www.microsoftedgeinsider.com/en-us/download/canary)).

Should we mention that similar process can be followed to test this on Chrome Canary?

> @@ -0,0 +1,40 @@
+# How to use the Async Clipboard API to read and write unsanitized HTML
+**Last updated: March, 2023**
+
+Reading and writing unsanitized HTML to and from the clipboard is currently available in Chromium-based browsers in 113 and later behind the flag `ClipboardUnsanitizedContent`.
+1. Download Microsoft Edge ([Canary Channel](https://www.microsoftedgeinsider.com/en-us/download/canary)).
+2. Launch Edge with the command line flag `--enable-blink-features=ClipboardUnsanitizedContentNavigate`.
+
+## Example
+
+The write method doesn't change it's shape:

Nit: Typo: The write method doesn't change **its** shape

> +const blobInput = new Blob([textInput], { type: 'text/html' });
+const clipboardItem = new ClipboardItem({ 'text/html': blobInput });
+await navigator.clipboard.write([clipboardItem]);
+```
+
+Writing unsanitized HTML to the clipboard:
+```html
+<style>p { color: blue; }</style><p>Hello, World!</p>
+```
+
+For reference, this would be the sanitized output:
+```html
+<p style="color: blue; font-size: medium; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;">Hello, World!</p>
+```
+
+The read method now accepts a dictionary with the `unsanitized` keyword and the `text/html` MIME type.

Nit: and **only** `text/html` MIME type

> @@ -0,0 +1,40 @@
+# How to use the Async Clipboard API to read and write unsanitized HTML
+**Last updated: March, 2023**
+
+Reading and writing unsanitized HTML to and from the clipboard is currently available in Chromium-based browsers in 113 and later behind the flag `ClipboardUnsanitizedContent`.
+1. Download Microsoft Edge ([Canary Channel](https://www.microsoftedgeinsider.com/en-us/download/canary)).
+2. Launch Edge with the command line flag `--enable-blink-features=ClipboardUnsanitizedContentNavigate`.
+
+## Example
+
+The write method doesn't change it's shape:

Also would it be better to say something like " There is no change in the API shape for write() method"?

-- 
Reply to this email directly or view it on GitHub:
https://github.com/w3c/editing/pull/422#pullrequestreview-1363689318
You are receiving this because you are subscribed to this thread.

Message ID: <w3c/editing/pull/422/review/1363689318@github.com>

Received on Wednesday, 29 March 2023 18:11:11 UTC