zotero/scss/elements/_bubbleInput.scss
abaevbog 1f9d9d2967
citation dlg: updates to locator shortcuts (#5529)
- after a new bubble is added to the citation, it is recorded
as a just-added bubble. The next locator typed without a search query
will go to that item instead of going to the item before where the locator was typed.
Same logic applies when multiple bubbles are added at once.
- the record of just-added bubbles is cleared on focusout
or keypress of an arrow key. That way, it's discarded if the user
is almost certainly not intending to immediately type a locator.
- added a special case to recognize a numeric value as a page locator
if it is typed when just-added bubble is recorded. That special locator
will be added to the just-added bubble as one is typing without
pressing Enter after debounce. Enter will immediately add the locator
without waiting for debounce.
- if a just-added bubble is recorded, cmd-z will clear
whatever numeric locator may have been typed and place
it back into the input, in case one meant to type an
actual search query

- added a special case to recognize ":<number>" as a page locator
in the same circumstances that "page <number>" is currently recognized
- do not use year extraction (SearchHandler._cleanYear)
when parsing input. It strips the first number from
a range of numbers and conflicts with the new locator
logic.
- ensure a bubble with a very long locator does not overflow
2026-01-26 20:12:44 -05:00

110 lines
2.8 KiB
SCSS

bubble-input {
min-width: 200px;
-moz-window-dragging: no-drag;
--bubble-height: 28px;
--bubble-horizontal-margin: 2px;
--bubble-rows-gap: 5px;
.body {
display: flex;
flex-flow: row wrap;
align-items: center;
align-content: start;
row-gap: var(--bubble-rows-gap);
min-height: 28px;
width: 100%;
padding-inline-end: 6px;
// height is limited to 5.5. rows of bubbles
max-height: calc(5.5 * (var(--bubble-height) + var(--bubble-rows-gap)));
overflow-y: auto;
scrollbar-color: var(--color-scrollbar) var(--color-scrollbar-background);
// to get proper width by getContentWidth in bubbleInput.js
span {
white-space: pre;
}
cursor: text;
font-size: 15px;
-moz-window-dragging: no-drag;
// increase the clickable area before each bubble a bit
padding-inline-start: 5px;
margin-inline-start: -5px;
// a bit of padding so that focusring of bubbles is not cutoff
padding-top: 1px;
padding-bottom: 1px;
}
input {
outline: none;
border: none !important;
height: var(--bubble-height);
/* Keep the background and text color unchanged in dark mode */
background-color: transparent !important;
padding: 0;
margin: 0;
// input occupying the entire width for when there are not bubbles at all
&.full-width {
width: 100% !important;
}
// inputs initially occupy no width so they don't misalign bubbles at the
// start of each line. On focus, set their width for the cursor to appear
// and offset it by negative margin to avoid bubbles shifting
&.empty:not(.full-width):focus {
min-width: 1px;
margin-inline-start: -1px;
}
}
.bubble {
@media not (-moz-platform: windows) {
@include focus-ring(true);
}
height: var(--bubble-height);
border-radius: 5px;
padding: 0 8px;
margin: 0 var(--bubble-horizontal-margin);
display: flex;
flex-direction: row;
align-items: center;
white-space: nowrap;
-moz-user-select: none;
position: relative;
cursor: pointer;
background-color: var(--fill-quinary);
// don't let the bubble with a very long locator stretch bubble-input
overflow-x: hidden;
&:hover:not(.showingDetails) {
background-color: var(--fill-quarternary);
}
&.showingDetails {
background-color: var(--fill-quarternary) !important;
}
&.drop-before::before, &.drop-after::after {
content: "";
display: block;
margin-left: -1px;
height: 14px;
border-left: 1px solid var(--fill-primary);
position: absolute;
}
&.drop-before::before {
left: calc(-1 * var(--bubble-horizontal-margin));
}
&.drop-after::after {
right: calc(-2 * var(--bubble-horizontal-margin));
}
// highlight bubbles whose item is currently selected by the user
&.has-item-selected {
background-color: var(--accent-blue10);
}
.dropmarker {
margin-inline-start: 4px;
}
}
}