mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-01-17 21:50:56 +08:00
fix(list): Don't drag the item being edited. Fixes #1386
This commit is contained in:
parent
420bfbd2f6
commit
5412494f0f
1 changed files with 8 additions and 2 deletions
|
@ -119,7 +119,7 @@ class EditableList extends Component {
|
||||||
super(props);
|
super(props);
|
||||||
this.state = props.initialState || {
|
this.state = props.initialState || {
|
||||||
dropInsertionIndex: -1,
|
dropInsertionIndex: -1,
|
||||||
editingIndex: null,
|
editingIndex: -1,
|
||||||
creatingItem: false,
|
creatingItem: false,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -156,7 +156,7 @@ class EditableList extends Component {
|
||||||
};
|
};
|
||||||
|
|
||||||
_clearEditingState = (callback)=> {
|
_clearEditingState = (callback)=> {
|
||||||
this._setStateAndFocus({editingIndex: null}, callback);
|
this._setStateAndFocus({editingIndex: -1}, callback);
|
||||||
};
|
};
|
||||||
|
|
||||||
_clearCreatingState = (callback)=> {
|
_clearCreatingState = (callback)=> {
|
||||||
|
@ -288,6 +288,12 @@ class EditableList extends Component {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (row.dataset.itemIdx / 1 === this.state.editingIndex / 1) {
|
||||||
|
// dragging the row currently being edited makes text selection impossible
|
||||||
|
event.preventDefault();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
event.dataTransfer.setData('editablelist-index', row.dataset.itemIdx);
|
event.dataTransfer.setData('editablelist-index', row.dataset.itemIdx);
|
||||||
event.dataTransfer.setData('editablelist-reactid', wrapperId);
|
event.dataTransfer.setData('editablelist-reactid', wrapperId);
|
||||||
event.dataTransfer.effectAllowed = "move";
|
event.dataTransfer.effectAllowed = "move";
|
||||||
|
|
Loading…
Reference in a new issue