mirror of
https://github.com/codex-team/editor.js
synced 2026-03-17 16:10:07 +01:00
event before clear section added
This commit is contained in:
parent
d29dfbd4cf
commit
49fe61cf89
1 changed files with 11 additions and 1 deletions
|
|
@ -225,7 +225,7 @@ export default class BlockSelection extends Module {
|
|||
* @param {boolean} restoreSelection - if true, restore saved selection
|
||||
*/
|
||||
public clearSelection(reason?: Event, restoreSelection = false): void {
|
||||
const { BlockManager, Caret, RectangleSelection } = this.Editor;
|
||||
const { BlockManager, Caret, RectangleSelection, Toolbar } = this.Editor;
|
||||
|
||||
this.needToSelectAll = false;
|
||||
this.nativeInputSelected = false;
|
||||
|
|
@ -234,6 +234,16 @@ export default class BlockSelection extends Module {
|
|||
const isKeyboard = reason && (reason instanceof KeyboardEvent);
|
||||
const isPrintableKey = isKeyboard && _.isPrintableKey((reason as KeyboardEvent).keyCode);
|
||||
|
||||
/**
|
||||
* Don't clear the selection during multiple element dragging.
|
||||
*/
|
||||
const isMouse = reason && (reason instanceof MouseEvent);
|
||||
const isClickedOnSettingsToggler = isMouse && Toolbar.nodes.settingsToggler.contains(reason.target as HTMLElement);
|
||||
|
||||
if (isMouse && isClickedOnSettingsToggler) {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* If reason caused clear of the selection was printable key and any block is selected,
|
||||
* remove selected blocks and insert pressed key
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue