Allow moving cursor by clicking on collection name while editing

Closes #2513
This commit is contained in:
Adomas Venčkauskas 2022-04-14 17:03:52 +03:00
parent 599c6821b7
commit 01506b27e9
2 changed files with 4 additions and 6 deletions

View file

@ -282,13 +282,14 @@ var CollectionTree = class CollectionTree extends LibraryTree {
// Editing input
div.classList.toggle('editing', treeRow == this._editing);
if (treeRow == this._editing) {
div.style.pointerEvents = 'auto';
label = document.createElementNS("http://www.w3.org/1999/xhtml", 'input');
label.className = 'cell-text';
label.setAttribute("size", 5);
label.value = treeRow.editingName;
label.addEventListener('input', e => this.handleEditingChange(e, index));
label.addEventListener('blur', async () => {
label.addEventListener('mousedown', (e) => e.stopImmediatePropagation());
label.addEventListener('mouseup', (e) => e.stopImmediatePropagation());
label.addEventListener('blur', async (e) => {
await this.commitEditingName();
this.stopEditing();
});

View file

@ -32,14 +32,11 @@
margin-right: 5px;
width: 100%;
font-size: inherit;
pointer-events: auto;
}
.cell-icon {
min-width: 16px;
}
}
.row.editing .cell {
pointer-events: auto;
}
}