mirror of
https://github.com/docmost/docmost.git
synced 2026-08-28 17:27:06 +08:00
fix(base): align inline-embed AddRowButton to page-content edge like standalone
In embed mode the "+ New row" button rendered to the right of the
data columns instead of at the page-content edge (where it lives in
standalone). Two compounding causes:
- position: sticky with inset-inline-start:
var(--embed-grid-pad-left, 0). Sticky offsets are measured from
the scroll-port, not the bodyGrid's outer edge — and the scroll-
port already starts at the page-content edge (bodyGrid's negative
margins and equal padding cancel out). With the variable set to
~200px in embed, sticky shifted the button 200px *into* the
scroll-port. inset-inline-start: 0 keeps it at the scroll-port's
start in both modes.
- max-content grid item with default justify-self: stretch on a
grid-column: 1 / -1 area has surprising placement; `justify-self:
start` makes the inline-start anchoring explicit.
Standalone behavior is unchanged (the variable was 0 there anyway).
This commit is contained in:
@@ -305,13 +305,18 @@
|
|||||||
* `grid-column: 1 / -1` it would auto-place into track 1 of a new
|
* `grid-column: 1 / -1` it would auto-place into track 1 of a new
|
||||||
* grid row, leaving phantom empty cells in the remaining tracks of
|
* grid row, leaving phantom empty cells in the remaining tracks of
|
||||||
* that row. Spanning all tracks gives it a single full-row grid area
|
* that row. Spanning all tracks gives it a single full-row grid area
|
||||||
* while inline-flex + width:max-content + sticky-left keeps the
|
* while inline-flex + width:max-content keeps the visible button
|
||||||
* visible button shrunk to its content and anchored to the page-
|
* shrunk to its content. `justify-self: start` pins it to the
|
||||||
* content edge during horizontal scroll. --embed-grid-pad-left is
|
* inline-start of that grid area (a max-content grid item with
|
||||||
* the leftward extension distance in embed mode (sticks at page-
|
* `justify-self: stretch` — the default — has surprising placement
|
||||||
* content-left), 0 in standalone (sticks at .bodyGrid's natural
|
* across engines, so be explicit). `inset-inline-start: 0` keeps
|
||||||
* left). */
|
* the button at the scroll-port's start during horizontal scroll;
|
||||||
|
* scroll-port = bodyGrid's content area = the page-content edge in
|
||||||
|
* both standalone and embed modes (the bodyGrid's negative margins
|
||||||
|
* and equal padding cancel out, so x=0 of the content area is
|
||||||
|
* already the page-content-left). */
|
||||||
grid-column: 1 / -1;
|
grid-column: 1 / -1;
|
||||||
|
justify-self: start;
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 6px;
|
gap: 6px;
|
||||||
@@ -326,7 +331,7 @@
|
|||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
transition: background-color 150ms ease;
|
transition: background-color 150ms ease;
|
||||||
position: sticky;
|
position: sticky;
|
||||||
inset-inline-start: var(--embed-grid-pad-left, 0);
|
inset-inline-start: 0;
|
||||||
background-color: light-dark(
|
background-color: light-dark(
|
||||||
var(--mantine-color-body),
|
var(--mantine-color-body),
|
||||||
var(--mantine-color-dark-7)
|
var(--mantine-color-dark-7)
|
||||||
|
|||||||
Reference in New Issue
Block a user