Pull every cell's text out of the DOM into the model. `data-raw` holds the * markdown source — `textContent` would lose it when a cell shows rendered * inline markup (e.g. `code` chips).
()
| 203 | * markdown source — `textContent` would lose it when a cell shows rendered |
| 204 | * inline markup (e.g. `code` chips). */ |
| 205 | private syncFromDom(): void { |
| 206 | if (!this.dom) return |
| 207 | const cells = this.dom.querySelectorAll<HTMLElement>('[data-row]') |
| 208 | cells.forEach((cell) => { |
| 209 | const row = Number(cell.dataset.row) |
| 210 | const col = Number(cell.dataset.col) |
| 211 | const value = cell.dataset.raw ?? cell.textContent ?? '' |
| 212 | if (row === -1) this.model.headers[col] = value |
| 213 | else if (this.model.rows[row]) this.model.rows[row][col] = value |
| 214 | }) |
| 215 | } |
| 216 | |
| 217 | private commitIfDirty(): void { |
| 218 | if (!this.dirty) return |
no outgoing calls
no test coverage detected