RELEASE 2.11.0 OR ABOVE
Returns an APIModel for editing via the API.
Parameters:
Name | Type | Attribute | Description |
---|---|---|---|
selector | String | selector | |
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. |
Return:
Type | Description |
---|---|
Element[] | Array of API models for editing |
Example:
var body = editor.getAPIModelsBySelector('.se-contents')[0]; body.append('<p><span>APPEND TEXT</span></p>');
skipUndoRedo : true
var body = editor.getAPIModelsBySelector('.se-contents', { skipUndoRedo : true })[0]; body.append('<p><span>APPEND TEXT</span></p>');
skipRendering : true
var body = editor.getAPIModelsBySelector('.se-contents', { skipUndoRedo : true })[0]; body.setText('TEXT'); body.append('<p><span>APPEND TEXT</span></p>'); body.prepend('<p><span>PREPEND TEXT</span></p>'); editor.render();