refactor(onConnect): rename sourceId to source
This commit is contained in:
@@ -41463,15 +41463,16 @@ var _default = function _default(NodeComponent) {
|
|||||||
|
|
||||||
var onDrop = function onDrop(evt) {
|
var onDrop = function onDrop(evt) {
|
||||||
evt.preventDefault();
|
evt.preventDefault();
|
||||||
var sourceId = evt.dataTransfer.getData('text/plain');
|
var source = evt.dataTransfer.getData('text/plain');
|
||||||
|
|
||||||
if (sourceId === id) {
|
if (source === id) {
|
||||||
|
console.warn('You can\'t connect a node with itself.');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
onConnect({
|
onConnect({
|
||||||
sourceId: sourceId,
|
source: source,
|
||||||
targetId: id
|
target: id
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -93,13 +93,14 @@ export default NodeComponent => memo((props) => {
|
|||||||
const onDrop = (evt) => {
|
const onDrop = (evt) => {
|
||||||
evt.preventDefault();
|
evt.preventDefault();
|
||||||
|
|
||||||
const sourceId = evt.dataTransfer.getData('text/plain');
|
const source = evt.dataTransfer.getData('text/plain');
|
||||||
|
|
||||||
if (sourceId === id) {
|
if (source === id) {
|
||||||
|
console.warn('You can\'t connect a node with itself.');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
onConnect({ sourceId, targetId: id });
|
onConnect({ source, target: id });
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
Reference in New Issue
Block a user