Skip to content

refactor(clipboard-plugin): remove meta from editorjs clipboard payload#179

Open
ilyamore88 wants to merge 2 commits into
mainfrom
refactor/remove-clipboard-payload-meta
Open

refactor(clipboard-plugin): remove meta from editorjs clipboard payload#179
ilyamore88 wants to merge 2 commits into
mainfrom
refactor/remove-clipboard-payload-meta

Conversation

@ilyamore88

Copy link
Copy Markdown
Member

Why

The application/x-editor-js clipboard payload carried a meta.version field hardcoded to '3.0.0', alongside a @todo get version info from Core. Nothing reads it — no paste handler exists yet, and a repo-wide grep finds the MIME type only in this plugin and its spec.

Shipping a placeholder version in a public clipboard format is worse than shipping nothing: a future paste handler that trusted the field would branch on a value that never reflected reality. Removing it now, before a consumer exists, costs no migration.

What changed

  • application/x-editor-js payload is now { blocks }meta and its version are gone.
  • Deleted the module-private Meta interface and the meta member of ClipboardEditorJSObject.
  • #createClipboardObject returns { blocks }; the @todo about sourcing a version from Core is dropped.
  • Spec (openspec/specs/clipboard-plugin/spec.md) updated, plus a new scenario pinning that blocks is the payload's only key.

The object wrapper is kept rather than serializing the bare array, so reintroducing a sibling key later stays additive for readers.

Breaking change

The application/x-editor-js clipboard payload no longer includes meta.

No exported TypeScript API changesClipboardEditorJSObject and Meta were module-private, so no .d.ts surface moves. The break is on the wire format only, and the value it carried was a placeholder, not a real version.

Verification

  • 12/12 tests pass (2 written failing first, per the repo's TDD rule)
  • lint:ci clean at --max-warnings 0
  • tsc --build clean
  • Stryker: 100% mutation score (break threshold 75), 0 survivors

Notes

Planned via OpenSpec; artifacts archived under openspec/changes/archive/2026-07-21-remove-clipboard-payload-meta/.

One thing worth a look: openspec archive rewrote openspec/specs/clipboard-plugin/spec.md and, as collateral, stripped blank lines around ## Requirements and dropped the trailing Implemented in `src/index.ts`... footer. That footer is a convention in every spec file under openspec/specs/, so I restored it — the spec diff here reflects only the intended payload change. May be worth filing against the archive tool separately.

🤖 Generated with Claude Code

ilyamore88 and others added 2 commits July 21, 2026 21:43
The `application/x-editor-js` clipboard payload carried a `meta.version`
field hardcoded to '3.0.0' with a `@todo get version info from Core`.
Nothing read it — no paste handler exists yet, and a repo-wide grep finds
the MIME type only in this plugin and its spec.

Shipping a placeholder version in a public clipboard format is worse than
shipping nothing: a future paste handler that trusted the field would
branch on a value that never reflected reality. Removing it now, before a
consumer exists, costs no migration.

The payload becomes `{ blocks }`. The object wrapper is kept rather than
serializing the bare array so that reintroducing a sibling key later stays
additive for readers.

BREAKING CHANGE: the `application/x-editor-js` clipboard payload no longer
includes `meta`. No exported TypeScript API changes — `ClipboardEditorJSObject`
and `Meta` were module-private; the break is on the wire format only.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Main specs already carried the delta, so archiving moved the change
artifacts without altering spec content.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@ilyamore88
ilyamore88 requested a review from Copilot July 21, 2026 21:24
@github-actions

Copy link
Copy Markdown

Unit Tests

Package Coverage Delta
@editorjs/clipboard-plugin 66.66% 0% ⚪️

Mutation Tests

Package Mutation score Dashboard URL
@editorjs/clipboard-plugin 100.00% 🟢 Dashboard

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR simplifies the ClipboardPlugin’s custom clipboard wire format by removing the placeholder meta.version from the application/x-editor-js payload, keeping the payload as an object wrapper containing only { blocks } and aligning tests/specs accordingly.

Changes:

  • Remove meta/version from the application/x-editor-js clipboard payload (now { blocks } only).
  • Update clipboard plugin tests to match and add a scenario asserting blocks is the only key.
  • Update the OpenSpec clipboard-plugin spec and archive the corresponding OpenSpec change artifacts.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/plugins/clipboard-plugin/src/index.ts Removes meta from the clipboard payload and simplifies the payload factory to return { blocks }.
packages/plugins/clipboard-plugin/src/index.spec.ts Updates payload expectations and adds a test asserting no meta key is present.
openspec/specs/clipboard-plugin/spec.md Updates the documented payload shape and adds a scenario explicitly requiring blocks to be the only key.
openspec/changes/archive/2026-07-21-remove-clipboard-payload-meta/tasks.md Archives the implementation/testing task plan for the change.
openspec/changes/archive/2026-07-21-remove-clipboard-payload-meta/specs/clipboard-plugin/spec.md Archives the delta spec reflecting the updated payload requirements.
openspec/changes/archive/2026-07-21-remove-clipboard-payload-meta/proposal.md Archives the change proposal describing the wire-format breaking change.
openspec/changes/archive/2026-07-21-remove-clipboard-payload-meta/design.md Archives the design rationale and tradeoffs for removing meta.
openspec/changes/archive/2026-07-21-remove-clipboard-payload-meta/.openspec.yaml Adds archive metadata for the OpenSpec change.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/plugins/clipboard-plugin/src/index.spec.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants