From 5412494f0f0a1f9b02c1a097632c00bfaf8c44f9 Mon Sep 17 00:00:00 2001 From: Ben Gotow Date: Mon, 22 Feb 2016 17:41:32 -0800 Subject: [PATCH] fix(list): Don't drag the item being edited. Fixes #1386 --- src/components/editable-list.jsx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/components/editable-list.jsx b/src/components/editable-list.jsx index e5817ac59..2440232f7 100644 --- a/src/components/editable-list.jsx +++ b/src/components/editable-list.jsx @@ -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";