Oriole One Instant Copy

Oriole One Instant Copy

Details
View on WordPress

Oriole One Instant Copy enhances the standard WordPress Gutenberg Code block (core/code) by injecting a small, accessible “Copy” button into the top-right corner of every code block on your site — automatically, on every existing and future post.

No shortcodes. No block-editor changes. No database modifications. Pure progressive enhancement.

How it works

The plugin uses vanilla JavaScript to detect every pre.wp-block-code element after the page loads and appends a lightweight Copy button. When clicked, the button copies the code text to the system clipboard using the modern navigator.clipboard API, with a document.execCommand fallback for older browsers.

The stored post content is never touched. If you deactivate or uninstall the plugin, your posts are exactly as they were before.

Key Features

  • Automatic — works on all existing and future posts without any editor involvement.
  • Lightweight — total asset footprint under 5 KB combined (CSS + JS). Zero dependencies.
  • Accessible — keyboard navigable, aria-label support, focus-visible outlines, screen-reader text, reduced-motion aware, high-contrast mode support.
  • Smart enqueueing — assets are loaded only on pages that actually contain a Gutenberg code block, not on every page of your site.
  • Clipboard API with fallback — uses navigator.clipboard.writeText() on secure contexts and falls back to execCommand('copy') for legacy environments.
  • Duplicate-proof — skips any code block that already has a copy button to avoid conflicts with other plugins.
  • Theme-safe — uses currentColor and semi-transparent backgrounds; works with light and dark themes without hardcoding colours.
  • No jQuery — vanilla JavaScript only.
  • No tracking, no telemetry, no external requests — 100% self-hosted.
  • Multisite compatible.

Settings

Find the settings under Settings Oriole One Instant Copy:

  • Enable / Disable the button globally.
  • Button text — customise the label shown on the button (default: “Copy”).
  • Success text — customise the label shown after copying (default: “Copied!”).
  • Position — Top Right (additional positions planned for v2).

Developer Notes

All settings use the WordPress Settings API with sanitize_callback and proper nonce handling via settings_fields(). No custom REST endpoints, no Gutenberg/React dependencies, no build tools required.

The plugin defines the following PHP constant and classes:

  • ORIOLE_OIC_VERSION — current plugin version string.
  • Oriole_OIC_Plugin — main bootstrap class (singleton).
  • Oriole_OIC_Settings — settings page and storage class.

Option stored in wp_options: oriole_oic_settings (autoloaded, single serialised array).

Details

Plugin code:
oriole-one-instant-copy
Plugin version:
1.0.0
Outdated:
No
WP version:
5.8 or higher
PHP version:
7.4 or higher
Test up to WP version:
7.0
Total installations:
0
Last updated:
2026-06-03
Rating:
Times rated:
0
clipboard
code
code-block
copy
gutenberg