How can I get the text style from window.selection()?
I'm trying to get the css style of the text selection when user select only 1 row.
This is my code which works for multiple lines selection case:
var selectedDivs = window.selection().getRangeAt(0).cloneContent().children // Then I can get css style from selectedDivs
But for single line selection, the
selectedDivs is always
. How can I get the css style in this case? I've tried startContainer & endContainer of range but it didn't work.
parentNode of the
startContainer should give you what you need.