Browse Source

Avoid removing component on selector editing

pull/1518/head
Artur Arseniev 8 years ago
parent
commit
e6c1c291a9
  1. 9
      src/selector_manager/view/ClassTagView.js

9
src/selector_manager/view/ClassTagView.js

@ -27,7 +27,7 @@ module.exports = require('backbone').View.extend({
this.coll = o.coll || null; this.coll = o.coll || null;
this.pfx = this.config.stylePrefix || ''; this.pfx = this.config.stylePrefix || '';
this.ppfx = this.config.pStylePrefix || ''; this.ppfx = this.config.pStylePrefix || '';
this.target = this.config.em; this.em = this.config.em;
this.listenTo(this.model, 'change:active', this.updateStatus); this.listenTo(this.model, 'change:active', this.updateStatus);
}, },
@ -48,9 +48,11 @@ module.exports = require('backbone').View.extend({
* @private * @private
*/ */
startEditTag() { startEditTag() {
const { em } = this;
const inputEl = this.getInputEl(); const inputEl = this.getInputEl();
inputEl[inputProp] = true; inputEl[inputProp] = true;
inputEl.focus(); inputEl.focus();
em && em.setEditing(1);
}, },
/** /**
@ -63,9 +65,10 @@ module.exports = require('backbone').View.extend({
const inputEl = this.getInputEl(); const inputEl = this.getInputEl();
const label = inputEl.textContent; const label = inputEl.textContent;
const name = Selector.escapeName(label); const name = Selector.escapeName(label);
const em = this.target; const em = this.em;
const sm = em && em.get('SelectorManager'); const sm = em && em.get('SelectorManager');
inputEl[inputProp] = false; inputEl[inputProp] = false;
em && em.setEditing(0);
if (sm) { if (sm) {
if (sm.get(name)) { if (sm.get(name)) {
@ -90,7 +93,7 @@ module.exports = require('backbone').View.extend({
* @private * @private
*/ */
removeTag(e) { removeTag(e) {
const em = this.target; const em = this.em;
const model = this.model; const model = this.model;
const coll = this.coll; const coll = this.coll;
const el = this.el; const el = this.el;

Loading…
Cancel
Save