From 16675cbc378f1188a245165a1476571f1aad22b8 Mon Sep 17 00:00:00 2001 From: Ivan Usenkov Date: Thu, 26 Sep 2019 15:58:55 +0300 Subject: [PATCH] get content from RTE --- src/dom_components/view/ComponentTextView.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/dom_components/view/ComponentTextView.js b/src/dom_components/view/ComponentTextView.js index 853fffabe..e48316d9c 100644 --- a/src/dom_components/view/ComponentTextView.js +++ b/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);