| font-family: -apple-system; |
| <div id="source">Rich text</div> |
| <div id="destination" contenteditable></div> |
| // The contents of this `result` dictionary will contain a map of {event type => {MIME type => data}}. |
| function updateResultWithEvent(event) { |
| for (const type of event.clipboardData.types) |
| eventData[type] = event.clipboardData.getData(type).replace(/style="[^"]+"/g, 'style="...""'); |
| result[event.type] = eventData; |
| output.textContent = JSON.stringify(result, null, " "); |
| getSelection().setBaseAndExtent(source, 0, source, 1); |
| destination.addEventListener("paste", updateResultWithEvent); |
| if (window.testRunner && window.internals) { |
| internals.settings.setCustomPasteboardDataEnabled(true); |
| testRunner.execCommand("Copy"); |
| testRunner.execCommand("Paste"); |