If using logging or debugging within a keydown event while using scribe, the selection object does not appear to maintain its state correctly. This is not a major issue, but confusing none the less.
To reproduce the issue, add an event listener for the scribe event in a plugin (e.g.):
scribe.el.addEventListener('keydown', function(evt) {
var lastSelection = new scribe.api.Selection();
console.log(lastSelection.range.collapsed);
console.log(lastSelection.range);
});
Now, select a block of text within the same span (1 or more characters) and type any key that modifies the state (i.e. forces an input event to fire.) Note that the output should looks something like:
false <---- this is lastSelection.range.collapsed, which is correct
{
collapsed: true <----- Wait what???
commonAncestorContainer: text
endContainer: text
endOffset: 6
startContainer: text
startOffset: 6
...
}
If using logging or debugging within a keydown event while using scribe, the selection object does not appear to maintain its state correctly. This is not a major issue, but confusing none the less.
To reproduce the issue, add an event listener for the scribe event in a plugin (e.g.):
Now, select a block of text within the same span (1 or more characters) and type any key that modifies the state (i.e. forces an input event to fire.) Note that the output should looks something like:
false
<---- this is lastSelection.range.collapsed, which is correct