import { EditorView } from 'prosemirror-view'; import { Transaction } from 'prosemirror-state'; import { closestElement } from '../../utils/dom'; import { setSelectionTopLevelBlocks, hasGapCursorPlugin, } from '../../plugins/selection/gap-cursor-selection'; import { addParagraphAtEnd } from '../../commands'; // we ignore all of the clicks made inside
(but not clicks on the node itself) const insideContentArea = (ref: HTMLElement | null): boolean => { while (ref) { if (ref.classList && ref.classList.contains('ak-editor-content-area')) { return true; } ref = ref.parentNode as HTMLElement; } return false; }; const clickAreaClickHandler = ( view: EditorView, event: React.MouseEvent, ) => { const contentArea = event.currentTarget.querySelector( '.ak-editor-content-area', ); const editorFocused = !!(view && view.hasFocus()); const target = event.target as HTMLElement; // @see https://product-fabric.atlassian.net/browse/ED-4287 // click event gets triggered twice on a checkbox (on