[whatwg] Handling of collapsed whitespace in contenteditable
Markus Ernst
derernst at gmx.ch
Tue Jun 21 00:24:11 PDT 2011
Am 21.06.2011 02:16 schrieb Ojan Vafai:
> It is certainly the case that some large subset of users use spaces to align
> content, not to mention really care about things like two spaces after
> periods, etc. One way or another, contentEditable needs to support this.
>
> If we were starting with a clean slate, the editing behavior we want is
> likely whitespace:pre-wrap + some logic about what to do when you put extra
> spaces at the end of a line*. We should make sure the pre-wrap editing works
> as well as possible (e.g. doesn't do any of these NBSP shenanigans), but we
> have to support non-pre-wrap even if it's not the default. So, one way or
> another, we need to spec this behavior.
I agree. I personnally would appreciate a "use NBSPs for consecutive
spaces" setting that can be turned on or off. For BC reasons it will
have to be on by default.
An author who is aware of this and able to turn this setting off, will
also be aware of the possibility to apply white-space:pre-wrap to the
contenteditable element. Therefore I suggest to leave this up to the
author. It does not look consistent to me to apply different default
values for the white-space property based on the "contenteditableness"
of an element.
(At least, I would find it easier to answer the question "Why do my
spaces disappear while typing?" than the question "Why does my content
look different though I use the same CSS for the editor and the target
page of the edited text?".)
More information about the whatwg
mailing list