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

Method applyModel

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

Commit a concrete next-model: re-serialize and write it over the source. * The dispatch rebuilds the decorations (a fresh widget), so we refocus the * requested cell on the next frame. Used by the context menu, which has * already computed `next` from the current model.

(next: MarkdownTable, focus?: CellAddress)

Source from the content-addressed store, hash-verified

167 * requested cell on the next frame. Used by the context menu, which has
168 * already computed `next` from the current model. */
169 private applyModel(next: MarkdownTable, focus?: CellAddress): void {
170 // Capture the live range BEFORE the dispatch detaches our DOM.
171 const dom = this.dom as HTMLElement
172 this.model = next
173 this.dirty = false
174 commitTable(this.view, dom, next)
175 if (focus) {
176 requestAnimationFrame(() => this.focusCellAt(focus))
177 }
178 }
179
180 /** Pull pending cell edits into the model, then apply a structural
181 * transform and commit — all without an intermediate dispatch, so our DOM

Callers 4

applyTransformMethod · 0.95
buildCellMethod · 0.95
onUpMethod · 0.95
openCellMenuMethod · 0.95

Calls 2

focusCellAtMethod · 0.95
commitTableFunction · 0.85

Tested by

no test coverage detected