Fixed not removing selection before duplication

This commit is contained in:
jos 2017-11-08 16:10:39 +01:00
parent cb354f2331
commit 8cded5496c
2 changed files with 4 additions and 3 deletions

View File

@ -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
}
/**

View File

@ -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
}