Fix unstable block cut process (#1485)

* Fix unstable block cut process

* Update CHANGELOG

Co-authored-by: Peter Savchenko <specc.dev@gmail.com>
This commit is contained in:
Tomoyuki Hata 2021-02-19 00:51:03 +09:00 committed by GitHub
parent 21adb61bc9
commit 143a539e01
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 4 deletions

View file

@ -7,6 +7,7 @@
- `Improvements` - Remove bundles from the repo [#1541](https://github.com/codex-team/editor.js/pull/1541). - `Improvements` - Remove bundles from the repo [#1541](https://github.com/codex-team/editor.js/pull/1541).
- `Improvements` - Document will be scrolled when blocks are selected with `SHIFT+UP` or `SHIFT+DOWN` [#1447](https://github.com/codex-team/editor.js/issues/1447) - `Improvements` - Document will be scrolled when blocks are selected with `SHIFT+UP` or `SHIFT+DOWN` [#1447](https://github.com/codex-team/editor.js/issues/1447)
- `Fix` - Fix BlockManager.setCurrentBlockByChildNode() with multiple Editor.js instances [#1503](https://github.com/codex-team/editor.js/issues/1503). - `Fix` - Fix BlockManager.setCurrentBlockByChildNode() with multiple Editor.js instances [#1503](https://github.com/codex-team/editor.js/issues/1503).
- `Fix` - Fix an unstable block cut process [#1489](https://github.com/codex-team/editor.js/issues/1489).
- `Fix` - Type definition of the Sanitizer config: the sanitize function now contains param definition [#1491](https://github.com/codex-team/editor.js/pull/1491). - `Fix` - Type definition of the Sanitizer config: the sanitize function now contains param definition [#1491](https://github.com/codex-team/editor.js/pull/1491).
### 2.19.1 ### 2.19.1

View file

@ -167,7 +167,7 @@ export default class BlockEvents extends Module {
* *
* @param {ClipboardEvent} event - clipboard event * @param {ClipboardEvent} event - clipboard event
*/ */
public handleCommandC(event: ClipboardEvent): void { public handleCommandC(event: ClipboardEvent): Promise<void> {
const { BlockSelection } = this.Editor; const { BlockSelection } = this.Editor;
if (!BlockSelection.anyBlockSelected) { if (!BlockSelection.anyBlockSelected) {
@ -175,7 +175,7 @@ export default class BlockEvents extends Module {
} }
// Copy Selected Blocks // Copy Selected Blocks
BlockSelection.copySelectedBlocks(event); return BlockSelection.copySelectedBlocks(event);
} }
/** /**
@ -183,14 +183,14 @@ export default class BlockEvents extends Module {
* *
* @param {ClipboardEvent} event - clipboard event * @param {ClipboardEvent} event - clipboard event
*/ */
public handleCommandX(event: ClipboardEvent): void { public async handleCommandX(event: ClipboardEvent): Promise<void> {
const { BlockSelection, BlockManager, Caret } = this.Editor; const { BlockSelection, BlockManager, Caret } = this.Editor;
if (!BlockSelection.anyBlockSelected) { if (!BlockSelection.anyBlockSelected) {
return; return;
} }
BlockSelection.copySelectedBlocks(event); await BlockSelection.copySelectedBlocks(event);
const selectionPositionIndex = BlockManager.removeSelectedBlocks(); const selectionPositionIndex = BlockManager.removeSelectedBlocks();