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

Copying a selection starting with an empty block fails to preserve formatting on paste #1775

Closed bsouthga closed 6 years ago

bsouthga commented 6 years ago

Do you want to request a feature or report a bug?

It looks like there is a bug around copy / pasting lists (and possibly other blocks) when the selection starts with an empty block.

What's the current behavior?

When copying a selection starting with an empty block, the pasted result is unformatted plaintext. However, if the selection starts with a non-empty block, formatting is retained.

See gif below (reproduced in playground on slatejs.org):

copy

What's the expected behavior?

Formatting for subsequent non-empty blocks remains after pasting

jvdsande commented 6 years ago

Hi, I can confirm having this issue on all major browsers.

I actually made a PR fixing this issue a few days back: https://github.com/ianstormtaylor/slate/pull/1748

Regards, Jeremie

jvdsande commented 6 years ago

I should note that this affects more than lists: it's all blocks and all marks, as the slate-data-transfer attribute is not set at all, resulting in complete plain-text copy.

jvdsande commented 6 years ago

The 'data-slate-fragment' attribute, to be correct.

Nantris commented 6 years ago

This seems to be resolved, at least, the demo in this case using lists. Can anyone produce a demonstration of this issue for Slate 37?

bsouthga commented 6 years ago

I can't reproduce this in current slate, happy to close