MCPcopy Index your code
hub / github.com/codex-team/editor.js / render

Method render

src/components/modules/api/blocks.ts:204–219  ·  view source on GitHub ↗

* Fills Editor with Blocks data * * @param {OutputData} data — Saved Editor data

(data: OutputData)

Source from the content-addressed store, hash-verified

202 * @param {OutputData} data — Saved Editor data
203 */
204 public async render(data: OutputData): Promise<void> {
205 if (data === undefined || data.blocks === undefined) {
206 throw new Error('Incorrect data passed to the render() method');
207 }
208
209 /**
210 * Semantic meaning of the "render" method: "Display the new document over the existing one that stays unchanged"
211 * So we need to disable modifications observer temporarily
212 */
213 this.Editor.ModificationsObserver.disable();
214
215 await this.Editor.BlockManager.clear();
216 await this.Editor.Renderer.render(data.blocks);
217
218 this.Editor.ModificationsObserver.enable();
219 }
220
221 /**
222 * Render passed HTML string

Callers 1

methodsMethod · 0.95

Calls 4

disableMethod · 0.80
enableMethod · 0.80
clearMethod · 0.65
renderMethod · 0.65

Tested by

no test coverage detected