* Fills Editor with Blocks data * * @param {OutputData} data — Saved Editor data
(data: OutputData)
| 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 |