Use selection.rangeCount  in src/tools/selection.js