From d2d18f806152052b6e291483184f3e956ba88bbb Mon Sep 17 00:00:00 2001 From: George Berezhnoy Date: Wed, 21 Jul 2021 22:12:13 +0300 Subject: [PATCH] Fix jump on CBS (#1732) * Fix jump on CBS * Fix lint --- docs/CHANGELOG.md | 1 + src/components/modules/ui.ts | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 7d33342e..4396c901 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -7,6 +7,7 @@ - `Fix` *Tunes API* - Tune config now passed to constructor under `config` property - `Fix` *Types* - Add common type for internal and external Tools configuration - `Fix` — Block's destroy method is called on block deletion +- `Fix` - Fix jump to the button of editor zone on CBS ### 2.22.1 diff --git a/src/components/modules/ui.ts b/src/components/modules/ui.ts index c6b7e245..c697e47a 100644 --- a/src/components/modules/ui.ts +++ b/src/components/modules/ui.ts @@ -662,6 +662,8 @@ export default class UI extends Module { * - otherwise, add a new empty Block and set a Caret to that */ private redactorClicked(event: MouseEvent): void { + const { BlockSelection } = this.Editor; + if (!Selection.isCollapsed) { return; } @@ -689,7 +691,12 @@ export default class UI extends Module { return; } - const isClickedBottom = event.target instanceof Element && event.target.isEqualNode(this.nodes.redactor); + const isClickedBottom = event.target instanceof Element && + event.target.isEqualNode(this.nodes.redactor) && + /** + * If there is cross block selection started, target will be equal to redactor so we need additional check + */ + !BlockSelection.anyBlockSelected; if (isClickedBottom) { stopPropagation();