MCPcopy Index your code
hub / github.com/codex-team/editor.js / redactorClicked

Method redactorClicked

src/components/modules/ui.ts:765–791  ·  view source on GitHub ↗

* All clicks on the redactor zone * * @param {MouseEvent} event - click event * @description * - By clicks on the Editor's bottom zone: * - if last Block is empty, set a Caret to this * - otherwise, add a new empty Block and set a Caret to that

(event: MouseEvent)

Source from the content-addressed store, hash-verified

763 * - otherwise, add a new empty Block and set a Caret to that
764 */
765 private redactorClicked(event: MouseEvent): void {
766 if (!Selection.isCollapsed) {
767 return;
768 }
769
770 /**
771 * case when user clicks on anchor element
772 * if it is clicked via ctrl key, then we open new window with url
773 */
774 const element = event.target as Element;
775 const ctrlKey = event.metaKey || event.ctrlKey;
776 const anchor = $.getClosestAnchor(element);
777
778 if (anchor && ctrlKey) {
779 event.stopImmediatePropagation();
780 event.stopPropagation();
781
782 const href = anchor.getAttribute('href');
783 const validUrl = _.getValidUrl(href);
784
785 _.openTab(validUrl);
786
787 return;
788 }
789
790 this.processBottomZoneClick(event);
791 }
792
793 /**
794 * Check if user clicks on the Editor's bottom zone:

Callers 1

Calls 2

getClosestAnchorMethod · 0.80

Tested by

no test coverage detected