Commit Graph
77 Commits
Author SHA1 Message Date
Steffen Becker 7a4174cd07 fix: a table cell's metrics follow LibreOffice, not the browser
Two measured deviations, both worth ~1mm a row on a fixture: a cell's first block
got the space above that LibreOffice adds nowhere in a cell, and a repeating
header row rendered centred and bold because it is a <th> and the UA says so.
Pagination's page-top-drop detection now skips cell leaves, or the space that
is never there would read as a decoration to add back.
2026-08-10 13:49:12 +00:00
Steffen Becker 7b8c7e21f5 fix: an index's entries follow the styles its own file names
The TOC rendered every level with our 0.5cm-per-level indent, an editor-only
1.5 line height and no space above — so a fixture's contents drifted 7.6mm off
LibreOffice down one page and pushed entries onto the wrong one. The per-level
entry template names a paragraph style; the rows now carry it as data-style
and the document stylesheet does the rest. Our own indents stay the fallback
for an index whose file names none.
2026-08-10 13:12:17 +00:00
Steffen Becker c26aac1bee fix: the index's leader fills its own gap, at LibreOffice's indents
Every row carried 200 dots — clipped on screen, but the clipboard, the
PDF and any measurement got all of them. Cut each to what its gap holds,
and step the levels by 0.5cm, which is what LibreOffice's Contents styles
use. The parity runner now waits for the page numbers to settle too.
2026-08-10 09:32:49 +00:00
Steffen Becker a350b8f59e fix: a page-anchored frame sits on its page instead of in the text
ODF text:anchor-type="page" is a cover graphic or a watermark: out of
flow, placed from its page's corner, behind the text. In flow, the two
full-page frames of a fixture's covers cost three pages.
2026-08-10 07:38:54 +00:00
Steffen Becker d6bc656c83 feat: the space between two blocks follows the document's own model
LibreOffice adds the upper block's space-below to the lower one's
space-above, and drops the space-above where a page break put the block
at a page top — but for a Word document it takes only the larger of the
two (all probed against soffice). CSS margins can only collapse, so
space-before rides --space-before and editor.css renders it as padding
('add') or margin ('max'); the model is read from settings.xml, assumed
for DOCX, and written back on ODF export.
2026-08-09 16:53:13 +00:00
Steffen Becker 30b5b7890e feat: a header's page background paints behind the page it belongs to
A positioned frame in a header is out of flow — the title-page background or
watermark. It keeps its wrap and its offset from the page corner, and the
layer paints it per page under the body instead of flowing it inline, where
it reserved a page-tall line of body space.

The page surface moves from .tiptap to .paper so the image has a layer
between the sheet and the text; ODF export writes it back page-anchored.
2026-08-09 15:13:46 +00:00
Steffen Becker 8c15f37490 fix: nothing is drawn past the edge of the sheet
A formula wider than the text area painted over the app background
instead of being cut at the page edge, where LibreOffice cuts it
(thesis fixture, page 16). `overflow-x: clip` so .paper does not
become a scroll box.
2026-08-09 05:59:58 +00:00
Steffen Becker 3154a9b7a2 feat: a list label takes the alignment the file gives it
Word's w:lvlJc / ODF's fo:text-align on the level: set right, the label grows
into the margin instead of over the text it labels. That is what the built-in
Roman numberings use, and a fixture's numerals collided without it.
2026-08-08 23:09:58 +00:00
Steffen Becker ee1b0dd180 fix: a line's extra leading sits below it, not half above
A spacing above single puts all of its leading after the line (probed against
LibreOffice at 150%); CSS splits it. The block is shifted back up by that half,
which leaves the flow — and pagination — where it was.
2026-08-08 22:51:56 +00:00
Steffen Becker ee56a348ee feat: formulas can be inserted and edited, and survive both formats
A formula node stores only its LaTeX source; the MathML on screen, the ODF
formula object and Word's OMML are derived from it, and both importers parse
foreign markup back into that source, so an imported formula stays editable.

Word documents were losing their formulas outright: m:oMath sits beside the w:r
runs in its own namespace, past convertInline's `namespaceURI !== W` guard.
2026-08-08 21:50:36 +00:00
Steffen Becker ae2290e22c feat: a header or footer keeps its own tab stops
The left⇥centre⇥right layout every letterhead uses rides on them, and a
zone had none: Word keeps them on the Header style, ODF on the zone
paragraph's, and neither was read or written.

An inactive zone is static generateHTML output no plugin reaches, so it
is measured straight on the DOM. Two bugs surfaced doing it: a segment
its own advance had pushed onto the next line measured as wrapped, and
the alignment then had no way back — it takes the sum of the segment's
client rects now. And the scale came from offsetHeight, which rounds
half a percent away on a zone one line tall.
2026-08-08 15:13:58 +00:00
Steffen Becker ea39dde58b 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.
2026-08-08 14:40:26 +00:00
Steffen Becker 63149d52d7 feat: a list marker sits at the level's hanging indent
CSS gives ::marker no position, so Chromium set it flush against the
text — about 4mm right of where Word and LibreOffice draw it. The marker
is now the item block's ::before, placed at the hanging indent both
exports already write (LIST_HANGING_CM 0.635cm): measured against LO's
own render, the three bullet levels land within 0.04mm.

Out of flow, because in flow it grew every list line by a pixel and cost
a fixture fixture a page. `list-style: none` drops only the marker box,
so the list-item counter and <ol start> keep numbering; a bullet's own
char rides an inherited property, since attr() in a pseudo would read the
block rather than the list.
2026-08-08 12:57:24 +00:00
Steffen Becker 09d8cf20b8 fix: break a word that is wider than its line
A long URL or a German compound ran straight past the right margin, where
Word and LibreOffice break it — measured against LO in a 2cm column, the
break now falls on the same character.

`break-word` rather than `anywhere`, so a table column's minimum width is
still its longest word.
2026-08-08 12:35:05 +00:00
Steffen Becker 77980e4b9c fix: a block ending in a hard break is not a line taller
The reserved paragraph mark is inline content past the block's last BR,
so it opened a line of its own: LibreOffice set the next paragraph 4.7mm
higher than we did, and a fixture paid for every one of them.

The empty-block rule already pulled the mark out of flow for exactly this
reason — it now covers any block that ends in a break, seating the glyph
on the last line rather than the first.
2026-08-08 12:25:22 +00:00
Steffen Becker db0fe71cdb feat: a table keeps the cell margins its file gave it
The cell padding was a constant in three places that disagreed with each
other, so a narrow column lost 0.38cm it did not have: a bibliography
marker column of 0.71cm wrapped "[2] " onto three lines and every entry
grew with it, costing a fixture a whole page.

The table now carries its own margins (w:tblCellMar, direct or from the
table style; fo:padding on the ODF cell style) and both exports write
them back. A side within a twentieth of a millimetre of the default is
the default, or Word's 108 twips would tag every table.
2026-08-08 12:18:16 +00:00
Steffen Becker 5549d625f7 feat: the index reads like the one a word processor generates
Its leader is real dots now, not a border, so it scales with the font and
reaches the PDF as text. Title and entries follow the document's Heading 1
and default style, which is what the index styles of Word and LO are based on.
2026-08-08 09:33:25 +00:00
Steffen Becker c82a78cc6a feat: character spacing, and a line box that multiplies its two halves
Word's Title style tightens by -0.5pt, so a title came out ~3mm wide of
LibreOffice's. letterSpacingPt joins TextProps and rides both formats
(w:spacing, fo:letter-spacing).

Line spacing needed the same care: it is proportional to the font's natural
line height, so the factor and that height are now separate CSS variables and
editor.css multiplies them in one place. Before, whichever of the two was
declared nearer simply overwrote the other — a block carrying its own font
silently dropped the style's spacing.
2026-08-08 08:30:05 +00:00
Steffen Becker c34fb4312a fix: drop the trailing-break line after an inline atom
A paragraph holding an image rendered a line taller than it does anywhere
else: under white-space: pre-wrap the browser already shows the last line, so
ProseMirror's hack BR adds an empty one. The hack is kept where it earns its
keep — after a real break it carries the caret onto the empty line, and in an
empty block it is the only line box there is.
2026-08-08 08:30:04 +00:00
Steffen Becker 943a885754 feat: carry the item's formatting into its list marker
The marker took only the weight of the item's first text portion. It now takes
the family, slant, size and color too — as custom properties on every item,
since they inherit and a nested item must not take its parent's.

A named paragraph style reaches it a second way: the marker inherits the list
item's own font, and the document stylesheet only styled the item's paragraph,
so an imported document whose Standard style is Arial drew its numbers in the
editor's serif default. styleCss now emits the style's text half for the item
too (li:has(> …)).

Both file formats carry marker formatting per level, so a level definition is
written only for a list whose items agree: ODF mints a character style the level
points at, DOCX the level's w:rPr. A mixed list gets none on purpose, so
LibreOffice keeps applying its own first-portion rule.
2026-08-07 20:26:44 +00:00
Steffen Becker 0b54f6cc44 feat: render a list marker bold when the item starts bold
A bold mark sits inside the item's paragraph and never reaches ::marker, so the
roman numerals of a numbered heading stayed light while their text was bold.
A plugin tags such items and editor.css weights the marker. The trigger is the
first text portion, which is the rule LibreOffice numbering itself uses.
2026-08-07 17:41:09 +00:00
Steffen Becker 7c09727cda docs: remove word as placeholder for general text editor 2026-08-07 18:08:20 +02:00
Steffen Becker 7d4a0b256e fix: indent list levels by the step both exporters write
Lists were padded 1.5rem per level on screen while the DOCX and ODT
exports place item text at LIST_LEFT_STEP_CM (1.27cm) per level, so the
editor disagreed with its own output and with Word and LibreOffice by
6.4mm on the first level, doubling with each nesting level.
2026-08-06 20:01:23 +00:00
Steffen Becker 275a77564e fix: use Word's asymmetric cell padding for tables
Cells padded 0.1cm on all sides; Word and LibreOffice use 0.19cm left and
right and none top or bottom. Text sat 0.7mm too far left and every row
was 2mm too tall, so the offset accumulated down a table.

odf-kit only writes the fo:padding shorthand, which ODF defines as a
single length — LibreOffice drops a two-value form — so the export
expands it per side.
2026-08-06 19:26:56 +00:00
Steffen Becker 6c256c6533 fix: add pre-wrap for line-end space 2026-08-06 20:46:17 +02:00
Steffen Becker ca4fbd422b feat: table margin edge resize 2026-07-31 17:46:26 +02:00
Steffen Becker ac9d6cdcff feat: named paragraph styles with inheritance 2026-07-28 23:53:00 +02:00
Steffen Becker d461ce09a6 fix: align styles and headings to libreoffice 2026-07-28 22:45:24 +02:00
Steffen Becker 56f884a412 feat: dropdown for text styles 2026-07-27 20:35:55 +02:00
Steffen Becker f1ba14c948 feat: add paragraph frames and background 2026-07-19 16:34:23 +02:00
Steffen Becker cf665e25a0 fix: stop formatting marks from moving text 2026-07-17 07:51:58 +02:00
Steffen Becker 6535d4c58d fix: page breaks, empty lines, ... 2026-07-15 22:19:49 +02:00
Steffen Becker 0526579f2b fix: text field frame 2026-07-10 16:25:20 +02:00
Steffen Becker de283adab5 feat: introduce columns 2026-07-08 19:17:16 +00:00
Steffen Becker e44f09ef42 feat: proper ordered list cycling 2026-07-05 11:51:07 +02:00
Steffen Becker b20ea051ad style: introduce island toolbar 2026-07-04 23:19:01 +02:00
Steffen Becker d018092cce feat: improve ordered list 2026-07-04 21:45:05 +02:00
Steffen Becker 3b7e7606bb feat: bullet symbols 2026-07-04 17:14:54 +02:00
Steffen Becker 0aa9399f93 feat: textbox and shapes 2026-07-03 22:53:38 +02:00
Steffen Becker a5bb2deaa2 feat: table of content 2026-07-01 21:17:44 +02:00
Steffen Becker 418f152d4b feat: header row toggle 2026-06-28 12:23:41 +02:00
Steffen Becker 3b299809e1 feat: search and replace 2026-06-28 00:05:37 +02:00
Steffen Becker 98e7ee2458 feat: add hyperlinks 2026-06-27 19:55:56 +02:00
Steffen Becker 20706c80cb feat: image image text wrapping 2026-06-24 21:49:59 +02:00
Steffen Becker f79be768f9 feat: add image width height adaption and rotation 2026-06-24 21:49:59 +02:00
Steffen Becker 64ae976ecf feat: insert images 2026-06-21 12:14:10 +02:00
Steffen Becker 8e8b93bccf fix: list indent buttons 2026-06-21 11:16:59 +02:00
Steffen Becker 0a35a65c83 feat: add spell-check 2026-06-18 23:34:45 +02:00
Steffen Becker 69cb74c824 feat: different types of ordered list 2026-06-10 23:42:08 +02:00
Steffen Becker c641dda4e0 feat: switch from css zoom (rerunning layout at every scale) to pure view transform (more stable) 2026-06-09 10:18:39 +02:00