Re: [w3c/editing] Contenteditable re-creating deleted children when it shouldn't (Issue #468)

Well, I think that the solution is reasonable. However, I'm not sure whether it's reasonable to delete the empty inline elements at a caret move if there is no surrounding text. E.g., in an empty paragraph or around `<img>`. When I was implementing `contenteditable=plaintext-only`, I see browsers try to keep the style at inserting text as far as possible. I think that this is reasonable because web apps cannot change the text style with `execCommand`. So, once inline elements are lost, web apps cannot restore the style without modifying the DOM (i.e., they need to give up to use undo transactions of browsers). Therefore, I guess that it's better to keep inline elements when there is no surrounding text. For example:
```html
<p><b>{}</b><img></p>
```
```html
<p><img><b>{}</b></p>
```
```html
<p><b>{}<br></b></p>
```
etc.

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

Message ID: <w3c/editing/issues/468/2421493093@github.com>

Received on Friday, 18 October 2024 05:56:19 UTC