Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export const fireEventAtPosition = ({
view,
event,
options = Object.create(null),
position = view.state.selection.anchor,
}: FireEventAtPositionParams) => {
const element = findElementAtPosition(position, view);
const syntheticEvents = createEvents(event, options);
syntheticEvents.forEach(syntheticEvent => fireEvent(element, syntheticEvent));
if (
event === ('tripleClick' as any) &&
!view.someProp('handleTripleClick', f => f(view, position, syntheticEvents[2]))
) {
syntheticEvents.forEach(syntheticEvent => view.dispatchEvent(syntheticEvent));
}
if (
event === 'dblClick' &&
!view.someProp('handleDoubleClick', f => f(view, position, syntheticEvents[0]))
) {
syntheticEvents.forEach(syntheticEvent => view.dispatchEvent(syntheticEvent));
}