Identify if entire list_item node is in a selection

In order to better style lists, I am adding the functionality to add a style attribute to the list item is it’s entire text block is selected. this way if the entire list item is being set to a larger font, the bullet/number will also change to match the selected font.

I have it working if the selection is exactly the entire textnode, but I’m trying to now add the functionality to check if the selection includes a full list item and also some other text to break it up and handle each section differently.

i.e. if I have the below text and I select the the full Hello world bullet point and just the text “Hello” after and set the font to 16, I want the list item to be assigned an attribute font-size = 16px and then “Hello” should get a mark applied.

  • foobar
  • Helloworld

Hello world again!

I’m not sure how best to break the selection up into its high level nodes…