bustle/mobiledoc-kit

range#expandByMarker will not expand to the beginning of the section

Closed this issue · 0 comments

If you have a range that you want to expand to include the full range of a markup, and that range extends to the beginning of the section, #expandByMarker will stop at the end of the range's head marker rather than all markers that match the detect callback.

The problem is occurring in this code because we look for "firstNotMatchingDetect" however we won't reach a non-matching detect because we reach the beginning of the section first. When there's no non-matching detect we revert to the default behaviour of using the marker that's under the range's head rather than the beginning of the section.

I ran into this issue in Ghost, here's a screenshot to help illustrate: