Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function onSelect(event, change) {
const selection = findRange(window.getSelection(), change.value);
const selectionIsAtEndOfInline = change.value.focusInline &&
selection.focusOffset === change.value.focusInline.text.length;
if (
change.value.isCollapsed &&
selectionIsAtEndOfInline
) { return change; }
return null;
}