Browse Source

Add `editor.getEditing` method

pull/3670/head
Artur Arseniev 5 years ago
parent
commit
f026afacd6
  1. 14
      src/editor/index.js
  2. 4
      src/editor/model/Editor.js

14
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

4
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;

Loading…
Cancel
Save