Skip to content

Commit 52814ce

Browse files
author
Vinogradov Victor
committed
Merge branch 'master' into mouse
# Conflicts: # dist/editor.js # docs/CHANGELOG.md # package.json
2 parents c88e6e9 + 2035cb3 commit 52814ce

File tree

6 files changed

+61
-21
lines changed

6 files changed

+61
-21
lines changed

README.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
<p align="center"><img src="https://capella.pics/3c0b525b-50d9-4720-8aad-9148114cfa6e.jpg"></p>
1+
<p align="center"><img src="https://capella.pics/79ce946a-d636-41cd-aa96-d3bc5ecfde03.jpg"></p>
22

33
[![](https://flat.badgen.net/npm/v/@editorjs/editorjs?icon=npm)](https://www.npmjs.com/package/@editorjs/editorjs)
44
[![](https://flat.badgen.net/bundlephobia/min/@editorjs/editorjs?color=cyan)](https://www.npmjs.com/package/@editorjs/editorjs)
55
[![](https://flat.badgen.net/bundlephobia/minzip/@editorjs/editorjs?color=green)](https://www.npmjs.com/package/@editorjs/editorjs)
66
[![](https://flat.badgen.net/npm/license/@editorjs/editorjs)](https://www.npmjs.com/package/@editorjs/editorjs)
77

8-
## Version 2.0-beta is here!
8+
## Version 2.0 is here!
99

1010
We are glad to introduce the next version of Editor.js. Totally new core, structure and plugins — that was an impressive adventure 🤓.
1111

@@ -19,6 +19,8 @@ Welcome to testing stage. Please, join a [public Telegram-chat](//t.me/codex_edi
1919

2020
### 2.7-2.9 changelog
2121

22+
- `Fix` - Clear focus when click is outside the Editor instance
23+
- `Fix` — Fix CMD+A Selection on multiple Editor instances
2224
- `New` — Toolbox now have beautiful helpers with Tool names and shortcuts
2325
- `Improvements` — Prevent navigating back on Firefox when Block is removing by backspace
2426
- `New` — Blocks selected with Rectangle Selection can be also removed, copied or cut
@@ -259,4 +261,12 @@ Take a look at the [example.html](example/example.html) to view more detailed ex
259261

260262
- We use [HTMLJanitor](https://github.com/guardian/html-janitor) module in our Sanitizer module.
261263

264+
# About team
262265

266+
We are CodeX and we build products for developers and makers.
267+
268+
Follow us on Twitter: [twitter.com/codex_team](https://twitter.com/codex_team)
269+
270+
Feel free to contact: <a href="mailto:team@codex.so?subject=Editor.js feedback">team@codex.so</a>
271+
272+
[codex.so](https://codex.so)

dist/editor.js

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/CHANGELOG.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,19 @@
11
# Changelog
2+
### 2.11.5
3+
4+
- `Fix` *RectangeSelection* — Redesign of the scrolling zones
5+
6+
### 2.11.4
7+
8+
- `Fix` - Clear focus when click is outside the Editor instance
9+
10+
### 2.11.3
11+
12+
- `Fix` — Fix CMD+A Selection on multiple Editor instances
213

314
### 2.11.2
415

5-
- `Fix` *RectangeSelection* — Redesign of the scrolling zones
16+
- `Improvements` — Docs updated and common enhancements
617

718
### 2.11.1
819

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@editorjs/editorjs",
3-
"version": "2.11.2",
3+
"version": "2.11.5",
44
"description": "Editor.js — Native JS, based on API and Open Source",
55
"main": "dist/editor.js",
66
"types": "./types/index.d.ts",

src/components/modules/blockSelection.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,18 @@ export default class BlockSelection extends Module {
107107
Shortcuts.add({
108108
name: 'CMD+A',
109109
handler: (event) => {
110+
const {BlockManager} = this.Editor;
111+
/**
112+
* When one page consist of two or more EditorJS instances
113+
* Shortcut module tries to handle all events. Thats why Editor's selection works inside the target Editor, but for
114+
* others error occurs because nothing to select.
115+
*
116+
* Prevent such actions if focus is not inside the Editor
117+
*/
118+
if (!BlockManager.currentBlock) {
119+
return;
120+
}
121+
110122
this.handleCommandA(event);
111123
},
112124
});

src/components/modules/ui.ts

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ export default class UI extends Module {
190190
false,
191191
);
192192
this.Editor.Listeners.on(document, 'keydown', (event) => this.documentKeydown(event as KeyboardEvent), true);
193-
this.Editor.Listeners.on(document, 'click', (event) => this.documentClicked(event as MouseEvent), false);
193+
this.Editor.Listeners.on(document, 'click', (event) => this.documentClicked(event as MouseEvent), true);
194194
}
195195

196196
/**
@@ -328,24 +328,31 @@ export default class UI extends Module {
328328
*/
329329
const target = event.target as HTMLElement;
330330
const clickedOnInlineToolbarButton = target.closest(`.${this.Editor.InlineToolbar.CSS.inlineToolbar}`);
331-
const clickedInsideofEditor = target.closest(`.${UI.CSS.editorWrapper}`);
331+
const clickedInsideofEditor = target.closest(`#${this.config.holderId}`);
332332

333-
/** Clear highlightings and pointer on BlockManager */
334-
if (!clickedInsideofEditor && !Selection.isAtEditor) {
333+
if (!clickedInsideofEditor) {
334+
/**
335+
* Clear highlightings and pointer on BlockManager
336+
*
337+
* Current page might contain several instances
338+
* Click between instances MUST clear focus, pointers and close toolbars
339+
*/
335340
this.Editor.BlockManager.dropPointer();
341+
this.Editor.InlineToolbar.close();
336342
this.Editor.Toolbar.close();
337-
}
343+
this.Editor.BlockSelection.clearSelection();
338344

339-
if (!clickedOnInlineToolbarButton) {
345+
} else if (!clickedOnInlineToolbarButton) {
346+
/**
347+
* Move inline toolbar to the focused Block
348+
*/
340349
this.Editor.InlineToolbar.handleShowingEvent(event);
341-
}
342-
343-
if (Selection.isAtEditor) {
350+
} else if (Selection.isAtEditor) {
351+
/**
352+
* Focus clicked Block
353+
*/
344354
this.Editor.BlockManager.setCurrentBlockByChildNode(Selection.anchorNode);
345355
}
346-
347-
/** Clear selection */
348-
this.Editor.BlockSelection.clearSelection();
349356
}
350357

351358
/**

0 commit comments

Comments
 (0)