Re: [editing-explainer] Can we use textnodes, and block/inline nodes as shadow roots for transparent IME handling? (#57)

Ok, I see. So basically it would:

1. Split text node
2. Insert caret element
3. Insert characters via whatever mechanism into shadow DOM of caret element
4. remove caret element, merge text nodes back together
5. Fire an intention event that the user wants to insert one or several characters into the place where the caret element was.
6. Event is handled by JS (which likely inserts the characters as proposed).

Right now at least, that sounds like not a bad idea to me.

Some possible issues of the top of my head:

1. What happens if the user wants to type in a place where there was no text node before? Will the text node first be inserted at 6? So if at 6 the JS decides not to insert it, there won't be any text node either afterward?

2. What happens if the user types at the start of a text node that has a previous sibling text node but the JS decides not to insert the characters anyway. Will the previous sibling text nodes now suddenly be joined together (under 4)?

3. What happens if one wants to make a snapshot of the current HTML and save that to disc or send to another collaborative user while the user is typing? I guess it will contain the <canvas/>-element, right? One can of course filter that out, but can one know whether or not to the two text nodes on either side should be merged together or not?

---
Reply to this email directly or view it on GitHub:
https://github.com/w3c/editing-explainer/issues/57#issuecomment-106163899

Received on Thursday, 28 May 2015 03:56:23 UTC