Skip to content

Commit

Permalink
Fix primefaces#6766: Added checks for dragdropScope being defined bef…
Browse files Browse the repository at this point in the history
…ore conversion
  • Loading branch information
AnotherZane committed Jun 18, 2024
1 parent a698936 commit 8ad4304
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions components/lib/tree/UITreeNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -620,20 +620,20 @@ export const UITreeNode = React.memo((props) => {
};

const onDropPointDragOver = (event) => {
if (event.dataTransfer.types[1] === props.dragdropScope.toLocaleLowerCase()) {
if (props.dragdropScope && event.dataTransfer.types[1] === props.dragdropScope.toLocaleLowerCase()) {
event.dataTransfer.dropEffect = 'move';
event.preventDefault();
}
};

const onDropPointDragEnter = (event) => {
if (event.dataTransfer.types[1] === props.dragdropScope.toLocaleLowerCase()) {
if (props.dragdropScope && event.dataTransfer.types[1] === props.dragdropScope.toLocaleLowerCase()) {
DomHandler.addClass(event.target, 'p-treenode-droppoint-active');
}
};

const onDropPointDragLeave = (event) => {
if (event.dataTransfer.types[1] === props.dragdropScope.toLocaleLowerCase()) {
if (props.dragdropScope && event.dataTransfer.types[1] === props.dragdropScope.toLocaleLowerCase()) {
DomHandler.removeClass(event.target, 'p-treenode-droppoint-active');
}
};
Expand All @@ -655,21 +655,21 @@ export const UITreeNode = React.memo((props) => {
};

const onDragOver = (event) => {
if (event.dataTransfer.types[1] === props.dragdropScope.toLocaleLowerCase() && props.node.droppable !== false) {
if (props.dragdropScope && event.dataTransfer.types[1] === props.dragdropScope.toLocaleLowerCase() && props.node.droppable !== false) {
event.dataTransfer.dropEffect = 'move';
event.preventDefault();
event.stopPropagation();
}
};

const onDragEnter = (event) => {
if (event.dataTransfer.types[1] === props.dragdropScope.toLocaleLowerCase() && props.node.droppable !== false) {
if (props.dragdropScope && event.dataTransfer.types[1] === props.dragdropScope.toLocaleLowerCase() && props.node.droppable !== false) {
DomHandler.addClass(contentRef.current, 'p-treenode-dragover');
}
};

const onDragLeave = (event) => {
if (event.dataTransfer.types[1] === props.dragdropScope.toLocaleLowerCase() && props.node.droppable !== false) {
if (props.dragdropScope && event.dataTransfer.types[1] === props.dragdropScope.toLocaleLowerCase() && props.node.droppable !== false) {
let rect = event.currentTarget.getBoundingClientRect();

if (event.nativeEvent.x > rect.left + rect.width || event.nativeEvent.x < rect.left || event.nativeEvent.y >= Math.floor(rect.top + rect.height) || event.nativeEvent.y < rect.top) {
Expand Down

0 comments on commit 8ad4304

Please sign in to comment.