ianstormtaylor / slate

A completely customizable framework for building rich text editors. (Currently in beta.)
http://slatejs.org
MIT License
29.97k stars 3.25k forks source link

Copy-pasting text with an inline void from Slate to other editors is not working as expected. #4802

Open laufeyrut opened 2 years ago

laufeyrut commented 2 years ago

Description Copy-pasting text with an inline void from Slate to other editors is not working as expected.

Recording https://user-images.githubusercontent.com/15036127/150869415-33422c13-2666-4e58-9104-2464474b7107.mov

Steps To reproduce the behavior:

  1. Go to https://www.slatejs.org/examples/mentions
  2. Copy the text from the example
  3. Paste the text to some editor. Like Google Docs or notes.
  4. There is a new line after each inline element
Screenshot 2022-01-24 at 20 53 56 Screenshot 2022-01-24 at 20 53 30

Expectation That and new line is not added after inline elements

Screenshot 2022-01-24 at 21 10 57

Environment

jackmiller2708 commented 2 years ago

@laufeyrut I agree. As of right now, Slate is using the zero width no-break space (U+FEFF), which is deprecated. They should switch up the default to word joiner (U+2060) to represent void characters instead.

yume-chan commented 1 year ago

Using U+2060 won't fix the issue in Google Docs. It's caused by this position: absolute style:

https://github.com/ianstormtaylor/slate/blob/55b9574097f6008bda7ed8e3cb7aa9dd607d9f49/packages/slate-react/src/components/element.tsx#L111-L127

yume-chan commented 1 year ago

Use U+2060: #2597, use <br>: #1971