|
|
@ -230,22 +230,18 @@ export default class ItemView extends View { |
|
|
*/ |
|
|
*/ |
|
|
handleEditEnd(ev?: KeyboardEvent) { |
|
|
handleEditEnd(ev?: KeyboardEvent) { |
|
|
ev?.stopPropagation(); |
|
|
ev?.stopPropagation(); |
|
|
const { em, $el, clsNoEdit, clsEdit } = this; |
|
|
const { em, $el, clsNoEdit, clsEdit, model } = this; |
|
|
const inputEl = this.getInputName(); |
|
|
const inputEl = this.getInputName(); |
|
|
const name = inputEl.textContent!; |
|
|
const name = inputEl.textContent!; |
|
|
inputEl.scrollLeft = 0; |
|
|
inputEl.scrollLeft = 0; |
|
|
inputEl[inputProp] = 'false'; |
|
|
inputEl[inputProp] = 'false'; |
|
|
this.setName(name, { component: this.model, propName: 'custom-name' }); |
|
|
model.setName(name); |
|
|
em.setEditing(false); |
|
|
em.setEditing(false); |
|
|
$el.find(`.${this.inputNameCls}`).addClass(clsNoEdit).removeClass(clsEdit); |
|
|
$el.find(`.${this.inputNameCls}`).addClass(clsNoEdit).removeClass(clsEdit); |
|
|
// Ensure to always update the layer name #4544
|
|
|
// Ensure to always update the layer name #4544
|
|
|
this.updateName(); |
|
|
this.updateName(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
setName(name: string, { propName }: { propName: string; component?: Component }) { |
|
|
|
|
|
this.model.set(propName, name); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* Get the input containing the name of the component |
|
|
* Get the input containing the name of the component |
|
|
* @return {HTMLElement} |
|
|
* @return {HTMLElement} |
|
|
|