|
91 | 91 | isEditingSelection,
|
92 | 92 | isValueSelection,
|
93 | 93 | pathInSelection,
|
| 94 | + pathStartsWith, |
94 | 95 | removeEditModeFromSelection
|
95 | 96 | } from '$lib/logic/selection.js'
|
96 | 97 | import { createHistory } from '$lib/logic/history.js'
|
|
429 | 430 | if (!isEqual(documentState.selection, externalSelection)) {
|
430 | 431 | debug('applyExternalSelection', externalSelection)
|
431 | 432 |
|
432 |
| - if (externalSelection === null) { |
433 |
| - updateSelection(externalSelection) |
434 |
| - } |
435 |
| -
|
436 |
| - if (isValueSelection(externalSelection)) { |
437 |
| - // check whether the selection is a leaf, and not an object (that would select multiple cells) |
438 |
| - const value = getIn(json, externalSelection.path) |
439 |
| - if (isObjectOrArray(value)) { |
440 |
| - return |
441 |
| - } |
442 |
| -
|
443 |
| - updateSelection(externalSelection) |
444 |
| - } |
445 |
| -
|
446 |
| - // we ignore other selection types like key or inline |
| 433 | + updateSelection(externalSelection) |
447 | 434 | }
|
448 | 435 | }
|
449 | 436 |
|
|
1791 | 1778 | {#each columns as column, columnIndex}
|
1792 | 1779 | {@const path = [String(rowIndex)].concat(column)}
|
1793 | 1780 | {@const value = getIn(item, column)}
|
1794 |
| - {@const isSelected = pathInSelection(json, documentState.selection, path)} |
| 1781 | + {@const isSelected = |
| 1782 | + isValueSelection(documentState.selection) && |
| 1783 | + pathStartsWith(documentState.selection.path, path)} |
1795 | 1784 | {@const validationErrorsByColumn = validationErrorsByRow?.columns[columnIndex]}
|
1796 | 1785 | <td
|
1797 | 1786 | class="jse-table-cell"
|
1798 | 1787 | data-path={encodeDataPath(path)}
|
1799 |
| - class:jse-selected-value={isSelected && |
1800 |
| - isValueSelection(documentState.selection)} |
| 1788 | + class:jse-selected-value={isSelected} |
1801 | 1789 | >
|
1802 | 1790 | {#if isObjectOrArray(value)}
|
1803 | 1791 | <InlineValue
|
|
0 commit comments