Re: Only Text Input and Intention Events

>
>
> Example 2
>
> - Before insert:
> anchorNode = <p><i>Sample </i><b>text</b></p> (element)
> anchorOffset = 1 (<b>text</b>)
> - Insert ‘X’
> - After insert:
> anchorNode = <p><i>Sample </i>X<b>text</b></p> (element)
> anchorOffset = 2 (<b>text</b>)
>
> So, there is no “if” here… the same approach is taken for both text nodes
> and elements.
>
> Ofc, the browser will have to inject a new text node if necessary.
>

Yes that's very reasonable.


> - Editor devs can control where text can go. If you don't want user to add
> text between a <table> and a <p>, you can prevent that by not putting any
> text nodes there.
>
> Having to do this through injection of text nodes would be plain hacky.
> Instead, this should be as simple as preventing the insertion intention.
>

Ah yes, I had forgotten we can easily just stop the intent (or change the
selection) if we don't like what it's going to do. So it's much easier this
way.

Received on Thursday, 27 November 2014 18:55:56 UTC