[Feature Request] Monaco's onDidPaste can only obtain text and cannot obtain clipboard objects

Open
#4,708 1 comment 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
32/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Domain
frontend

Research direction

Start by tracing the implementation of editor.onDidPaste and how the native clipboard event is handled. The issue provides no source file, playground, or test entry point, so first locate the paste event path and existing coverage. Done means pasted clipboard objects, including image or file items, are available through the event rather than only text.

Written by the indexing model from the issue text.

Description

feature-request
Context
  • This issue is not a bug report. (please use a different template for reporting a bug)
  • This issue is not a duplicate of an existing issue. (please use the search to find existing issues)
Description

paste event result carries native clipboard event attribute. But if i paste a picture, monaco's onDidPaste can only obtain text and cannot obtain clipboard objects.

this.editor.onDidPaste((e) => {
console.log(e.clipboardEvent.clipboardData?.items); // e.clipboardEvent.clipboardData?.items always return an empty array
//do some things ,such as upload files from clipboardEvent
});

Monaco Editor Playground Link

No response

Monaco Editor Playground Code

No response

Dominant language
JavaScript
Stars
46.8k
Forks
4.1k
Avg merge
17h 58m
Merged PRs (30d)
1

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from microsoft/monaco-editor

All issues in microsoft/monaco-editor

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.