Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function selectionBetween(view, $anchor, $head, bias) {
return view.someProp("createSelectionBetween", f => f(view, $anchor, $head))
|| TextSelection.between($anchor, $head, bias)
}
map(doc, mapping) {
let $anchorCell = doc.resolve(mapping.map(this.$anchorCell.pos))
let $headCell = doc.resolve(mapping.map(this.$headCell.pos))
if (pointsAtCell($anchorCell) && pointsAtCell($headCell) && inSameTable($anchorCell, $headCell)) {
let tableChanged = this.$anchorCell.node(-1) != $anchorCell.node(-1)
if (tableChanged && this.isRowSelection())
return CellSelection.rowSelection($anchorCell, $headCell)
else if (tableChanged && this.isColSelection())
return CellSelection.colSelection($anchorCell, $headCell)
else
return new CellSelection($anchorCell, $headCell)
}
return TextSelection.between($anchorCell, $headCell)
}
return function(state, dispatch) {
if (!isInTable(state)) return false
let cell = findNextCell(selectionCell(state), direction)
if (cell == null) return
if (dispatch) {
let $cell = state.doc.resolve(cell)
dispatch(state.tr.setSelection(TextSelection.between($cell, moveCellForward($cell))).scrollIntoView())
}
return true
}
}