From 09dead3a2a49428017f8fbd3a5fa5623a341506f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adomas=20Ven=C4=8Dkauskas?= Date: Thu, 16 Jan 2020 10:58:28 +0200 Subject: [PATCH] Fix more ways that citation dialog textcursor can end up inside bubbles See 5a1e3296, 5fa97957 --- .../content/zotero/integration/quickFormat.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/chrome/content/zotero/integration/quickFormat.js b/chrome/content/zotero/integration/quickFormat.js index 1d0edc09c0..cbcf0a8d1a 100644 --- a/chrome/content/zotero/integration/quickFormat.js +++ b/chrome/content/zotero/integration/quickFormat.js @@ -1100,6 +1100,8 @@ var Zotero_QuickFormat = new function () { return node; } } + } else if (container.parentNode.dataset && container.parentNode.dataset.citationItem) { + return container.parentNode; } } return null; @@ -1195,7 +1197,22 @@ var Zotero_QuickFormat = new function () { selection.removeAllRanges(); selection.addRange(nodeRange); } + } else if (["Home", "End"].includes(event.key)) { + setTimeout(() => { + right = event.key == "End"; + bubble = _getSelectedBubble(right); + if (bubble) { + event.preventDefault(); + var nodeRange = qfiDocument.createRange(); + nodeRange.selectNode(bubble); + nodeRange.collapse(!right); + + var selection = qfiWindow.getSelection(); + selection.removeAllRanges(); + selection.addRange(nodeRange); + } + }) } else if(keyCode === event.DOM_VK_UP && referencePanel.state === "open") { var selectedItem = referenceBox.selectedItem;