Microsoft/monaco-editor

[Bug] Copy/pasting multiline content with key:value format in Safari loses line breaks

Open

#3 969 ouverte le 22 mai 2023

Voir sur GitHub
 (2 commentaires) (2 réactions) (0 assignés)JavaScript (1 283 forks)batch import
bugeditor-corehelp wanted

Métriques du dépôt

Stars
 (14 836 stars)
Métriques de merge PR
 (Merge moyen 6h 26m) (15 PRs mergées en 30 j)

Description

Reproducible in vscode.dev or in VS Code Desktop?

  • Not reproducible in vscode.dev or VS Code Desktop

Reproducible in the monaco editor playground?

Monaco Editor Playground Link

https://microsoft.github.io/monaco-editor/playground.html?source=v0.38.0#XQAAAAKiAQAAAAAAAABBqQkHQ5NjdMjwa-jY7SIQ9S7DNlzs5W-mwj0fe1ZCDRFc9ws9XQE0SJE1jc2VKxhaLFIw9vEWSxW3yscwzwauRgmSaumWUF-TBOsVJ4S4FwfCDQb5-2uUHXTVAefbVSd9IzaZ_vv9VR9KugsKioBUYGa0XsnArxmHPolFj8CfzECMW-192L1d0AxNn3frXdATDcOjBDBCfFOP9lxPkDGa94bLCQjig1WeZ-XvLSWLvYAoeBgnD9Y-1FkIZ4ZiDBKGGWqsmNGpBJpSH-BkEAWx_SluutEVJnITCjgHGAPrMlGP_KrBAt_DqFjnhfj3mYSAZ-bePmjIwVfhU3YEf8b4BH-liLT398A8AkESSXsvlH-B47fMM6Pd2k2ONI-s-gNELRvux_997GgA

Monaco Editor Playground Code

const value = /* set from `myEditor.getModel()`: */ `key: thing
otherkey: stuff
foo: bar

key : thing
otherkey : stuff
foo : bar

---
key: thing
otherkey: stuff
foo: bar

`;

// Hover on each property to see its docs!
const myEditor = monaco.editor.create(document.getElementById("container"), {
	value,
	language: "yaml",
	automaticLayout: true,
});

Reproduction Steps

In Safari on MacOS, select multiple lines of text which are of the format key: value, and then paste in a plain text setting, e.g. VSCode, TextEdit, etc. Observe that the text is pasted without line endings - i.e. all on one line.

Note: If pasting into a rich text setting such as Notes app or another Monaco Editor then line endings are correctly preserved.

Actual (Problematic) Behavior

Text is pasted without line breaks.

https://github.com/microsoft/monaco-editor/assets/1550045/404a2e30-595c-47a1-b492-a931526ae516

Expected Behavior

Text is pasted with line breaks in tact.

Additional Context

Safari: Version 16.4 (18615.1.26.110.1) MacOS: 13.3.1 (a)

Guide contributeur