Why
is inserted instead of the white-space after inserting the second space in the row between two words or numbers, e.g. 1 2
. When I click on the HTML button I see 1 2
. I think it is correct behavior but I don't understand does this happen because of the browser or there's any flag in the code which turn it on? I didn't find any documentation for the redactor-js.
Please find the source code by link https://github.com/html5cat/redactor-js
Please find the redactor (a new version) by link https://imperavi.com/redactor/
Steps to reproduce:
- open the link https://imperavi.com/redactor/
- clear the redactor
- write
1 2
(two spaces between) - click on the HTML button
- check that there's
1 2
instead of1 2
Its because in html when you have multiple spaces the browser will strip them out.
The &nsbp; is a html entity called a non-breaking space that allows programmers to over come this intended functionality.
https://www.w3schools.com/html/html_entities.asp
In this instance as its a WYSIWYG, it will replace multiple [space]'s with the html entity so that it displays as the user intends.
Specifically in this instance its handled by the browser and the "contenteditable" attribute.
https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Editable_content