Commit Graph
525 Commits
Author SHA1 Message Date
Steffen Becker 501bfe501f fix: a first visit opens the ribbon, not the floating island
The tabbed chrome is the layout users know; the stored choice still wins.
2026-08-17 20:03:06 +02:00
Steffen Becker 3ae8d27b26 fix: the build runs under a subpath, not only at the domain root
base './' emits relative asset URLs; the manifest, the service-worker
registration and sw.js's precache resolve against their own location;
the four hardcoded /image literals turn relative. Verified headless
under a simulated /edentext/ subpath: boots, types, SW scope correct.
2026-08-17 18:59:48 +02:00
Steffen Becker 9d3d120b57 feat: the About dialog pitches the app in two lines
Tagline plus one line of key points in both languages, rendered as a
centred list; the GitHub button points at the real repository.
2026-08-17 18:59:42 +02:00
Steffen Becker 847fe59d3d feat: a frame the text runs through reserves no space at all
Word's in-front-of / behind-text (wp:wrapNone + behindDoc) and ODF's
style:wrap="run-through" both read as a side float, so a near-column-wide
picture reserved its whole height and pushed the text 23-52mm down. They
are a wrap mode of their own now: out of flow at the static position it
was anchored at, z-order from the file (inFront). Both exports carry it
back; tests/unit/wrap-through.test.ts covers the round trip.
The image fixture 72 -> 38 over both formats and 7 pages -> 6, matching
the reference; corpus 1108 -> 1074, no other fixture moved.
2026-08-17 13:45:39 +02:00
Steffen Becker 9c4b768982 fix: a page is the paper's exact height, not the pixel it rounds to
The sheet boxes rounded cm × PX_PER_CM where --user-page-height keeps it
exact, and pageBreaks builds its grid from the rounded value they publish
as --pb-section-page: A4 came out 1123px against 1122.52, so every page
ran 0.127mm long and the text crept down the flow — 1.8mm by the
sixteenth page, 6.0mm by the forty-eighth, against a reference whose
footer sits at the same height on every page.
Corpus 1772 -> 1108, eight fixtures improved, none rose.
2026-08-17 13:27:46 +02:00
Steffen Becker b1b8b9de63 docs: the ODF import yardstick is the default style, and its spacing exception 2026-08-17 09:18:16 +02:00
Steffen Becker b3c52e53fc feat: an ODF paragraph reads the contextual spacing its style declares
style:contextual-spacing drops a paragraph's own spacing towards a neighbour of
the same style; LibreOffice's List styles carry it, and only the docx path read
its w:contextualSpacing counterpart. Unread, every list point kept the 8pt its
style declares and a long document accumulated a page every dozen items.

The editor has no such mode, so the suppressed side becomes an explicit 0. In a
list each item wraps its own paragraph, so the neighbour is the next item's.
2026-08-17 09:17:33 +02:00
Steffen Becker b65920f7b7 fix: a cell or list paragraph is measured against the default style
The ODF importer's yardstick for a block that can carry no style name was the
editor's own fallback, not the default paragraph style — which is what
`p:not([data-style])` re-applies. So a cell paragraph overriding its 115% line
height back to 100% was dropped as "same as the default" and rendered at 115%
anyway: 0.7mm too much on every table row. Its spacing is the one exception,
zeroed by a rule that outranks the style's, for a paragraph but not a heading.

Two fixtures' table rows: pitch 5.8mm against LibreOffice's 5.1, then 5.1.
2026-08-17 09:17:05 +02:00
Steffen Becker 7767a61b95 feat: the references tab groups its buttons the way both word processors do
Captions, index entries and citations each get their own group instead of
riding under the table-of-contents label, which said nothing about them.

The index options menu names the index it edits and lays its ten levels out
as one strip of keys — as rows they were the whole menu.
2026-08-17 00:31:27 +02:00
Steffen Becker a62fa11cc1 feat: the index options menu switches its page numbers
References ▸ Options, where the depth already lives: Word's "Show page numbers"
as a checkbox, over the pageNumbers attr both formats now carry. The menu is no
longer only levels, so its button says Options.
Its node view repainted on the entries alone, so nothing an attr changes ever
reached the rows — leader, title and level styles included. Keyed on the look
as well now, minus the cached entries the pass writes back itself.
2026-08-17 00:09:48 +02:00
Steffen Becker ac5b05e0fe feat: an index the file writes without page numbers keeps its rows text-only
Word's TOC \n and an ODF entry template naming no index-entry-page-number both
say the rows are text alone; we drew leaders and live numbers over them either
way. Carried as the node's own pageNumbers attr, off only — the node view had
the page-less row already, for the bibliography. The exports write the switch
back out: \n over the whole level range, and the ODF template drops the tab
stop with the number, which is the pair LibreOffice's dialog switches together.
2026-08-16 23:49:53 +02:00
Steffen Becker 8a9b391d76 fix: a heading keeps the bold its own run declares
Both importers drop a mark the block's style supplies, and a heading's bold was
taken as given. The registry style that renders it is the file's, though —
re-parented to Standard wherever the file declares a basedOn / parent-style-name
— so nothing supplied what the mark had been deleted for, and a 23pt title line
came out 149.7mm against LibreOffice's 161.7. Gated on that parent now; a
LibreOffice file, which writes fo:font-weight on every Heading_20_N, is
untouched. Parity corpus 1892 → 1889.
2026-08-16 23:12:34 +02:00
Steffen Becker eb3a9f95c1 feat: Word's horizontal line imports as the paragraph's rule
A v:rect flagged o:hr is the line itself, not a shape: its height and
fillcolor become the paragraph's borderBottom (1.5pt/#A0A0A0 where the file
names none), a real w:pBdr keeping precedence — only one line can be drawn.
It was dropped with the "Drawings were removed" warning until now, which the
changelog's gap list did not admit to either.
2026-08-16 22:44:40 +02:00
Steffen Becker 6c731b9233 feat: insert caption is in the picture and table tabs too
References keeps it, as in both products, but that is a tab away from the
object being captioned. The contextual tabs mount their own CaptionDialog —
it reads the caret for category and position, so the copies take no props.
2026-08-16 22:22:29 +02:00
Steffen Becker 53317bf88b i18n: the phonetic guide is called ruby text
Word and LibreOffice hide theirs unless an East Asian language is on; ours is
always in the Insert tab, so the label says what it inserts. The reading field
no longer repeats the dialog's own name.
2026-08-16 22:04:26 +02:00
Steffen Becker 14444b7169 i18n: a button that fills a library says Add, not Insert
Both the AutoText entry and the tab stop go into a list the user inserts from
later; only the cross-reference and ruby dialogs really write to the document.
2026-08-16 21:57:14 +02:00
Steffen Becker 383436439d i18n: the chromes are named Classic and Modern (beta)
The ribbon is the look users know as classic, the floating island the modern
one; beta because it has no entry point yet for comments, revisions, line
numbering or page design. Mode ids keep naming the shape.
2026-08-16 14:26:30 +02:00
Steffen Becker 2d3395137f style: the status bar follows the chrome above it
Under the ribbon it takes the same --w-* remap .ribbon gives its pickers: the
app's dark neutrals are bluer than Word's, so the two ends of the window did
not match. Classic keeps the themed set. --color-primary is the brand slate
now, so both chromes share one accent.
2026-08-16 14:19:17 +02:00
Steffen Becker b3e5a1c8a9 style: the ribbon takes the logo's colours
--w-accent is the logo's slate instead of Word's blue (5.1:1 on the chrome,
carries white), and the clay marks the contextual tabs — the pair meets where
those sit beside the normal ones. Both defined once from favicon.svg; the
label tone is darkened, the clay itself only 3.3:1 on white.
2026-08-16 14:12:30 +02:00
Steffen Becker 9b14d1654f feat: the style gallery lists heading levels 1–5 until asked for the rest
Both reference products define ten levels but only offer the first five;
visibleStyles() filters styleOrder for the gallery in either chrome, with a
session-only 'show all styles' toggle in the menu. A deeper level a block
already uses stays listed, so the caret always has an active style.
2026-08-16 14:01:30 +02:00
Steffen Becker 6987eda4fc fix: a link keeps its own paint over a baked region color
The editor's a-rule and LibreOffice's Internet Link style both outrank the
region CSS, so neither export lets the baked region color override a
non-plain link's paint: ODT leaves the color off the link run, DOCX paints
the link blue unless the run carries a direct color — the DOCX import
otherwise read its own link back as plain.
2026-08-16 13:42:30 +02:00
Steffen Becker 4c55e9b9f5 fix: imports re-derive a registry table style's regions and unbake its text
Both importers resolve the table's style name + look + grid position through
resolveTableCell: the region attr comes back on each cell, a bold region's
runs convert like headings (boldByDefault) and a run matching the region's
color loses that mark — the style's own text no longer lands as direct
formatting on reopen. A DOCX file carrying its own w:tblStylePr keeps the
baked areas instead; a style name not in the registry stays untouched.
2026-08-16 13:42:24 +02:00
Steffen Becker 6789377b48 fix: DOCX carries the citation style and an all-off table look
The b:Sources part is also the citation style's only carrier, so a document
whose bibliography index sets a non-default style writes it even with no
source cited. The importer keeps a declared all-off w:tblLook ('') instead
of dropping it back to the default look.
2026-08-16 13:17:47 +02:00
Steffen Becker 6a36b89c18 fix: ODT indexes and shape boxes read back clean
The TOC importer no longer fabricates settings our own export mints: a right
stop at the column's end is the attr's default (null), and an entry template
resolving to the default style names no levelStyles entry. A custom-shape box
keeps its vertical text (the writing-mode read only ran for plain frames),
and a declared all-off tableLook ('') survives instead of reverting to the
default look.
2026-08-16 13:17:38 +02:00
Steffen Becker db3fbe32c1 fix: DOCX sections, box offsets and cell margins round clean
- a continuous break that only encodes a columns region no longer
  fabricates a section break or its own header/footer set
- a topBottom text box keeps its x offset (posOffset now written)
- cell margins read back in hundredth-cm, so twips don't show through
- a table margin's zero side stays the default instead of -0
2026-08-16 12:50:10 +02:00
Steffen Becker d32d40be3c fix: named styles and floating boxes read clean through ODT
- what a block's named style supplies (Title's centring, keep-with-next,
  its size as a raised run's percent reference) is direct formatting no more
- a topBottom box keeps its left place instead of gaining a fabricated
  centring; horizontal-pos right reads back as the box's wrapAlign
- a table margin's zero side stays the default instead of an explicit 0
2026-08-16 12:50:04 +02:00
Steffen Becker 205ae72ecf fix: DOCX closes round-5 gaps — XE quotes, linked revisions, box features
An XE field's literal quote is backslash-escaped (Word's own escaping;
import already unescaped it) instead of flattened to an apostrophe. A
w:ins/w:del inside w:hyperlink imports (shared handleRevision closure).
Text boxes carry charStyle (w:rStyle), index entries, citations,
date/time fields and revision marks (w:delText for deletions);
dateTimeFieldParts/xeInstr are shared with the body path.
2026-08-16 12:07:14 +02:00
Steffen Becker afec07579a fix: a deletion's text keeps its formatting through ODT
The deleted runs are hoisted through every serialization pass and spliced
into the tracked-changes registry as styled runs (as LibreOffice stores
them); import converts them back as real inline content. One point marker
per change instead of one per fragment. A deletion's marker also no longer
makes a formula beside it display (aloneInParagraph counts text:change).
applyComments now declares dc:/loext: only when absent — beside a revision
the duplicate xmlns:dc made content.xml invalid.
2026-08-16 12:07:07 +02:00
Steffen Becker 8e6616c562 feat: resolved comments travel through DOCX (commentsExtended.xml)
Word keeps a comment's resolved state as w15:done in
word/commentsExtended.xml, keyed by the w14:paraId of the comment
body's last paragraph. The docx package knows neither part, so a
post-pack pass stamps the paraId, mints the part with its content
type and relationship, and the importer reads it back.
2026-08-16 11:22:21 +02:00
Steffen Becker 1de86377e5 fix: DOCX text boxes carry paragraph formatting, inline features and marks
The hand-serialized txbxContent emitted only heading style, indent and
alignment: spacing, line height, indents, direction, shading, borders,
links, comment ranges, bookmarks, cross-references, formulas, rubies
and image rotation were all dropped. A bookmark still open at a
paragraph's end lost its runs (missing flush), and the formula/ruby
run regexes could start at a box's drawing run and swallow the box
preamble — they now stay inside one run.
2026-08-16 11:21:59 +02:00
Steffen Becker fdb456ffe6 fix: ODT sentinel passes anchor at the block tag, effects ride past annotations
A text box's anchor paragraph nests its children, so the STY/PBX passes'
scan to the closing tag started at the anchor and stole the first box
child's spec (its indent, direction, shading and borders). Both passes
now match the sentinel right after the opening tag, where it is emitted.
The TEF fallback also accepts bookmark markers and comment annotations
inside a run (tempered to the annotation's first close tag, -end kept
distinct), instead of cutting the effect short at them.
2026-08-16 11:21:20 +02:00
Steffen Becker 1264f9742c fix: dropping a fully covered table row shrinks the spans across it
A row holding only covered cells cannot exist in the editor and was
dropped on ODT import, but every rowspan reaching over it kept its
full count, leaving an inconsistent grid. Spans now shrink by the
dropped rows they covered.
2026-08-16 11:21:13 +02:00
Steffen Becker 044c59d895 feat: custom note marks travel through DOCX (w:customMarkFollows)
The docx package cannot express a custom footnote/endnote mark, so the anchor
always went out as an automatic reference and the label was lost — and the
importer never read one either, so a Word file's custom mark leaked into the
note's body text. A post-pack pass now rewrites the anchor (flag + literal
run) and the note part's <w:footnoteRef/>; the importer reads the flag, takes
the run's text as the label and strips its repeat off the note body.
2026-08-16 10:30:00 +02:00
Steffen Becker 5258feb146 fix: sibling nested lists of different formats stop sharing one w:lvl
A DOCX numbering level keeps the first format it saw, so a second nested list
under the same parent with another number format or bullet char silently
rendered as the first one's (an attr-less nested list under an upper-roman
parent came back lower-alpha). The kind-mismatch fork now covers format and
bullet char too, and copies the shallower levels so the importer's cycle walk
still sees the ancestry.
2026-08-16 07:58:24 +02:00
Steffen Becker 1f1176283a fix: a text effect covers its whole run and raises against the block's size
Two applyTextEffects bugs: the fallback span for an effect-only run stopped at
the first element, so everything behind a tab/line-break fell out of the span
and lost the effect — the run is now terminated by an empty sentinel pair and
inline empties ride along. And a raised run (textPosition) was written as a
percentage of the default 12pt even inside a heading, so the importer, which
resolves against the block's real size, read a different height back.
2026-08-16 07:46:43 +02:00
Steffen Becker ed7a40967a fix: an empty block no longer steals the next block's minted style
The whole-block regexes in the sentinel passes (page breaks, paragraph
styles/boxes, text effects, whitespace collapse) matched a self-closing
<text:p/> too — [^>]* happily ends in a slash — and then swallowed everything
up to the next real closing tag, so an empty cell paragraph took the restyle
meant for a later paragraph's sentinel and that paragraph lost it. The
opening-tag pattern now rejects self-closing tags.
2026-08-16 07:46:34 +02:00
Steffen Becker 97f9016369 fix: a note's stock body style no longer imports as direct formatting
Both importers stamped the exporter's own note style back onto the note
(styleName "Footnote" from ODT, "footnote text" from DOCX), so an
editor-authored document accreted a foreign attr on every round trip and the
two formats disagreed. A style that only re-states the stock note look is now
suppressed like any other default-equal value; a customized one still lands.
2026-08-16 07:35:42 +02:00
Steffen Becker 7a8c552342 fix: a page break survives beside other paragraph formatting
applyPageBreaks required its sentinel directly after the opening tag, but a
custom paragraph's serialized text starts with the FSZ/STY/PBX payloads, so
the break was silently dropped. It also minted PB# names, colliding with
applyParagraphBoxes' PB# — the importer then resolved both paragraphs to one
definition, painting the break paragraph with a stranger's box props. Now the
sentinel matches anywhere in the block and the pass mints PBK# instead.
2026-08-16 07:29:06 +02:00
Steffen Becker c500762275 fix: Escape closes the character and date/time pickers
Both handled the key on the dropdown, but opening one leaves the focus on
its trigger button, which sits outside it — so Escape never arrived and the
popover stayed open. Both elements listen now.
2026-08-16 03:04:43 +02:00
Steffen Becker 273c533fce fix: open a file whose extension names the wrong format
Which importer ran was decided by the extension alone, so a .docx saved or
renamed as .odt (and the reverse) was reported as a broken file. A failed
read is retried as the other format; a file that is neither still reports
the error for the extension it carries.
2026-08-16 03:00:27 +02:00
Steffen Becker 96863395f3 fix: recording a replacement keeps the text it replaced
Only a pure delete was turned into a deletion mark; typing or pasting over
a selection ran as it was, so the replaced text left the document unmarked
and rejecting the change lost the original for good. A one-step replacement
now marks its range deleted and puts the new content after it, as both word
processors do.
2026-08-16 02:36:31 +02:00
Steffen Becker 8b1bef9706 fix: paragraph styles apply to every block, not just the first
The document's content ended in an optional noteSection, so the content
match after the first child offered noteSection as its defaultType — and
that is what TipTap's clearNodes converts a block into. Every style command
on a top-level block past the first threw "Invalid content for node type
noteSection" and applied nothing. Spelling the same language as an
alternation puts a paragraph first again.
2026-08-16 02:18:55 +02:00
Steffen Becker dc1f5bb7b1 fix: leaving a header/footer no longer throws state_unsafe_mutation
Clearing hfActive removes the live zone's DOM during Svelte's flush;
ProseMirror dispatches a blur transaction as it goes, and the hfTick
mutation in onTransaction then landed mid-render and threw, aborting the
rest of the batch. The tick is queued to the next microtask instead.
2026-08-16 01:47:05 +02:00
Steffen Becker 6eb9032c46 fix: paste no longer stamps a font the document never had
transformPasted fell back to a DEFAULT_EDITOR_FONT of 'Georgia' — the
comment said it had to match ToolbarExpanded's, which is Liberation Serif.
Text pasted where the caret carries no font mark got Georgia as direct
formatting, and pasting into a heading overrode its sans font. Only an
explicit font at the caret is carried over now.
2026-08-16 01:28:28 +02:00
Steffen Becker 3cec6990ef feat: label feature nodes and marks in the history dropdowns
Replace the hardcoded node if/else chain in describeTransaction with a
NODE_LABELS map covering image, text box, formula, page break, TOC,
fields, cross-reference, index/bibliography entries, ruby and columns;
foot-/endnotes labelled via their kind attr. MARK_LABELS gains link,
comment, bookmark, character style and tracked change.
2026-08-15 23:31:22 +02:00
Steffen Becker bb15572b57 test: smoke-check the raster-PDF export
exportPdf gains a test seam: a window.__edentextPdfSink takes the bytes
instead of doc.save(), whose download hangs in headless Chromium. The
smoke test clicks the real export menu over the imported corpus document
and asserts %PDF magic and a plausible size. The test browser is pinned
to en-US so the labels it clicks are deterministic across machines.
2026-08-15 23:18:55 +02:00
Steffen Becker 76856f4aff fix: DOCX cell spacing accretion and nested-list kind flips
Found by the cross-format fuzz leg. importDocx baked the resolved cell
chain in as direct formatting even where it equals what an unset attr
already renders (0/0 spacing; single line height over a single default) —
every re-imported own file grew spacing attrs on every cell paragraph.
And a numbering level kept the first list kind it saw, so a nested bullet
list beside a nested ordered one came back ordered; a kind conflict now
forks its own numbering reference, as the ODT side mints a list style.
2026-08-15 22:58:29 +02:00
Steffen Becker d78181fdd9 fix: Save round-trips a .docx-opened document as .docx
Ctrl+S always built .odt bytes and wrote them into whatever handle was
open — including a handle obtained by opening a .docx, silently
overwriting it with ODF content under its old name. Track the loaded
format and route Save through the matching exporter and handle; the
title's extension label now reflects it instead of a hardcoded .odt.
Save As stays .odt-only, so it switches the format back.
2026-08-15 22:40:32 +02:00
Steffen Becker 3c7b598169 fix: cell paragraph indents and minted-style collisions on ODT export
Three defects in the cell/list paragraph style pipe, found by fuzzing:
ParaStyle had no indent/indentFirst/indentRight, so a cell paragraph's
indents never reached content.xml (list items keep skipping them — their
indent lives in the list style). The minted-style dedupe keyed on only
four of the style's fields, so two different styles could share one name;
both keys now serialize via paraStyleProps. applyListItemStyles' regex
missed items carrying text:start-value, shifting every later item's style.
2026-08-15 22:17:18 +02:00
Steffen Becker 0e04a41290 perf: stop deflating the ODT archive once per export pass
Each of the ~30 post-processing passes re-zipped every entry (images
included) at level 6 just for the next pass's unzipSync. Intermediate
archives are now stored; zipFinal compresses once at the end, keeping
mimetype first/stored and storing already-compressed picture formats.
Measured ~10x on an image-heavy document (853ms -> 87ms).
2026-08-15 22:03:12 +02:00