Clipboard Operations

Integrate your plugin with the system clipboard to read and write text data

UXP provides clipboard APIs that let your plugin read from and write to the system clipboard—enabling users to copy, paste, and share content between your plugin and other applications. This guide covers how to use the Clipboard API, declare the necessary permissions, and handle common use cases.

System requirements

Please make make sure your development environment uses the following minimum versions to avoid compatibility issues:

  • Premiere v25.6
  • UDT v2.2
  • Manifest v5

Clipboard Security

By default, UXP plugins can't access the system clipboard; this protects users from unwanted data access. If your plugin needs to read or write clipboard content, you must declare the right clipboard permission in your manifest.json.

Choose the most appropriate permission level:

PermissionAccess LevelUse When
"read"
Read-only
Your plugin only needs to paste or read data
"readAndWrite"
Read and write access
Your plugin needs to copy and paste data

Using the Clipboard API

The clipboard is accessed through navigator.clipboard, which provides two main methods:

  • setContent(): Write data to the clipboard.
  • getContent(): Read data from the clipboard.

Both methods work with MIME type objects, where keys represent data formats (like "text/plain") and values contain the actual content.

Example: Writing to the Clipboard

Here's how to copy text to the system clipboard.

Copied to your clipboard
// Copy formatted text to the clipboard ✂️
async function copyToClipboard(text) {
try {
await navigator.clipboard.setContent({
"text/plain": text
});
console.log("✅ Text copied to clipboard");
} catch (err) {
console.error("❌ Failed to copy to clipboard:", err);
}
}
// Example usage
copyToClipboard("Welcome to UXP for Premiere!");

Example: Reading from the Clipboard

You can also read content that users have copied from other applications.

Copied to your clipboard
// Paste text from the clipboard 📋
async function pasteFromClipboard() {
try {
const clipboardData = await navigator.clipboard.getContent();
if (clipboardData["text/plain"]) {
console.log(`Pasted text: ${clipboardData["text/plain"]}`);
return clipboardData["text/plain"];
} else {
console.log("⚠️ No text data found on clipboard");
return null;
}
} catch (err) {
console.error("❌ Failed to read from clipboard:", err);
}
}
// Example usage
pasteFromClipboard();

Example: Copy and Paste Together

In many workflows, you'll want to both read and write clipboard data—for example, transforming text or syncing data between your plugin and external tools.

Copied to your clipboard
// Transform clipboard text to uppercase
async function transformClipboardText() {
try {
// Read current clipboard content
const data = await navigator.clipboard.getContent();
if (data["text/plain"]) {
const originalText = data["text/plain"];
const transformedText = originalText.toUpperCase();
// Write the transformed text back
await navigator.clipboard.setContent({
"text/plain": transformedText
});
console.log(`✅ Transformed: "${originalText}" → "${transformedText}"`);
} else {
console.log("⚠️ No text found on clipboard");
}
} catch (err) {
console.error("Failed to transform clipboard text:", err);
}
}
// Example usage
transformClipboardText();

For this use case, your manifest would need "readAndWrite" permission.

Reference Material

Summary

  1. Clipboard Security: By default, plugins cannot access the system clipboard. You must explicitly declare clipboard permissions in manifest.json:
    • Use "read" for read-only access (pasting content).
    • Use "readAndWrite" when you need to both copy and paste.
    • Choose the least-permissive option to avoid installation friction.
  2. Using the API: Access the clipboard via navigator.clipboard:
    • setContent(): Writes data to the clipboard using MIME type objects (e.g., { "text/plain": "text" }).
    • getContent(): Reads data from the clipboard, returning an object keyed by MIME types.
    • Always wrap clipboard operations in try...catch blocks and use await for proper error handling.
  • Privacy
  • Terms of Use
  • Do not sell or share my personal information
  • AdChoices
Copyright © 2025 Adobe. All rights reserved.