Skip to content
This repository has been archived by the owner on Jun 26, 2020. It is now read-only.

[Chrome] Handle pasted whitespaces #25

Merged
merged 2 commits into from
Jul 7, 2017
Merged

[Chrome] Handle pasted whitespaces #25

merged 2 commits into from
Jul 7, 2017

Conversation

Reinmar
Copy link
Member

@Reinmar Reinmar commented Jul 3, 2017

Suggested merge commit message (convention)

Fix: Whitespaces around inline elements will not be lost upon pasting. Closes ckeditor/ckeditor5#2662.

@Reinmar Reinmar requested a review from szymonkups July 3, 2017 16:39
@Reinmar Reinmar requested a review from scofalik July 7, 2017 11:08
@@ -17,4 +17,44 @@ describe( 'normalizeClipboardData', () => {
normalizeClipboardData( '<span class="Apple-converted-space"> </span>x<span class="Apple-converted-space">\u00a0</span>' )
).to.equal( ' x ' );
} );

it( 'should strip all spans with no attributes', () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was wondering whether this is cleanup should be really done.

On one hand the data is correct and, hypothetically, there could be a plugin that creates empty spans and want them retained when copied from editor to editor.

On the other hand, in 99.9% of cases empty span is just a garbage because spans are used mostly to hold formatting. Also a feature that creates just an empty span is probably a bad practice and something that may blow up :).

So I think this is fine.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right. The entire #2 is about this. We may lose some data. But, at least for now, it's more important to keep the content clean from non-breaking spaces. Then, we can somehow support copy-pasting them within the editor (they'd need to be marked in a special way when stringified to HTML). And we'll never be able to handle copy-pasting them from outside of the editor because, by converting many normal spaces to non-breaking ones, Chrome loses that data.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And as for features which want to produce empty spans with no classes/attributes (cause that's what cleaned here), they will simply be incorrect. Just like you mentioned – they'd be treated as a garbage.

@scofalik scofalik merged commit 5888743 into master Jul 7, 2017
@scofalik scofalik deleted the t/24 branch July 7, 2017 12:30
@scofalik scofalik modified the milestone: iteration 11 Jul 7, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Chrome] Handle spaces outside inline styles when pasting
2 participants