mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-01-10 02:03:07 +08:00
fix(list): Don't drag the item being edited. Fixes #1386
This commit is contained in:
parent
55df92588f
commit
9de55ea5da
1 changed files with 8 additions and 2 deletions
|
@ -119,7 +119,7 @@ class EditableList extends Component {
|
|||
super(props);
|
||||
this.state = props.initialState || {
|
||||
dropInsertionIndex: -1,
|
||||
editingIndex: null,
|
||||
editingIndex: -1,
|
||||
creatingItem: false,
|
||||
};
|
||||
}
|
||||
|
@ -156,7 +156,7 @@ class EditableList extends Component {
|
|||
};
|
||||
|
||||
_clearEditingState = (callback)=> {
|
||||
this._setStateAndFocus({editingIndex: null}, callback);
|
||||
this._setStateAndFocus({editingIndex: -1}, callback);
|
||||
};
|
||||
|
||||
_clearCreatingState = (callback)=> {
|
||||
|
@ -288,6 +288,12 @@ class EditableList extends Component {
|
|||
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-reactid', wrapperId);
|
||||
event.dataTransfer.effectAllowed = "move";
|
||||
|
|
Loading…
Reference in a new issue