parent
12b6645a1f
commit
fbfe4b2dfa
1 changed files with 8 additions and 9 deletions
|
@ -1717,16 +1717,15 @@ var Zotero_QuickFormat = new function () {
|
||||||
let { lastBubble, startOfTheLine } = getLastBubbleBeforePoint(clickX, clickY);
|
let { lastBubble, startOfTheLine } = getLastBubbleBeforePoint(clickX, clickY);
|
||||||
// If click happened right before another input, focus that input
|
// If click happened right before another input, focus that input
|
||||||
// instead of adding another one. There may be a br node on the way, so we have to check
|
// instead of adding another one. There may be a br node on the way, so we have to check
|
||||||
// more than just the next node.
|
// more than just the next node. If there is no lastBubble and there is an input
|
||||||
if (lastBubble) {
|
// at the start of the editor, focus it.
|
||||||
let nextNode = lastBubble.nextElementSibling;
|
let nextNode = lastBubble ? lastBubble.nextElementSibling : editor.firstChild;
|
||||||
while (nextNode && !nextNode.classList.contains("bubble")) {
|
while (nextNode && !nextNode.classList.contains("bubble")) {
|
||||||
if (isInput(nextNode)) {
|
if (isInput(nextNode)) {
|
||||||
nextNode.focus();
|
nextNode.focus();
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
nextNode = nextNode.nextElementSibling;
|
|
||||||
}
|
}
|
||||||
|
nextNode = nextNode.nextElementSibling;
|
||||||
}
|
}
|
||||||
let newInput = _createInputField();
|
let newInput = _createInputField();
|
||||||
let currentInput = _getCurrentInput() || _lastFocusedInput;
|
let currentInput = _getCurrentInput() || _lastFocusedInput;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue