MCPcopy Create free account
hub / github.com/ZenNotes/zennotes / syncFromDom

Method syncFromDom

packages/app-core/src/lib/cm-table.ts:205–215  ·  view source on GitHub ↗

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).

()

Source from the content-addressed store, hash-verified

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

Callers 7

applyTransformMethod · 0.95
commitIfDirtyMethod · 0.95
onUpMethod · 0.95
buildCellMethod · 0.95
startRowDragMethod · 0.95
startColDragMethod · 0.95
openCellMenuMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected