Browse Source

Avoid rte activation with nested text components

pull/3073/head
Artur Arseniev 6 years ago
parent
commit
38aea7bd5b
  1. 15
      src/dom_components/view/ComponentTextView.js

15
src/dom_components/view/ComponentTextView.js

@ -29,13 +29,19 @@ export default ComponentView.extend({
* @private * @private
* */ * */
onActive(e) { onActive(e) {
const { rte, em } = this;
// We place this before stopPropagation in case of nested // We place this before stopPropagation in case of nested
// text components will not block the editing (#1394) // text components will not block the editing (#1394)
if (this.rteEnabled || !this.model.get('editable')) { if (
this.rteEnabled ||
!this.model.get('editable') ||
(em && em.isEditing())
) {
return; return;
} }
e && e.stopPropagation && e.stopPropagation(); e && e.stopPropagation && e.stopPropagation();
const { rte, em } = this;
if (rte) { if (rte) {
try { try {
@ -133,6 +139,7 @@ export default ComponentView.extend({
} }
}, },
/*
getModelsFromEl(el) { getModelsFromEl(el) {
const result = []; const result = [];
const children = (el || this.el).childNodes; const children = (el || this.el).childNodes;
@ -142,17 +149,17 @@ export default ComponentView.extend({
const model = child.__cashData && child.__cashData.model; const model = child.__cashData && child.__cashData.model;
if (model) { if (model) {
model.components = this.getModelsFromEl(child); model.attributes.components = this.getModelsFromEl(child);
if (model.get('content')) { if (model.get('content')) {
model.attributes.content = child.textContent; model.attributes.content = child.textContent;
} }
// TODO add attributes;
result.push(model); result.push(model);
} }
} }
return result; return result;
}, },
*/
/** /**
* Callback on input event * Callback on input event

Loading…
Cancel
Save