Automattic / Automattic/simplenote-electron
Pasting markdown-ish plain text sometimes results in a leading `\` character being added
- Dominant language
- TypeScript
- Stars
- 5.3k
- Forks
- 588
- Avg merge
- 9h 45m
- Merged PRs (30d)
- 4
Description
Environment:
- Windows 11
- Firefox browser (140.10.2esr (64-bit))
- Simplenote as browser app Version 2.27.1
When I paste test that uses markdown formatting, is sometimes get a result where the pasted text has backslashes added to the beginning of the line.
Whether or not this happens seems to depend on what application put the text on the clipboard. If I copy the text from notepad, the paste works fine.
If I copy the text from [MDCharm](https://github.com/zhangshine/MdCharm) (an old, no longer maintained open source markdown editor). Many lines have the backslash inserted at the beginning of the line. Pasting that same clipboard into another editor works fine. I guess the Windows clipboard has some sort of meta-data about the copied info that is confusing Simplenote?
### Expected
Copy from notepad to Simplenote (works fine: the pasted data is unmodified):
```
# header 1
Some plain old text
- bullet list 1
- bullet list 2
two leading spaces on this line.
Two blank lines precede this line
- another bullet list?
- what is going on?
more plain old text
```
### Observed
Copy that same data from MDCharm to Simplenote:
```
\# header 1
Some plain old text
\- bullet list 1
\- bullet list 2
two leading spaces on this line.
Two blank lines precede this line
\- another bullet list?
\- what is going on?
more plain old text
```
Note the lines with some sort of markdown formatting characters are prefixed with `\`. Also note that each line is separated by a single blank line regardless of what the source had, and that leading whitespace is removed from the lines.
This problem shows regardless of how I paste the text when using the keyboard:
- Ctrl-V
- Shift-Ctrl-V
- Shift-Insert
There was another paste problem (#3349) where Ctrl-V paste didn't do anything (Shift-Ctrl-V was a workaround) that apparently got resolved at some point. Or something. A PR is mentioned as a fix for #3349, but it doesn't look like that PR has been merged.
Contributor guide
Research direction
No source files or tests are named. Reproduce the paste using Windows 11 and Firefox, comparing text copied from Notepad with the same text copied from MDCharm, then trace the application's clipboard and paste handling. Done means markdown-like lines are not prefixed with backslashes and the original blank lines and leading whitespace are preserved.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- electron, typescript
- Domain
- desktop
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100