From 01506b27e9f77fb28a540c3492d0435919f58380 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adomas=20Ven=C4=8Dkauskas?= Date: Thu, 14 Apr 2022 17:03:52 +0300 Subject: [PATCH] Allow moving cursor by clicking on collection name while editing Closes #2513 --- chrome/content/zotero/collectionTree.jsx | 5 +++-- scss/components/_collection-tree.scss | 5 +---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/chrome/content/zotero/collectionTree.jsx b/chrome/content/zotero/collectionTree.jsx index d04a0a8af7..c5e2f21f91 100644 --- a/chrome/content/zotero/collectionTree.jsx +++ b/chrome/content/zotero/collectionTree.jsx @@ -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(); }); diff --git a/scss/components/_collection-tree.scss b/scss/components/_collection-tree.scss index 97440bcb66..0c1a0f5efe 100644 --- a/scss/components/_collection-tree.scss +++ b/scss/components/_collection-tree.scss @@ -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; - } } \ No newline at end of file