mirror of
https://github.com/discourse/discourse.git
synced 2026-08-05 19:53:47 +08:00
Previously, the composer's "Headings" toolbar button only offered heading levels and a paragraph reset, with no built-in way to insert smaller text. This change renames the button to "Text sizes" and adds a "Small" option that wraps the selection in `<small>` tags. It toggles on/off and highlights the active state in both the plain textarea and rich (ProseMirror) editors, reusing the existing `<small>` inline HTML support. <img width="582" height="582" alt="CleanShot 2026-07-24 at 14 15 57@2x" src="https://github.com/user-attachments/assets/9e76c1d3-bea9-4f3c-a159-7e27ac725217" /> It re-uses the same icon as `paragraph` does, for lack of a better option. The differentiating element is that paragraph doesn't have an active highlight and small does: <img width="1552" height="504" alt="CleanShot 2026-07-24 at 14 16 49@2x" src="https://github.com/user-attachments/assets/981fc522-5c64-42d8-acba-f7dc2ee6d808" /> --------- Co-authored-by: Renato Atilio <renato@discourse.org>
202 lines
4 KiB
SCSS
Vendored
202 lines
4 KiB
SCSS
Vendored
@use "lib/viewport";
|
|
|
|
.fk-d-menu[class*="toolbar-menu"] {
|
|
z-index: z("composer", "dropdown");
|
|
|
|
@include viewport.from(sm) {
|
|
// making sure it's only limited in height on floating menu, not mobile menu
|
|
&.fk-d-menu {
|
|
max-height: 30vh;
|
|
}
|
|
}
|
|
|
|
.fk-d-menu__inner-content {
|
|
flex-direction: column;
|
|
|
|
--fade-height: 2.5em;
|
|
|
|
&::before,
|
|
&::after {
|
|
content: "";
|
|
position: sticky;
|
|
display: block;
|
|
flex-shrink: 0;
|
|
height: var(--fade-height);
|
|
pointer-events: none;
|
|
opacity: 0;
|
|
z-index: 1;
|
|
}
|
|
|
|
&::before {
|
|
top: 0;
|
|
margin-bottom: calc(var(--fade-height) * -1);
|
|
background: linear-gradient(to top, transparent, var(--secondary));
|
|
}
|
|
|
|
&::after {
|
|
bottom: 0;
|
|
margin-top: calc(var(--fade-height) * -1);
|
|
background: linear-gradient(to bottom, transparent, var(--secondary));
|
|
}
|
|
}
|
|
|
|
&.--scroll-top .fk-d-menu__inner-content::before,
|
|
&.--scroll-bottom .fk-d-menu__inner-content::after {
|
|
opacity: 1;
|
|
}
|
|
|
|
.fullscreen-composer & {
|
|
z-index: z("header") + 1;
|
|
}
|
|
|
|
// eventho mobile composer shouldnt be used in conjuction with fk-d-menu (floating version), on tablets the possibility unfortunately exists
|
|
.discourse-touch & {
|
|
z-index: z("mobile-composer");
|
|
}
|
|
|
|
.shortcut {
|
|
line-height: 1;
|
|
vertical-align: middle;
|
|
|
|
&.--apple {
|
|
letter-spacing: 0.25em;
|
|
padding-right: 0.35em;
|
|
}
|
|
|
|
@include viewport.until(sm) {
|
|
display: none;
|
|
}
|
|
}
|
|
}
|
|
|
|
.fk-d-menu[class*="toolbar-menu"] .dropdown-menu__header {
|
|
padding: var(--space-2) 0.35em;
|
|
color: var(--primary-medium);
|
|
font-size: var(--font-down-1-rem);
|
|
}
|
|
|
|
.toolbar-menu__options-content,
|
|
.toolbar-menu__list-content,
|
|
.toolbar-menu__heading-content {
|
|
.dropdown-menu {
|
|
.btn {
|
|
&.--active {
|
|
.d-button-label__active-icon {
|
|
visibility: visible;
|
|
margin-left: auto;
|
|
}
|
|
}
|
|
}
|
|
|
|
.d-button-label {
|
|
display: flex;
|
|
flex: 1;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
min-width: 0; // shrink if needed
|
|
|
|
&__active-icon {
|
|
visibility: hidden;
|
|
}
|
|
|
|
.shortcut {
|
|
margin-left: var(--space-4);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
.toolbar-menu__heading-content,
|
|
.toolbar-menu__list-content {
|
|
.dropdown-menu {
|
|
.btn {
|
|
&:hover,
|
|
&:focus,
|
|
&:focus-visible {
|
|
.shortcut {
|
|
display: block;
|
|
}
|
|
|
|
.d-button-label__active-icon {
|
|
visibility: hidden;
|
|
}
|
|
}
|
|
}
|
|
|
|
.d-button-label {
|
|
position: relative;
|
|
flex-grow: 1;
|
|
display: flex;
|
|
align-items: center;
|
|
gap: var(--space-4);
|
|
|
|
&__active-icon {
|
|
visibility: hidden;
|
|
}
|
|
|
|
&__text {
|
|
padding-right: var(--space-8); // extra spacing for the shortcut
|
|
}
|
|
|
|
.shortcut {
|
|
position: absolute;
|
|
right: 0;
|
|
top: 50%;
|
|
transform: translateY(-50%);
|
|
display: none;
|
|
margin: 0;
|
|
font-size: var(--font-down-1-rem);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
.toolbar-menu__heading-content {
|
|
.dropdown-menu {
|
|
.btn[data-name="heading-1"] {
|
|
.d-button-label__text,
|
|
.d-icon[class*="d-icon-discourse"] {
|
|
font-size: var(--font-up-2-rem);
|
|
font-weight: bold;
|
|
}
|
|
}
|
|
|
|
.btn[data-name="heading-2"] {
|
|
.d-button-label__text,
|
|
.d-icon {
|
|
font-size: var(--font-up-1-rem);
|
|
font-weight: bold;
|
|
}
|
|
}
|
|
|
|
.btn[data-name="heading-3"] {
|
|
.d-button-label__text,
|
|
.d-icon {
|
|
font-size: var(--font-0);
|
|
font-weight: bold;
|
|
}
|
|
}
|
|
|
|
.btn[data-name="heading-4"] {
|
|
.d-button-label__text,
|
|
.d-icon {
|
|
font-weight: bold;
|
|
font-size: var(--font-down-1-rem);
|
|
}
|
|
}
|
|
|
|
.btn[data-name="heading-paragraph"] {
|
|
.d-button-label__text,
|
|
.d-icon {
|
|
font-size: var(--font-down-1-rem);
|
|
}
|
|
}
|
|
|
|
.btn[data-name="heading-small"] {
|
|
.d-button-label__text,
|
|
.d-icon {
|
|
font-size: var(--font-down-2-rem);
|
|
}
|
|
}
|
|
}
|
|
}
|