From e6c1c291a98845528c373c99a0ca1af7189687ef Mon Sep 17 00:00:00 2001 From: Artur Arseniev Date: Wed, 26 Sep 2018 08:00:06 +0200 Subject: [PATCH] Avoid removing component on selector editing --- src/selector_manager/view/ClassTagView.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/selector_manager/view/ClassTagView.js b/src/selector_manager/view/ClassTagView.js index bb00214c1..01b634c31 100644 --- a/src/selector_manager/view/ClassTagView.js +++ b/src/selector_manager/view/ClassTagView.js @@ -27,7 +27,7 @@ module.exports = require('backbone').View.extend({ this.coll = o.coll || null; this.pfx = this.config.stylePrefix || ''; this.ppfx = this.config.pStylePrefix || ''; - this.target = this.config.em; + this.em = this.config.em; this.listenTo(this.model, 'change:active', this.updateStatus); }, @@ -48,9 +48,11 @@ module.exports = require('backbone').View.extend({ * @private */ startEditTag() { + const { em } = this; const inputEl = this.getInputEl(); inputEl[inputProp] = true; inputEl.focus(); + em && em.setEditing(1); }, /** @@ -63,9 +65,10 @@ module.exports = require('backbone').View.extend({ const inputEl = this.getInputEl(); const label = inputEl.textContent; const name = Selector.escapeName(label); - const em = this.target; + const em = this.em; const sm = em && em.get('SelectorManager'); inputEl[inputProp] = false; + em && em.setEditing(0); if (sm) { if (sm.get(name)) { @@ -90,7 +93,7 @@ module.exports = require('backbone').View.extend({ * @private */ removeTag(e) { - const em = this.target; + const em = this.em; const model = this.model; const coll = this.coll; const el = this.el;