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

Changed: clean   inserted by browser. #50

Merged
merged 9 commits into from
Oct 12, 2016
Merged

Changed: clean   inserted by browser. #50

merged 9 commits into from
Oct 12, 2016

Conversation

scofalik
Copy link
Contributor

@scofalik scofalik commented Sep 30, 2016

@scofalik
Copy link
Contributor Author

scofalik commented Sep 30, 2016

Changing all  s from mutated text node may be "too much" (too naive) and it might be incorrect when we introduce "nonbreakable space" feature. Maybe we need more complicated algorithm there, but for now it worked.

// take `newText` and compare it to (cleaned up) view.
// It could also be done in mutation observer too, however if any outside plugin would like to
// introduce additional events for mutations, they would get already cleaned up version (this may be good or not).
mutation.newText = mutation.newText.replace( /\u00A0/g, ' ' );
Copy link
Member

Choose a reason for hiding this comment

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

You shouldn't modify a property of an object because there can be other listeners interested in this value.

@Reinmar
Copy link
Member

Reinmar commented Oct 6, 2016

BTW, you can also create a manual test, similar to the existing typing manual tests, where editor model will be logged every few seconds and \u00a0 will be replaced there with some visible character (@ e.g.). The goal will be to see that nbsp never appears in the model regardless of how you use editor.setData() or what you type.

@scofalik
Copy link
Contributor Author

scofalik commented Oct 10, 2016

I forgot to mention that there is a related PR ckeditor/ckeditor5-engine#620

@scofalik
Copy link
Contributor Author

I added a test as suggested by @Reinmar

@Reinmar
Copy link
Member

Reinmar commented Oct 12, 2016

While testing this I found just one bug – https://github.com/ckeditor/ckeditor5-typing/issues/52, but it turned out that it's unrelated to this changes. Most likely, it's a FF bug.

Awesome work, @scofalik!

@Reinmar Reinmar merged commit 8d50545 into master Oct 12, 2016
@Reinmar Reinmar deleted the t/49 branch October 12, 2016 10:13
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.

Handle   inserted by browser instead of spaces.
2 participants