theseus/bundled-addons/docx-editor/addon.json

19 lines
1.3 KiB
JSON
Raw Normal View History

feat(docx-editor): edit Word documents without quietly eating what Word put in them A .docx editor is easy to write badly: read the file into HTML, let someone edit it, write a fresh document back, and hand them a file that lost its headers, its page size and half its formatting without ever saying so. Three things keep this one honest. The reader doesn't use mammoth's HTML. mammoth's converter is deliberately semantic, and HTML has nowhere to put a run's colour or a paragraph's line spacing, so it drops them — and those are controls this editor puts in the ribbon. Taking its parsed document model instead means what the ribbon offers is what the file can actually carry. Six properties mammoth's model didn't keep are added by build-time patches, each asserting its anchor so an upgrade that moves the code fails the build rather than shipping a lossy reader. The writer rebuilds the body but carries the rest of the package across: headers, footers, footnotes, endnotes, the document's own style catalogue, its theme and its page setup, with relationship ids and content types re-wired. Word features the editor can't model are still lost, so they are detected when the file opens and named in a banner before anyone edits. Tracked changes get their own gate. mammoth renders insertions as ordinary text and drops deletions, so saving would accept every pending revision without Word ever asking. Such a document opens read-only until the user says that is what they want. Verified over 66 real documents: 65 round-trip with an identical model and a structurally valid package, the one exception being a 7 MB WMF picture, which no browser can display and the writer cannot emit. Also driven end to end through a real Theseus over CDP — sidebar, ribbon, typing, save, reopen.
2026-09-20 20:46:29 +02:00
{
"id": "docx-editor",
"name": "Word editor",
"version": "0.2.0",
"description": "Open, edit and save Word documents (.docx) in a full Theseus tab, or export them as PDF. Several documents at once as tabs, ribbon-style formatting, tables, lists, images and links, and a page that scales to the window. Headers, footers, footnotes, page setup and the document's own styles are carried through a save untouched.",
feat(docx-editor): edit Word documents without quietly eating what Word put in them A .docx editor is easy to write badly: read the file into HTML, let someone edit it, write a fresh document back, and hand them a file that lost its headers, its page size and half its formatting without ever saying so. Three things keep this one honest. The reader doesn't use mammoth's HTML. mammoth's converter is deliberately semantic, and HTML has nowhere to put a run's colour or a paragraph's line spacing, so it drops them — and those are controls this editor puts in the ribbon. Taking its parsed document model instead means what the ribbon offers is what the file can actually carry. Six properties mammoth's model didn't keep are added by build-time patches, each asserting its anchor so an upgrade that moves the code fails the build rather than shipping a lossy reader. The writer rebuilds the body but carries the rest of the package across: headers, footers, footnotes, endnotes, the document's own style catalogue, its theme and its page setup, with relationship ids and content types re-wired. Word features the editor can't model are still lost, so they are detected when the file opens and named in a banner before anyone edits. Tracked changes get their own gate. mammoth renders insertions as ordinary text and drops deletions, so saving would accept every pending revision without Word ever asking. Such a document opens read-only until the user says that is what they want. Verified over 66 real documents: 65 round-trip with an identical model and a structurally valid package, the one exception being a 7 MB WMF picture, which no browser can display and the writer cannot emit. Also driven end to end through a real Theseus over CDP — sidebar, ribbon, typing, save, reopen.
2026-09-20 20:46:29 +02:00
"author": "Silent Mode",
"icon": "data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%3E%3Cpath%20d%3D%22M6%202h8l6%206v12a2%202%200%200%201-2%202H6a2%202%200%200%201-2-2V4a2%202%200%200%201%202-2z%22%20fill%3D%22%232563eb%22%2F%3E%3Cpath%20d%3D%22M14%202v6h6z%22%20fill%3D%22%231e40af%22%2F%3E%3Ctext%20x%3D%2212%22%20y%3D%2217%22%20text-anchor%3D%22middle%22%20font-family%3D%22system-ui%2C-apple-system%2Csans-serif%22%20font-size%3D%225.5%22%20font-weight%3D%22800%22%20fill%3D%22%23fff%22%3EDOC%3C%2Ftext%3E%3C%2Fsvg%3E",
feat(docx-editor): edit Word documents without quietly eating what Word put in them A .docx editor is easy to write badly: read the file into HTML, let someone edit it, write a fresh document back, and hand them a file that lost its headers, its page size and half its formatting without ever saying so. Three things keep this one honest. The reader doesn't use mammoth's HTML. mammoth's converter is deliberately semantic, and HTML has nowhere to put a run's colour or a paragraph's line spacing, so it drops them — and those are controls this editor puts in the ribbon. Taking its parsed document model instead means what the ribbon offers is what the file can actually carry. Six properties mammoth's model didn't keep are added by build-time patches, each asserting its anchor so an upgrade that moves the code fails the build rather than shipping a lossy reader. The writer rebuilds the body but carries the rest of the package across: headers, footers, footnotes, endnotes, the document's own style catalogue, its theme and its page setup, with relationship ids and content types re-wired. Word features the editor can't model are still lost, so they are detected when the file opens and named in a banner before anyone edits. Tracked changes get their own gate. mammoth renders insertions as ordinary text and drops deletions, so saving would accept every pending revision without Word ever asking. Such a document opens read-only until the user says that is what they want. Verified over 66 real documents: 65 round-trip with an identical model and a structurally valid package, the one exception being a 7 MB WMF picture, which no browser can display and the writer cannot emit. Also driven end to end through a real Theseus over CDP — sidebar, ribbon, typing, save, reopen.
2026-09-20 20:46:29 +02:00
"main": "index.js",
Theseus: start extensions on first use, Startup switches in Settings Every enabled add-on used to be activated synchronously in initAddons(), during app.whenReady and before the window exists. That is the largest launch cost left (boot tracer, 2026-10-03). An add-on can now say "activation": "on-demand" in addon.json. It is then listed at launch but not started. Its declared surfaces stay live: "panels" (new: sidebar panels declared up front), toolbar-menu, context-menu-items and the page-inject bridge, whose source is read on the first matching page. activate() runs on first real use: a panel opened, a menu or context item picked, a message from its panel, tab or page bridge, a Settings addon-invoke, a wiz:// link (for Aegis). All of those go through AddonHost.dispatch(), which starts the add-on and waits for it, so no call is dropped. Concurrent callers share one activation, and activations run one at a time. Startup stays the default: the host cannot tell what an older add-on does in activate(). request-filter add-ons and add-ons that declare no surface are forced to startup. If activate() returns a promise, calls wait for it (at most 5 s). api.startAtLaunch(bool) lets an on-demand add-on ask to be started at launch again (for live relay sessions). Converted: notepad, screenshot, translate, docx-editor, pdf-editor, vpn (none has launch-time work: no file association, no auto-connect, and add-on file tabs are not part of the saved session). Shield and Cookie Pop-ups stay startup: Shield owns the request filter and must see the first request; Cookie Pop-ups costs ~6 ms and acts unasked on every page. Aegis stays startup and untouched: another session owns it. See NOTE-aegis-on-demand.md (next commit). Settings › Performance › Startup: - "Start extensions when first used" (default on). Off = all at launch; switching it off starts the waiting add-ons immediately. - "Start the wallet at launch". Shown disabled with a hint until the installed Aegis manifest allows on-demand. It applies with no Settings change once Aegis opts in. - "Preload common menus" gates prewarmOverlays(). - "Use lightest" preset. New keys are plain SETTINGS_DEFAULTS through the existing settings-set. No new IPC channels. Measured: boot-trace, fresh profile, --seconds 20 so the 30 s add-on OTA poll can't swap Aegis mid-series; warm runs 2-3 of two paired series. - Add-on activation at launch: 121-154 ms -> 104-174 ms. The six converted add-ons went from 16-20 ms to 0. The rest is Shield (83-148 ms, noisy) and Aegis (15 ms in this tree's 0.9.0). - Toolbar painted: 1278-1584 ms -> 1282-1481 ms (within noise). - With "Preload common menus" off: 0 overlays prewarmed, 8 processes instead of 11, about 50-70 MB less at 15 s. The bundled add-on versions are not bumped. Existing profiles keep their old addon.json, and so stay on startup activation, until those add-ons ship with a higher version (seedBundledAddons only reseeds a strictly newer bundle).
2026-10-03 16:05:32 +02:00
"activation": "on-demand",
"panels": [
{ "id": "main", "title": "Word editor", "page": "panel.html" }
],
feat(docx-editor): Save as…, PDF export, and a mark of our own Three gaps, one theme: the editor could produce a file but not decide where it went, what format it was in, or look like anything in the dock. **Save as…** opens a real file dialog, and the extension typed there picks the format. Save then writes to that file instead of dropping another copy in Downloads every time. The renderer never names a path: the dialog returns an opaque token, and the add-on will only write to a path a dialog actually returned. An extension page is the least trusted thing in the add-on, and "write these bytes anywhere" is not a capability it needs. **PDF** goes through Chromium's own print pipeline in a hidden window — the same engine as Ctrl+P — on the paper size read out of the document's own sectPr. For that to match what the user was looking at, the page's typography had to stop living in editor.css, which the export window can't reach: it moves to lib/doc-css.js and both surfaces read the one string. The result embeds subsetted fonts, keeps images, and turns hyperlinks into real PDF link annotations. **The icon** is ours. Microsoft's Word mark is a trademark and borrowing it to look official is not something a browser that talks about sovereignty should do. icon.svg says "text document" in its own words — a turned corner, a heading rule, body lines, a pilcrow badge in Silent Mode green — and `npm run icons` derives the PNGs and addon.json's copy from it, so there is one drawing rather than several that drift. Also: the scratch folder follows the profile rename to extensions-data/ via the api.dataDir the host now provides, instead of creating a stale addons-data/ beside it.
2026-09-21 03:35:55 +02:00
"capabilities": [
"sidebar-panel",
"open-tab"
],
"updateURL": "https://navigate.st/bns/theseus.x/extensions/docx-editor/updates.json"
feat(docx-editor): edit Word documents without quietly eating what Word put in them A .docx editor is easy to write badly: read the file into HTML, let someone edit it, write a fresh document back, and hand them a file that lost its headers, its page size and half its formatting without ever saying so. Three things keep this one honest. The reader doesn't use mammoth's HTML. mammoth's converter is deliberately semantic, and HTML has nowhere to put a run's colour or a paragraph's line spacing, so it drops them — and those are controls this editor puts in the ribbon. Taking its parsed document model instead means what the ribbon offers is what the file can actually carry. Six properties mammoth's model didn't keep are added by build-time patches, each asserting its anchor so an upgrade that moves the code fails the build rather than shipping a lossy reader. The writer rebuilds the body but carries the rest of the package across: headers, footers, footnotes, endnotes, the document's own style catalogue, its theme and its page setup, with relationship ids and content types re-wired. Word features the editor can't model are still lost, so they are detected when the file opens and named in a banner before anyone edits. Tracked changes get their own gate. mammoth renders insertions as ordinary text and drops deletions, so saving would accept every pending revision without Word ever asking. Such a document opens read-only until the user says that is what they want. Verified over 66 real documents: 65 round-trip with an identical model and a structurally valid package, the one exception being a 7 MB WMF picture, which no browser can display and the writer cannot emit. Also driven end to end through a real Theseus over CDP — sidebar, ribbon, typing, save, reopen.
2026-09-20 20:46:29 +02:00
}