Browse Source

get content from RTE

pull/2292/head
Ivan Usenkov 7 years ago
parent
commit
16675cbc37
  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(); 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 * Merge content from the DOM to the model
*/ */
syncContent(opts = {}) { syncContent(opts = {}) {
const { model, rte, rteEnabled } = this; const { model, rte, rteEnabled } = this;
if (!rteEnabled && !opts.force) return; if (!rteEnabled && !opts.force) return;
const content = this.getChildrenContainer().innerHTML; const content = this.getContent();
const comps = model.components(); const comps = model.components();
const contentOpt = { fromDisable: 1, ...opts }; const contentOpt = { fromDisable: 1, ...opts };
comps.length && comps.reset(null, opts); comps.length && comps.reset(null, opts);

Loading…
Cancel
Save