Do you want to request a feature or report a bug?
Bug
What is the current behavior?
Terminology: “target range” is the range described by the arguments to hasEdgeWithin.
When a SelectionState is confined to a single block, hasEdgeWithin returns true when one edge is before the target range and the other edge is after the target range. (I.e., a special case of neither edge being within the target range.)
If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem.
https://runkit.com/andrewbranch/5aac76e3315c160012a07b84
const selection = SelectionState.createEmpty('a').merge({
anchorOffset: 0,
focusOffset: 20
});
// currently returns true, even though neither 0 nor 20 is between 5 and 10
selection.hasEdgeWithin('a', 5, 10);
What is the expected behavior?
hasEdgeWithin returns false for all cases where neither selection edge is within the target range.
Which versions of Draft.js, and which browser / OS are affected by this issue? Did this work in previous versions of Draft.js?
The hasEdgeWithin algorithm hasn’t changed since Draft JS was open sourced.