diff --git a/dist/ReactGraph.js b/dist/ReactGraph.js index c02dc118..aefd01ab 100644 --- a/dist/ReactGraph.js +++ b/dist/ReactGraph.js @@ -33810,7 +33810,7 @@ var isFunction = function isFunction(obj) { return !!(obj && obj.constructor && obj.call && obj.apply); }; - var isInputNode = function isInputNode(e) { + var inInputDOMNode = function inInputDOMNode(e) { return e && e.target && ['INPUT', 'SELECT', 'TEXTAREA'].includes(e.target.nodeName); }; var getDimensions = function getDimensions() { @@ -33831,7 +33831,7 @@ var key = _ref.key, target = _ref.target; - if (key === targetKey && !isInputNode(target)) { + if (key === targetKey && !inInputDOMNode(target)) { setKeyPressed(true); } } @@ -33840,7 +33840,7 @@ var key = _ref2.key, target = _ref2.target; - if (key === targetKey && !isInputNode(target)) { + if (key === targetKey && !inInputDOMNode(target)) { setKeyPressed(false); } }; @@ -34235,7 +34235,7 @@ position = _ref.position, transform = _ref.transform; - if (isInputNode(evt) || isHandle(evt)) { + if (inInputDOMNode(evt) || isHandle(evt)) { return false; } @@ -34528,7 +34528,7 @@ }); var onEdgeClick = function onEdgeClick(evt) { - if (isInputNode(evt)) { + if (inInputDOMNode(evt)) { return false; } diff --git a/src/components/Edges/wrapEdge.js b/src/components/Edges/wrapEdge.js index 2fa84b13..c5190258 100644 --- a/src/components/Edges/wrapEdge.js +++ b/src/components/Edges/wrapEdge.js @@ -1,7 +1,7 @@ import React, { memo } from 'react'; import cx from 'classnames'; -import { isInputNode } from '../../utils'; +import { inInputDOMNode } from '../../utils'; import store from '../../store'; export default EdgeComponent => { @@ -12,7 +12,7 @@ export default EdgeComponent => { } = props; const edgeClasses = cx('react-flow__edge', { selected, animated }); const onEdgeClick = (evt) => { - if (isInputNode(evt)) { + if (inInputDOMNode(evt)) { return false; } diff --git a/src/components/Nodes/wrapNode.js b/src/components/Nodes/wrapNode.js index 68bd30dd..0d6bc16f 100644 --- a/src/components/Nodes/wrapNode.js +++ b/src/components/Nodes/wrapNode.js @@ -2,7 +2,7 @@ import React, { useEffect, useRef, useState, memo } from 'react'; import ReactDraggable from 'react-draggable'; import cx from 'classnames'; -import { getDimensions, isInputNode } from '../../utils'; +import { getDimensions, inInputDOMNode } from '../../utils'; import { Provider } from '../../contexts/NodeIdContext'; import store from '../../store'; @@ -45,7 +45,7 @@ const getHandleBounds = (sel, nodeElement, parentBounds, k) => { }; const onStart = (evt, { setOffset, onClick, id, type, data, position, transform }) => { - if (isInputNode(evt) || isHandle(evt)) { + if (inInputDOMNode(evt) || isHandle(evt)) { return false; } diff --git a/src/hooks/useKeyPress.js b/src/hooks/useKeyPress.js index 442a2d52..c219979d 100644 --- a/src/hooks/useKeyPress.js +++ b/src/hooks/useKeyPress.js @@ -1,18 +1,18 @@ import { useState, useEffect } from 'react'; -import { isInputNode } from '../utils'; +import { inInputDOMNode } from '../utils'; export default function useKeyPress(keyCode) { const [keyPressed, setKeyPressed] = useState(false); function downHandler(evt) { - if (evt.keyCode === keyCode && !isInputNode(evt.target)) { + if (evt.keyCode === keyCode && !inInputDOMNode(evt.target)) { setKeyPressed(true); } } const upHandler = (evt) => { - if (evt.keyCode === keyCode && !isInputNode(evt.target)) { + if (evt.keyCode === keyCode && !inInputDOMNode(evt.target)) { setKeyPressed(false); } }; diff --git a/src/utils/index.js b/src/utils/index.js index 8af8fccd..db8f54ec 100644 --- a/src/utils/index.js +++ b/src/utils/index.js @@ -1,6 +1,6 @@ export const isFunction = obj => !!(obj && obj.constructor && obj.call && obj.apply); -export const isInputNode = e => e && e.target && ['INPUT', 'SELECT', 'TEXTAREA'].includes(e.target.nodeName); +export const inInputDOMNode = e => e && e.target && ['INPUT', 'SELECT', 'TEXTAREA'].includes(e.target.nodeName); export const getDimensions = (node = {}) => ({ width: node.offsetWidth,