decaporg / decaporg/decap-cms

Extra whitespace and line breaks being inserted on paste in Windows.

Open
#7,364 4 comments 0 reactions 1 assignee Claimed by @hip3r View on GitHub
area: extensions/widgets/markdown pinned type: bug
Dominant language
JavaScript
Stars
19.4k
Forks
3.1k
Avg merge
1d 14h
Merged PRs (30d)
9

Description

**Describe the bug**

Extra whitespace and line breaks being inserted on paste in Windows. It's a new line in front, and 2 new lines afterwards. It doesn't matter if I'm copying from the middle of the line, or the middle of a _word_, any paste creates the extra space.

**To Reproduce**

1. Use Windows
2. Use a `markdown` widget.
3. Attempt to copy-paste text into the widget.
4. Note the extra line breaks.

**Expected behavior**

It should paste the text as expected, only adding new lines if they were copied.

**Screenshots**

Video attached.

**Applicable Versions:**

- Decap CMS version: decap-cms@^3.1.2
- Git provider: Github
- OS: Windows 10
- Browser version: Current versions of Chrome, Firefox, Edge, Brave.

**CMS configuration**

```yml
backend:
name: git-gateway
repo:
branch: main
squash_merges: true
local_backend: true
publish_mode: editorial_workflow
show_preview_links: true

media_folder: "src/assets/uploads"
public_folder: "src/assets/uploads"
collections:
- name: "games"
label: "Game Reviews"
folder: "src/content/game"
create: true
media_folder: "media"
public_folder: "media"
preview_path: game/{{slug}}
fields:
- { label: "Title", name: "title", widget: "string" }
- { label: "Description", name: "description", widget: "string" }
- { label: "Title Image", name: "image", widget: "image" }
- {
label: "Featured?",
name: "featured",
widget: "boolean",
default: false,
}
- { label: "Body", name: "body", widget: "markdown" }
- { label: "Date", name: "date", widget: "datetime", default: "{{now}}" }
- {
label: "Author",
name: "author",
widget: "hidden",
default: "Janneke",
}
- name: recipes
label: "Recipes"
folder: "src/content/recipe"
create: true
media_folder: "media"
public_folder: "media"
preview_path: around-the-world-in-vegan-ways/{{slug}}
fields:
- { label: "Title", name: "title", widget: "string" }
- { label: "Country", name: "description", widget: "string" }
- { label: "Featured Image", name: "image", widget: "image" }
- {
label: "Category",
name: "category",
widget: "select",
required: true,
options: [
{ value: "breakfast", label: "Breakfast" },
{ value: "sandwich", label: "Sandwich" },
{ value: "sides", label: "Sides" },
{ value: "entrees", label: "Entrees" },
{ value: "desserts", label: "Desserts" },
],
}
- {
label: "Recipe",
name: "recipe",
widget: "markdown",
default: "## Ingredients\n\n- First\n\n## Instructions\n\n1. First",
}
- { label: "Body", name: "body", widget: "markdown" }
- {
label: "Author",
name: "author",
widget: "hidden",
default: "Janneke",
}
- { label: "Date", name: "date", widget: "datetime", default: "{{now}}" }

- name: "blog"
label: "Blog"
folder: "src/content/blog"
create: true
media_folder: "media"
public_folder: "media"
fields:
- { label: "Title", name: "title", widget: "string" }
- { label: "Description", name: "description", widget: "string" }
- {
label: "Author",
name: "author",
widget: "string",
default: "Janneke",
}
- { label: "Date", name: "date", widget: "datetime" }
- { label: "Featured Image", name: "image", widget: "image" }
- { label: "Image Alt Text", name: "imageAlt", widget: "string" }
- { label: "Body", name: "body", widget: "markdown" }
```

**Additional context**

https://github.com/user-attachments/assets/03e9c05a-6ae5-456b-b537-d8bcd17eb7ea

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.