Re: Pressing Enter in contenteditable: <p> or <br> or <div>?

On Wed, Jan 11, 2012 at 12:09 PM, Aryeh Gregor <ayg@aryeh.name> wrote:

> On Wed, Jan 11, 2012 at 12:38 PM, Ryosuke Niwa <rniwa@webkit.org> wrote:
> > That sounds like a great idea.
> >
> > . . .
> >
> > I'm not sure if we should add just "editoptions" though given we might
> need
> > to add more elaborative options in the future. It might make more sense
> to
> > add a new attribute per option as in:
> >
> > <div contentEditable paragraphSeparator="p" tabIndentation>
>
> Ojan suggested in the other thread that we instead allow calling
> execCommand() on Element, and have the result restricted to that
> Element.  That solves the global-flags problem too, and doesn't
> require new attributes.  So you'd do
>
>  div.execCommand("tabindent", false, "true");
>
> or whatever.  Someone could still call
> document.execCommand("tabindent", false, "false"), but that would be
> overridden if it was called on the editing host.  I filed a bug on it:
>
> https://www.w3.org/Bugs/Public/show_bug.cgi?id=15522
>
> Does that sound good too?
>

That sounds workable. Presumably it's only available on the editing host
(as supposed to any element or any element with contenteditable content
attribute).

> Should enter behave like shift+enter when br is the default
> > paragraph separator?
>
> Default paragraph separators are used in a couple of other places too,
> so it would be a little more work than that.  But I just looked, and
> it wouldn't be as bad as I thought.  So this is doable if people have
> any good use-cases.
>

Great.

- Ryosuke

Received on Thursday, 12 January 2012 00:06:56 UTC