From 38aea7bd5bff90adebf2d9546ca19895bc87ecbe Mon Sep 17 00:00:00 2001 From: Artur Arseniev Date: Mon, 12 Oct 2020 02:14:51 +0200 Subject: [PATCH] Avoid rte activation with nested text components --- src/dom_components/view/ComponentTextView.js | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/dom_components/view/ComponentTextView.js b/src/dom_components/view/ComponentTextView.js index 0c6535443..3be077a56 100644 --- a/src/dom_components/view/ComponentTextView.js +++ b/src/dom_components/view/ComponentTextView.js @@ -29,13 +29,19 @@ export default ComponentView.extend({ * @private * */ onActive(e) { + const { rte, em } = this; + // We place this before stopPropagation in case of nested // 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; } + e && e.stopPropagation && e.stopPropagation(); - const { rte, em } = this; if (rte) { try { @@ -133,6 +139,7 @@ export default ComponentView.extend({ } }, + /* getModelsFromEl(el) { const result = []; const children = (el || this.el).childNodes; @@ -142,17 +149,17 @@ export default ComponentView.extend({ const model = child.__cashData && child.__cashData.model; if (model) { - model.components = this.getModelsFromEl(child); + model.attributes.components = this.getModelsFromEl(child); if (model.get('content')) { model.attributes.content = child.textContent; } - // TODO add attributes; result.push(model); } } return result; }, + */ /** * Callback on input event