* 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)
| 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: |
no test coverage detected