- From: snianu <notifications@github.com>
- Date: Tue, 12 Dec 2023 14:53:40 -0800
- To: w3c/editing <editing@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <w3c/editing/issues/423/1852939466@github.com>
It looks like we still need a resolution for this issue. There are mainly three different API shapes for delay rendering support: > typedef (DOMString or Blob) ClipboardItemValue; callback ClipboardItemValueCallback = ClipboardItemValue(); typedef Promise<(ClipboardItemValue or ClipboardItemValueCallback)> ClipboardItemData; This provides a callback for the formats being delay rendered. It's ergonomical to the web authors and doesn't have any race issue when formats are written to the clipboard as the browsers can check which formats have callback associated with them and which ones have data already populated during `write()` before the formats are written to the system clipboard. > navigator.clipboard.write(new ClipboardItem({ 'text/html': new Promise(resolve => { // somehow this event target is scoped to this clipboard item? // event will only be fired once, even if paste happens again? some_target.addEventListener('some_event_type', async e => { // are we the type handler that's actually desired here? if (e.requestedType === 'text/html') { // do a bunch of stuff here, probably async resolve(results); } }; }), /* repeat the above for every supported type, but we'll only ever call resolve() for one Promise */ })); This has several issues: - It is not ergonomical. - Not sure how the sites can select which formats can be delay rendered during `write()`. Without this info we have to assume all the formats are delay rendered? > Add a new method to ClipboardItem called addDelayedWriteCallback, that takes in a map of formats to callbacks(addDelayedWriteCallback's). Issues with this approach: - It adds overhead to the web author (it is a new function for them to learn) and can create confusion when having the same format(s) repeated in both the ClipboardItem constructor and in addDelayedWriteCallback's map We would like to propose the first option: > typedef (DOMString or Blob) ClipboardItemValue; callback ClipboardItemValueCallback = ClipboardItemValue(); typedef Promise<(ClipboardItemValue or ClipboardItemValueCallback)> ClipboardItemData; -- Reply to this email directly or view it on GitHub: https://github.com/w3c/editing/issues/423#issuecomment-1852939466 You are receiving this because you are subscribed to this thread. Message ID: <w3c/editing/issues/423/1852939466@github.com>
Received on Tuesday, 12 December 2023 22:53:46 UTC