Files
llink/js/desktop/src/features/compose/markdown-editor.css
T
Arjun Patel ca3bbf204e fix: text compose papercuts (#270)
* make fixes

* cleanup
2026-06-11 12:08:34 -07:00

155 lines
4.6 KiB
CSS

/* Theme Milkdown Crepe to blend into the app's translucent "glass" surfaces.
* Crepe's frame-dark theme is a grayscale palette driven by --crepe-* custom
* properties; we override those to white-on-transparent with a blue accent so
* the editor (and the read-only display, which uses the same engine) sits on
* top of the existing card instead of painting its own opaque background.
*
* The floating menus (slash menu, selection toolbar, link tooltip) are portaled
* to <body>, OUTSIDE .milkdown — so the variables must be declared on those
* selectors too, otherwise they fall back to transparent and the menu is
* unreadable over the content behind it. */
.llink-crepe .milkdown,
.milkdown-slash-menu,
.milkdown-toolbar,
.milkdown-link-edit,
.milkdown-link-preview,
.milkdown-block-handle {
--crepe-color-background: transparent;
--crepe-color-on-background: rgb(255 255 255 / 0.92);
/* Surface backs code blocks, tables, and the floating menus — keep it
* (near-)opaque so menus read clearly over content. */
--crepe-color-surface: rgb(24 24 28 / 0.96);
--crepe-color-surface-low: rgb(42 42 50 / 0.96);
--crepe-color-on-surface: #ffffff;
--crepe-color-on-surface-variant: rgb(255 255 255 / 0.65);
--crepe-color-outline: rgb(255 255 255 / 0.2);
--crepe-color-primary: #60a5fa;
--crepe-color-secondary: rgb(96 165 250 / 0.25);
--crepe-color-on-secondary: #ffffff;
--crepe-color-inverse: #ffffff;
--crepe-color-on-inverse: #0b0b0b;
--crepe-color-inline-code: #fca5a5;
--crepe-color-inline-area: rgb(255 255 255 / 0.1);
--crepe-color-error: #f87171;
--crepe-color-hover: rgb(255 255 255 / 0.08);
--crepe-color-selected: rgb(96 165 250 / 0.25);
/* Use the application font, not Crepe's bundled Noto Sans / Noto Serif. */
--crepe-font-default: inherit;
--crepe-font-title: inherit;
--crepe-font-code:
ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, 'Liberation Mono',
monospace;
}
/* Glassy floating menus over content. */
.milkdown-slash-menu,
.milkdown-toolbar,
.milkdown-link-edit,
.milkdown-link-preview {
backdrop-filter: blur(12px);
}
.llink-crepe .milkdown {
background: transparent;
box-shadow: none;
}
.llink-crepe .milkdown .ProseMirror {
padding: 0;
outline: none;
caret-color: white;
}
/* Crepe's default heading scale (42px h1) is sized for a document editor;
* tighten it to message-card proportions. Applies to compose and read-only
* alike so the editing view matches the posted card. */
.llink-crepe .milkdown .ProseMirror h1 {
font-size: 1.875rem;
line-height: 2.375rem;
font-weight: 600;
margin-top: 24px;
}
.llink-crepe .milkdown .ProseMirror h2 {
font-size: 1.5rem;
line-height: 2rem;
font-weight: 600;
margin-top: 20px;
}
.llink-crepe .milkdown .ProseMirror h3 {
font-size: 1.25rem;
line-height: 1.75rem;
font-weight: 600;
margin-top: 16px;
}
.llink-crepe .milkdown .ProseMirror h4 {
font-size: 1.125rem;
line-height: 1.625rem;
font-weight: 600;
margin-top: 12px;
}
.llink-crepe .milkdown .ProseMirror h5 {
font-size: 1rem;
line-height: 1.5rem;
font-weight: 600;
margin-top: 12px;
}
.llink-crepe .milkdown .ProseMirror h6 {
font-size: 0.875rem;
line-height: 1.375rem;
font-weight: 700;
margin-top: 12px;
color: rgb(255 255 255 / 0.7);
}
.llink-crepe .milkdown .ProseMirror > :first-child {
margin-top: 0;
}
/* Images come from URLs only (no stable public upload URL), so hide the
* file uploader — the placeholder then just prompts for a link. */
.llink-crepe
.milkdown
:is(.milkdown-image-block, .milkdown-image-inline)
.placeholder
.uploader {
display: none;
}
/* Read-only renders the image node view with inert editing chrome — hide it. */
.llink-crepe:not(.llink-crepe--fill) .milkdown .milkdown-image-block .operation,
.llink-crepe:not(.llink-crepe--fill)
.milkdown
.milkdown-image-block
.image-resize-handle {
display: none;
}
.llink-crepe .milkdown .milkdown-image-block img {
border-radius: 8px;
}
/* Editing context: fill the compose card and scroll internally so a long
* message stays inside the card rather than growing the whole overlay. */
.llink-crepe--fill,
.llink-crepe--fill .milkdown {
height: 100%;
}
.llink-crepe--fill .milkdown {
overflow-y: auto;
}
/* Pad the content (not the card) so the slash menu — which Crepe appends to
* .milkdown — can use the full card width/height before clipping. The shared
* layout variables (globals.css) keep the editor's content column identical
* to the posted card's, and the gutter fits the block drag handle. */
.llink-crepe--fill .milkdown .ProseMirror {
min-height: 100%;
padding: var(--message-card-padding) var(--message-editor-gutter);
}