RELEASE 2.11.0 OR ABOVE
The editing model is updated based on the changed DOM.
It is used to reflect the HTML DOM rendered on the screen to the editing model after editing.
Parameters:
Name | Type | Attribute | Description |
---|---|---|---|
beforeId | String | ID value of DOM before change | |
afterId | String | ID value of DOM after change. Default is beforeId. | |
options | Object | { skipUndoRedo: false, skipRendering: false } | Set options for APIModel. skipUndoRedo : If this value is true, the result of editing through the model is not undo/redo. Also the old undo/redo stack is initialized. skipRendering : If this value is true, the results of editing through the model are reflected only in the model and not rendered on the screen. After all edits are done, you need to render them separately via editor.render() method. |
Example:
If the ID has not changed
var p = document.getElementById('p1'); p.innerText = 'Change the text.'; editor.updateModel('p1');
If the ID has changed
var p1 = document.getElementById('p1'); p1.id = 'p2'; p2.innerText = 'Change the text.'; editor.updateModel('p1', 'p2');