Fixed ActionMenu not visible in arrays

This commit is contained in:
jos 2017-12-30 15:55:53 +01:00
parent d73b79cb4e
commit 5d4a551526
1 changed files with 7 additions and 7 deletions

View File

@ -385,11 +385,11 @@ export function applySelection (eson, selection) {
const endIndex = root[META].props.indexOf(end) const endIndex = root[META].props.indexOf(end)
const firstIndex = Math.min(startIndex, endIndex) const firstIndex = Math.min(startIndex, endIndex)
const lastIndex = Math.max(startIndex, endIndex) + 1 // include max index itself const lastIndex = Math.max(startIndex, endIndex)
const firstProp = root[META].props[firstIndex] const firstProp = root[META].props[firstIndex]
const lastProp = root[META].props[lastIndex - 1] const lastProp = root[META].props[lastIndex]
const selectedProps = root[META].props.slice(firstIndex, lastIndex) const selectedProps = root[META].props.slice(firstIndex, lastIndex + 1)// include max index itself
selectedPaths = selectedProps.map(prop => rootPath.concat(prop)) selectedPaths = selectedProps.map(prop => rootPath.concat(prop))
let updatedObj = cloneWithSymbols(root) let updatedObj = cloneWithSymbols(root)
selectedProps.forEach(prop => { selectedProps.forEach(prop => {
@ -408,17 +408,17 @@ export function applySelection (eson, selection) {
const endIndex = parseInt(end, 10) const endIndex = parseInt(end, 10)
const firstIndex = Math.min(startIndex, endIndex) const firstIndex = Math.min(startIndex, endIndex)
const lastIndex = Math.max(startIndex, endIndex) + 1 // include max index itself const lastIndex = Math.max(startIndex, endIndex)
const selectedIndices = range(firstIndex, lastIndex) const selectedIndices = range(firstIndex, lastIndex + 1)// include max index itself
selectedPaths = selectedIndices.map(index => rootPath.concat(String(index))) selectedPaths = selectedIndices.map(index => rootPath.concat(String(index)))
let updatedArr = root.slice() let updatedArr = root.slice()
updatedArr = cloneWithSymbols(root) updatedArr = cloneWithSymbols(root)
selectedIndices.forEach(index => { selectedIndices.forEach(index => {
const selected = SELECTED + const selected = SELECTED +
(index === start ? SELECTED_START : 0) + (index === startIndex ? SELECTED_START : 0) +
(index === end ? SELECTED_END : 0) + (index === endIndex ? SELECTED_END : 0) +
(index === firstIndex ? SELECTED_FIRST : 0) + (index === firstIndex ? SELECTED_FIRST : 0) +
(index === lastIndex ? SELECTED_LAST : 0) (index === lastIndex ? SELECTED_LAST : 0)
updatedArr[index] = setIn(updatedArr[index], [META, 'selected'], selected) updatedArr[index] = setIn(updatedArr[index], [META, 'selected'], selected)