diff --git a/src/components/TreeMode.js b/src/components/TreeMode.js index 4ed0c84..a8f05d0 100644 --- a/src/components/TreeMode.js +++ b/src/components/TreeMode.js @@ -506,8 +506,9 @@ export default class TreeMode extends Component { const { data, selection, clipboard } = this.state if (selection && clipboard && clipboard.length > 0) { - // FIXME: handle pasting in an empty object or array + this.setState({ selection: null }) this.handlePatch(replace(data, selection, clipboard)) + // TODO: select the pasted contents } } @@ -710,7 +711,7 @@ export default class TreeMode extends Component { const path = this.findDataPathFromElement(element) const area = element && element.getAttribute && element.getAttribute('data-area') || null - return { path, area } + return path ? { path, area } : null } /** diff --git a/src/eson.js b/src/eson.js index cf00220..6de8695 100644 --- a/src/eson.js +++ b/src/eson.js @@ -358,7 +358,7 @@ export function applySearchResults (eson: ESON, searchResults: ESONPointer[], ac * Merge searchResults into the eson object */ export function applySelection (eson: ESON, selection: ESONSelection) { - if (!selection || !selection.start || !selection.end) { + if (!selection) { return eson }