StackExchange / StackExchange/Stacks-Editor

bug(editor) Text originating from a code editor will be pasted in as code, even if is definitely not code

Open
#174 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug mode - markdown mode - rich text
Dominant language
TypeScript
Stars
437
Forks
61
Avg merge
16h 2m
Merged PRs (30d)
8

Description

Describe the bug
Any text that is copied from a code editor (including VS, VS Code, and even revisions/source in the browser) is pasted into both MD and RT as a fenced code block. This happens even if the text in question has no markdown at all (though really, the presence of markdown should not cause this).

To Reproduce
Steps to reproduce the behavior:

  1. Go to revisions/source for the MSE post and copy out any text. The 4th paragraph has no markdown.
  2. Go to the stacks editor, paste it in
  3. Note: is a fenced code block if pasted into either mode

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
image

Desktop (please complete the following information):
Windows 11 Chrome 103

Additional context
https://meta.stackexchange.com/a/380334/51

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.

Research direction

Start by reproducing the paste behavior in the Stacks editor using text copied from the linked revisions/source page, in both Markdown and Rich Text modes. Trace the editor's paste handling and verify that plain text is not converted to a fenced code block; confirm the behavior with text containing and lacking Markdown.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.