Skip to content

Commit

Permalink
fixes to undroppable tree nodes (#6988)
Browse files Browse the repository at this point in the history
  • Loading branch information
rpiaggio authored Aug 5, 2024
1 parent ea249d3 commit 0de1b70
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions components/lib/tree/UITreeNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -609,19 +609,17 @@ export const UITreeNode = React.memo((props) => {
const onDropPoint = (event, position) => {
event.preventDefault();

if (props.node.droppable !== false) {
DomHandler.removeClass(event.target, 'p-treenode-droppoint-active');
DomHandler.removeClass(event.target, 'p-treenode-droppoint-active');

if (props.onDropPoint) {
const dropIndex = position === -1 ? props.index : props.index + 1;
if (props.onDropPoint) {
const dropIndex = position === -1 ? props.index : props.index + 1;

props.onDropPoint({
originalEvent: event,
path: props.path,
index: dropIndex,
position
});
}
props.onDropPoint({
originalEvent: event,
path: props.path,
index: dropIndex,
position
});
}
};

Expand Down Expand Up @@ -979,7 +977,7 @@ export const UITreeNode = React.memo((props) => {

const node = createNode();

if (props.dragdropScope && !props.disabled) {
if (props.dragdropScope && !props.disabled && props.node.droppable) {
const beforeDropPoint = createDropPoint(-1);
const afterDropPoint = props.last ? createDropPoint(1) : null;

Expand Down

0 comments on commit 0de1b70

Please sign in to comment.