medium-editor
medium-editor copied to clipboard
First and last space of contenteditable nodes turn into
Description
If a contenteditable is split up into several nodes (e. g. by formatting) and one either deletes the last whitespace of a preceding or the first whitespace of a succeeding node and enters a whitespce again, this whitespace will be a non-breaking space.
Steps to reproduce
- Have several text nodes within a contenteditable
- Delete a leading or trailing whitespace
- Reenter a whitespace
Expected behavior: I expect no
when entering a simple whitespace. I only expect a non-breaking space when I specifically enter it (e. g. SHIFT + SPACE).
Actual behavior: Non-breaking spaces occur and are hard to tell for an author, without inspecting the website.
Link to an example: https://jsfiddle.net/spacemonk3y/406j52d7/
I built a simple example. Just delete the whitespce in front of the bold "foobar" and enter it again. I'll see a non-breaking space when inspecting with web developer tools.
To see it happen also after "foobar", just add a second whitespace before "was" and delete it again. You'll see a
now...
Versions
- medium-editor: none, since it's a contenteditable / browser problem
- browser: Chrome 51
- OS: Mac OS El Capitan 10.11.5
@sPaCeMoNk3yIam so this appears to be a chrome-only issue as I wasn't able to get this to reproduce in firefox, safari, or IE11.
This is odd behavior indeed, if you keep adding spaces in it alternates between
and actual " "
characters after each press of the spacebar.
To make these steps even more interesting, the location where the space is added is actually different from browser to browser. Chrome, Safari, and IE11 add the spaces within the <b>
tag, Firefox adds the spaces to the text node after the <b>
tag.
This fix for this could just be as simple as look for
elements within the whole editor, or within the currently edited element, and replace them with spaces.
wouldn't say that this is a 'solution' as
's could be important to the author to keep...
This is a Chrome bug. Seems like someone thinks its been solved even though I'm still seeing it on my up-to-date chrome.
https://bugs.chromium.org/p/chromium/issues/detail?id=310149
http://dev.ckeditor.com/ticket/11415 https://core.trac.wordpress.org/ticket/31157
Yes, it is still happening. What the hay? I just want to format with tabs or spacebar. I do not want ANY actual whitespace.
Am I supposed to edit files only by downloading them and using my text editor and then uploading them again? It's not a problem - I am comfortable with FTP. But I need to know if I am just doing something wrong.
Same issue here
Same issue here