discourse/plugins/footnote/assets/stylesheets/footnotes.scss
Kris 654676f947
UX: allow inline-footnote content to shrink-to-fit (#35633)
Some content like `pre` and `code` needs to know it can shrink to avoid
overflow (we already have overflow wrap present)

Before:
<img width="500" alt="image"
src="https://github.com/user-attachments/assets/2910ab3d-fa65-42cb-bcc4-2e204625e141"
/>


After: 
<img width="500" alt="image"
src="https://github.com/user-attachments/assets/30f9c769-480a-4368-98b7-287c7424e252"
/>
2025-10-27 14:15:33 -04:00

105 lines
2 KiB
SCSS
Vendored

.inline-footnotes {
counter-reset: inline-footnote;
a.expand-footnote {
user-select: none;
display: inline-block;
&::after {
padding: 0 0.125em;
display: inline-block;
content: "[" counter(inline-footnote) "]";
vertical-align: super;
font-size: 0.75rem;
line-height: 1;
counter-increment: inline-footnote;
}
}
.inline-footnote {
display: inline-block;
}
// This is hack to work with lazy-loading, we will trick the browser
// to believe the image is in the DOM and can be loaded
.footnotes-list,
.footnotes-sep {
position: absolute;
// the left/right positioning prevents overflow issues
// with long words causing overflow on small screens
left: 0;
right: 0;
}
.footnotes-sep,
.footnotes-list,
.footnote-ref {
display: none;
}
}
.fk-d-tooltip__content[data-identifier="inline-footnote"] {
overflow-wrap: break-word;
font-size: var(--font-down-1);
.footnote-backref {
display: none;
}
img {
object-fit: cover;
max-width: 100%;
}
p {
margin: 0;
min-width: 0;
}
}
.ProseMirror {
counter-reset: prosemirror-footnote;
.footnote {
display: inline-block;
&::after {
padding: 0 0.125em;
display: inline-block;
content: "[" counter(prosemirror-footnote) "]";
vertical-align: super;
font-size: 0.75rem;
line-height: 1;
counter-increment: prosemirror-footnote;
}
}
.footnote-tooltip {
cursor: auto;
position: absolute;
max-height: 40%;
overflow: auto;
left: 0;
right: 0;
bottom: 0;
margin: 0.5rem;
padding-top: 0.5rem;
background-color: var(--primary-50);
border-radius: var(--d-border-radius);
z-index: z("modal", "tooltip");
&:focus-within {
outline: 1px solid var(--content-border-color);
}
&::before {
top: 0.1rem;
left: 0.25rem;
position: absolute;
content: "[" var(--footnote-counter) "]:";
font-size: 0.75rem;
color: var(--primary-low-mid);
}
}
}