Browse Source

Feature/get content from rte (#2292)

Feature/get content from rte
pull/2330/head
Artur Arseniev 7 years ago
committed by GitHub
parent
commit
7d1dff957d
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 17
      src/dom_components/view/ComponentTextView.js

17
src/dom_components/view/ComponentTextView.js

@ -71,13 +71,28 @@ export default ComponentView.extend({
this.toggleEvents();
},
/**
* get content from RTE
* @return string
*/
getContent() {
const { rte } = this;
let content = '';
if(rte.activeRte && typeof rte.activeRte.getContent === 'function') {
content = rte.activeRte.getContent();
} else {
content = this.getChildrenContainer().innerHTML;
}
return content;
},
/**
* Merge content from the DOM to the model
*/
syncContent(opts = {}) {
const { model, rte, rteEnabled } = this;
if (!rteEnabled && !opts.force) return;
const content = this.getChildrenContainer().innerHTML;
const content = this.getContent();
const comps = model.components();
const contentOpt = { fromDisable: 1, ...opts };
comps.length && comps.reset(null, opts);

Loading…
Cancel
Save