Add comments
This commit is contained in:
parent
70fd643431
commit
a3be0f1cd1
|
@ -83,7 +83,7 @@ export const createActions = context => {
|
||||||
const $rowChangeCache = get(rowChangeCache)
|
const $rowChangeCache = get(rowChangeCache)
|
||||||
const $rows = get(rows)
|
const $rows = get(rows)
|
||||||
|
|
||||||
// Extract value of each selected cell
|
// Extract value of each selected cell, accounting for the change cache
|
||||||
let value = []
|
let value = []
|
||||||
for (let row of $selectedCells) {
|
for (let row of $selectedCells) {
|
||||||
const rowValues = []
|
const rowValues = []
|
||||||
|
@ -133,10 +133,10 @@ export const createActions = context => {
|
||||||
// Choose paste strategy
|
// Choose paste strategy
|
||||||
if (multiCellCopy) {
|
if (multiCellCopy) {
|
||||||
if (multiCellPaste) {
|
if (multiCellPaste) {
|
||||||
// Multi to multi (only paste selected cells)
|
// Multi to multi - try pasting into all selected cells
|
||||||
await pasteIntoSelectedCells(value)
|
await pasteIntoSelectedCells(value)
|
||||||
} else {
|
} else {
|
||||||
// Multi to single (expand to paste all values)
|
// Multi to single - expand to paste all values
|
||||||
// Get indices of focused cell
|
// Get indices of focused cell
|
||||||
const $focusedCellId = get(focusedCellId)
|
const $focusedCellId = get(focusedCellId)
|
||||||
const { id, field } = parseCellID($focusedCellId)
|
const { id, field } = parseCellID($focusedCellId)
|
||||||
|
@ -172,14 +172,11 @@ export const createActions = context => {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (multiCellPaste) {
|
if (multiCellPaste) {
|
||||||
// Single to multi (duplicate value in all selected cells)
|
// Single to multi - duplicate value to all selected cells
|
||||||
const $selectedCells = get(selectedCells)
|
const newValue = get(selectedCells).map(row => row.map(() => value))
|
||||||
const pastableValue = $selectedCells.map(row => {
|
await pasteIntoSelectedCells(newValue)
|
||||||
return row.map(() => value)
|
|
||||||
})
|
|
||||||
await pasteIntoSelectedCells(pastableValue)
|
|
||||||
} else {
|
} else {
|
||||||
// Single to single
|
// Single to single - just update the cell's value
|
||||||
get(focusedCellAPI).setValue(value)
|
get(focusedCellAPI).setValue(value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue