mirror of
https://github.com/codex-team/editor.js
synced 2026-03-15 15:15:47 +01:00
fix(drag-n-drop): prevent block selection on file drop (#2980)
Prevent block selection when dropping files. Resolves issue #2980.
This commit is contained in:
parent
90d6dec90e
commit
3d93eef905
1 changed files with 7 additions and 3 deletions
|
|
@ -92,14 +92,18 @@ export default class DragNDrop extends Module {
|
|||
const targetBlock = BlockManager.setCurrentBlockByChildNode(dropEvent.target as Node);
|
||||
|
||||
if (targetBlock) {
|
||||
this.Editor.Caret.setToBlock(targetBlock, Caret.positions.END);
|
||||
// this.Editor.Caret.setToBlock(targetBlock, Caret.positions.END);
|
||||
} else {
|
||||
const lastBlock = BlockManager.setCurrentBlockByChildNode(BlockManager.lastBlock.holder);
|
||||
// const lastBlock = BlockManager.setCurrentBlockByChildNode(BlockManager.lastBlock.holder);
|
||||
|
||||
this.Editor.Caret.setToBlock(lastBlock, Caret.positions.END);
|
||||
// this.Editor.Caret.setToBlock(lastBlock, Caret.positions.END);
|
||||
}
|
||||
|
||||
await Paste.processDataTransfer(dropEvent.dataTransfer, true);
|
||||
|
||||
_.delay(() => {
|
||||
this.Editor.BlockSelection.clearSelection();
|
||||
}, 50)();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue