feat: a tab lands on the file's own grid, and can draw its leader

The default tab interval was fixed at 1.25cm, so a file's own
w:defaultTabStop / style:tab-stop-distance was ignored and the DOCX
export wrote 1.25 back over Word's 1.27. It is a document setting now.

A stop can also carry the character it repeats across its gap. odf-kit
has no leader option and mints one automatic style per option set, so
the leader rides style:type behind a sentinel — matching on position
and alignment alone gave every stop at 6cm the same leader, which
LibreOffice drew back plain as day.
This commit is contained in:
Steffen Becker committed 2026-08-08 14:40:26 +00:00
1 parent 6accc7268f
commit ea39dde58b
20 files changed
+319 -39

No files matched your search

+29 -2
View File
@@ -376,9 +376,36 @@
margin-bottom: 0;
}
/* Tab stops every 1.25cm, matching ODF's default tab interval. */
/* A tab stop's leader fills the gap the measuring plugin left as margin-left. The span
is zero-width (tab-size:0), so its right padding edge is where the stop sits. */
.paper .tiptap .tab-leader {
position: relative;
}
.paper .tiptap .tab-leader::before {
position: absolute;
right: 0;
top: 0;
width: var(--leader-w, 0);
overflow: hidden;
white-space: pre;
line-height: inherit;
pointer-events: none;
/* Long enough to outrun any gap A4 can hold; the box clips the rest. */
content: '................................................................................................................................................................................................................';
}
.paper .tiptap .tab-leader[data-leader='-']::before {
content: '----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------';
}
.paper .tiptap .tab-leader[data-leader='_']::before {
content: '____________________________________________________________________________________________________________________________________________________________________________________________________________';
}
.paper .tiptap .tab-leader[data-leader='·']::before {
content: '····································································································································································································································';
}
/* The document's own tab interval (storage/tabInterval.ts), LibreOffice's by default. */
.paper .tiptap {
tab-size: 1.25cm;
tab-size: var(--tab-interval, 1.25cm);
/* prosemirror-view sets `break-spaces`, which forbids a line-end space from
hanging into the margin, so lines break one word earlier than in
Word/LibreOffice. `pre-wrap` lets it hang, as they do. */