uiwjs / uiwjs/react-codemirror

Format the clipboard value on Paste

Open
#368 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
2.3k
Forks
161
PR merge metrics
No merged PRs in 30d

Description

I'm using the Code Mirror to visualize and lint a list of words for the user.
My expectation is to auto-format the inserted text e.g. convert a, b, c to 3 lines of a, b and c.

I tried to use:

  1. onPaste event and clipboard.setData('text/plain', myData)
  2. prevent the default paste behavior and insert my custom text instead. But eventually selection is always points to 0, 0, there is no getCursor() interface, so I did not find how to do so
  3. I did not find the way how to replace the entire text with my formatted one (prevent onPaste, format the new text and set it)

Is there a correct approach to do that?

Contributor guide

No contributing guide indexed for this repository

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.

Research direction

No source file, entry point, or test is identified in the issue. Begin by reproducing the described paste flow in the React CodeMirror integration, then define how formatted pasted text should preserve the selection and verify the behavior with a focused test.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.