diff --git a/src/editor/index.js b/src/editor/index.js index ba247eb9d..1620b6e02 100644 --- a/src/editor/index.js +++ b/src/editor/index.js @@ -416,6 +416,20 @@ export default (config = {}) => { return this; }, + /** + * Returns, if active, the Component enabled in rich text editing mode. + * @returns {Component|null} + * @example + * const textComp = editor.getEditing(); + * if (textComp) { + * console.log('HTML: ', textComp.toHTML()); + * } + */ + getEditing() { + const res = em.getEditing(); + return (res && res.model) || null; + }, + /** * Set device to the editor. If the device exists it will * change the canvas to the proper width diff --git a/src/editor/model/Editor.js b/src/editor/model/Editor.js index 79c475d6d..87a55e380 100644 --- a/src/editor/model/Editor.js +++ b/src/editor/model/Editor.js @@ -807,6 +807,10 @@ export default Backbone.Model.extend({ .attr(this.attrsOrig); }, + getEditing() { + return this.get('editing'); + }, + setEditing(value) { this.set('editing', value); return this;