MCPcopy Create free account
hub / github.com/editablejs/editable / cells

Function cells

packages/models/src/interfaces/grid.ts:889–916  ·  view source on GitHub ↗
(
    editor: Editor,
    at?: GridLocation,
    opitons: GridGeneratorCellsOptions = {},
  )

Source from the content-addressed store, hash-verified

887 },
888
889 *cells(
890 editor: Editor,
891 at?: GridLocation,
892 opitons: GridGeneratorCellsOptions = {},
893 ): Generator<[GridCell, number, number]> {
894 if (!at || Path.isPath(at)) {
895 const entry = Grid.above(editor, at)
896 if (!entry) return
897 at = entry
898 }
899 const [grid] = at
900 const { children } = grid
901 const { startRow = 0, startCol = 0, endRow = children.length - 1, reverse = false } = opitons
902 let r = reverse ? Math.min(endRow, children.length - 1) : startRow
903 while (reverse ? r >= startRow : r <= endRow) {
904 const row = children[r]
905 if (!row) break
906 const { children: cells } = row
907 const { endCol = cells.length - 1 } = opitons
908 let c = reverse ? Math.min(endCol, cells.length - 1) : startCol
909 while (reverse ? c >= startCol : c <= endCol) {
910 const cell = cells[c]
911 yield [cell, r, c]
912 c = reverse ? c - 1 : c + 1
913 }
914 r = reverse ? r - 1 : r + 1
915 }
916 },
917 /**
918 * 如果选区中的开始或结束位置处于被合并的单元格,就把选区边界定位在最终合并的单元格内
919 * @param editor

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…