Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
handleDragOverOtherNode = event => {
if (!this.state.isDragging) {
return
}
const targetDOMNode = event.target
// As the event is registered on the editor parent node
// ignore the event if it is coming from from the editor node itself
if (targetDOMNode === this._editorNode) {
return
}
const offsetKey = OffsetKey.findKey(targetDOMNode, 0)
if (!offsetKey) {
return
}
const {key} = offsetKey
const {editor} = this.props
const state = editor.getState()
const {document} = state
const range = createRange(event)
if (range === null) {
return
}
const {rangeIsAtStart, rangeOffset} = range
handleDragOverOtherNode = event => {
if (!this.state.isDragging) {
return
}
const targetDOMNode = event.target
// As the event is registered on the editor parent node
// ignore the event if it is coming from from the editor node itself
if (targetDOMNode === this._editorNode) {
this._dropTarget = null
return
}
const offsetKey = OffsetKey.findKey(targetDOMNode, 0)
if (!offsetKey) {
return
}
const {key} = offsetKey
// If this is 'our' node, return
if (this.props.node.hasDescendant(key)) {
return
}
const {editor} = this.props
const state = editor.getState()
const {document} = state
const range = createRange(event)