Re: [w3c/editing] Define behavior of pressing enter in inline editing host (Issue #430)

I guess that these steps may roughly match with existing `insertParagraph` command behavior of the browsers:
1. Let _inclusive ancestor block_ be null
2. Let _container_ be focus node of selection (after deleting selected content)
3. If _container_ can not have the new default paragraph as a child
 3-1. If _container_ creates a context, e.g., `<caption>`, `<body>`, etc, break this loop
 3-2. If parent node of _container_ is not editable, clear _container_ and break this loop
 3-3. If parent node of _container_ is a `<div>`, `<p>`, `<hn>`, `<li>`, `<dt>` or `<dd>`, break this loop
 3-4. Set _container_ to the parent, then back to the step 3
5. If _container_ is not set, fallback to `insertLineBreak` and return
6. If _container_ is an element creating a context (i.e., broken the loop at 3-1), put the default paragraph in it or insert a line break instead if it cannot have the new paragraph, then, return
7. Duplicate _container_ and put the clone after it (and delete unnecessary content)

-- 
Reply to this email directly or view it on GitHub:
https://github.com/w3c/editing/issues/430#issuecomment-1556329958
You are receiving this because you are subscribed to this thread.

Message ID: <w3c/editing/issues/430/1556329958@github.com>

Received on Sunday, 21 May 2023 23:43:18 UTC