@draft-js-plugins/drag-n-drop-upload
Advanced tools
Comparing version 4.2.2 to 4.2.3
@@ -67,10 +67,12 @@ 'use strict'; | ||
var newEditorState = draftJs.AtomicBlockUtils.insertAtomicBlock(editorState, entityKey, ' '); | ||
var insertedAtomicBlock = newEditorState.getCurrentContent().getBlockBefore(newEditorState.getSelection().getAnchorKey()); | ||
if (insertedAtomicBlock === undefined) { | ||
throw new Error('Unable to locate the block-key of inserted-atomic-block.'); | ||
} | ||
var stateSelected = draftJs.EditorState.forceSelection(newEditorState, newEditorState.getCurrentContent().getSelectionAfter()); | ||
var blockArrayMap = newEditorState.getCurrentContent().getBlocksAsArray().map(function (b) { | ||
return b.getKey(); | ||
}); | ||
var nextToLastBlock = newEditorState.getCurrentContent().getBlockForKey(blockArrayMap[blockArrayMap.length - 2]); | ||
return { | ||
state: stateSelected, | ||
blockKey: nextToLastBlock.getKey(), | ||
blockKey: insertedAtomicBlock.getKey(), | ||
key: entityKey, | ||
@@ -77,0 +79,0 @@ text: text |
@@ -59,10 +59,12 @@ import React from 'react'; | ||
var newEditorState = AtomicBlockUtils.insertAtomicBlock(editorState, entityKey, ' '); | ||
var insertedAtomicBlock = newEditorState.getCurrentContent().getBlockBefore(newEditorState.getSelection().getAnchorKey()); | ||
if (insertedAtomicBlock === undefined) { | ||
throw new Error('Unable to locate the block-key of inserted-atomic-block.'); | ||
} | ||
var stateSelected = EditorState.forceSelection(newEditorState, newEditorState.getCurrentContent().getSelectionAfter()); | ||
var blockArrayMap = newEditorState.getCurrentContent().getBlocksAsArray().map(function (b) { | ||
return b.getKey(); | ||
}); | ||
var nextToLastBlock = newEditorState.getCurrentContent().getBlockForKey(blockArrayMap[blockArrayMap.length - 2]); | ||
return { | ||
state: stateSelected, | ||
blockKey: nextToLastBlock.getKey(), | ||
blockKey: insertedAtomicBlock.getKey(), | ||
key: entityKey, | ||
@@ -69,0 +71,0 @@ text: text |
{ | ||
"name": "@draft-js-plugins/drag-n-drop-upload", | ||
"version": "4.2.2", | ||
"version": "4.2.3", | ||
"sideEffects": [ | ||
@@ -5,0 +5,0 @@ "*.css" |
25124