Browse Source

Merge branch 'dev' of github.com:choukin/grapesjs into dev

pull/2298/head
zhaoxin 7 years ago
parent
commit
bb62b531c8
  1. 20
      src/dom_components/view/ComponentTextView.js

20
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);
@ -161,8 +176,9 @@ export default ComponentView.extend({
while (el) {
el.draggable = enable ? !1 : !0;
// Note: el.parentNode is sometimes null here
el = el.parentNode;
el.tagName == 'BODY' && (el = 0);
el && el.tagName == 'BODY' && (el = 0);
}
}
}

Loading…
Cancel
Save