Skip to content
Go back

Web Clipboard Notes (Summary)

Web Clipboard Notes

These are short notes from the article:
https://alexharri.com/blog/clipboard
Read the original article for full details.


Clipboard Basics


Clipboard APIs

Async Clipboard API

Clipboard Events API


Trusted Copy Events

Clipboard can only be modified during trusted events.

Important detail:

This is why many web apps still use execCommand.


Google Docs Clipboard Handling

Google Docs uses: document.execCommand("copy")

Why?

Because it:

What Google Docs writes to clipboard

Result


Figma Clipboard Handling

Figma needs to copy complex design objects.

What Figma does

  1. Serialize design data to JSON
  2. Encode JSON as base64
  3. Embed base64 inside HTML
  4. Copy the HTML to clipboard

When pasting

Figma uses fig-kiwi

Why this approach

Because:

So Figma uses HTML as a container for its own clipboard data.


Key Takeaways



Share this post on:

Previous Post
What is Lerp? (Linear Interpolation)
Next Post
Renaming Local and Remote Git Branches