Open
Description
Stacktrace:
Uncaught (in promise) IndexSizeError: Failed to execute 'setStart' on 'Range': The offset 28 is larger than the node's length (27).
at #createCloneRange
at InputRange.getBoundingClientRect
at TextExpander.positionMenu
at TextExpander.activate
at TextExpander.onInput
It seems that 2 bugs are related:
- when
provide
a promise, afterawait Promise.all(providers)
, the textarea's content might have changed.
But activate
and positionMenu
still use old (outdated) match
, then the position
in const caretRect = new InputRange(this.input, position).getBoundingClientRect();
is invalid.
- the
query
will return incorrect position for "multiword" when the last "key" is removed.
To reproduce:
<text-expander multiword="#">...</>
provide(async () => {
await sleep(Math.random() * 1000);
return {matched: true .....};
});
Then use the textarea value:
close #20
close #20
close #20
And delete the chars in the last line from the end, when the #
in the last line is deleted, the JS error occurs. It's quite strange that it must have 3 lines to reproduce the bug.
Metadata
Metadata
Assignees
Labels
No labels