Repository navigation
Conversation
The minimal fractional reordering that the xlsx binding uses for sheet order is format-neutral, so it moves to collab/ordering as reorderFractional with its tests. The xlsx sheets module re-exports it under its old name; the notebook area orders sections, pages and notebooks with it.
Which Office viewer opens a file is not specific to the team workspace, so OfficeKind and detectOfficeKind move from teams/model to opc/office-kind with their test. The teams model re-exports both, so ooxml-core/teams is unchanged; the notebook area shows embedded files with them.
A free-form notebook model on Yjs: notebooks hold section groups and sections, sections hold pages with subpages, and every page is a canvas of rich-text containers, pictures, embedded Office files and ink. - One Y.Doc per notebook with top-level maps only; ids minted per client, fields set one by one, everything a peer wrote re-validated on read, deterministic rules for missing parents, group cycles and subpage levels, soft deletes restored by trash batch. - createNotebookClient: one immutable state and plain actions in the Teams shape, local-first storage, a per-device notebook list shared between tabs, local (BroadcastChannel) or y-websocket sync, presence, and undo that only reverts local edits. - Search across titles and text and a to-do summary over a cached text index; page export to .docx through the docx area in reading order (lists, checkbox controls, marks, pictures, ink as a picture from a host rasteriser) and a zip archive with JSON and media. - ooxml-core/notebook/editor: the ProseMirror schema (Word's mark specs), commands, keymap, input rules and the y-prosemirror binding, kept out of the main entry. Adds prosemirror-schema-list and prosemirror-inputrules.
The guarded localStorage wrapper of the team workspace is not specific to it. It moves to src/ui/src/safe-storage.ts and the teams app storage re-exports it, so another product can remember small per-browser settings without importing the team workspace and its core.
<notebook-app> (ooxml-ui/notebook) composes the notebook over the core client: a navigation pane (notebooks, section groups and coloured section tabs, pages with subpages, search, inline rename, keyboard moves and drag and drop), the page canvas (title and date, click to place text containers, drag and resize, pictures by paste, drop or insert, live read-only Word, Excel, Visio and PowerPoint embeds with download, pressure-sensitive pen, highlighter and eraser) and the To Do pane. Text containers are ProseMirror editors bound through y-prosemirror with collaborators' carets, accessible to-do checkboxes and Ctrl+Z through the notebook's undo manager. The ribbon (Home, Insert, Draw, View) is built from the shared ribbon primitives with KeyTips; menus, dialogs, presence and tokens are the shared ones, light and dark follow the theme, and every string ships in English, German, Spanish, French and Simplified Chinese. Documents live in a profile-scoped IndexedDB database. Page export rasterises ink through a canvas; notebook archives export and import.
A ribbon section created before its class was registered kept its groups as an own property, so the notebook's ribbon was empty when it was the first ribbon on a page; the app's definer now registers the shared controls, its parts and its glyphs (no longer a side-effect import a bundler drops) before the app itself. Buttons outside the ribbon get a command (a shared button only emits office-command with one), hidden ribbon panels stay hidden, embedded viewers render only once defined (so read-only and the hidden toolbar apply), and the open-file event carries the container id.
Text containers took the dark theme's light text colour on the white page, and default black ink would vanish on a dark page. The page now carries the token defaults (the light values) as Word's page does, so text, ink and highlights look as they print and export; the app's chrome still follows the theme.
y-prosemirror queues a caret update on a timer and delivers it even when the view was destroyed meanwhile (its binding never marks itself destroyed), which threw from dispatchTransaction after a page switch. Collaborators' carets are also hidden from assistive technology now, so a name is not read as text.
viewers/notebook mirrors the team workspace viewer: the private notebook-viewer web component package (bindNotebook, pickNotebookProps), the opennotebook-react-viewer binding with the Notebook component and the useNotebook raw hooks, a React demo (demos/notebook/react) and a VitePress docs site under /ooxml/notebook/. The viewer is registered with the CI planner, the release package table, the Pages build, the preview templates and the labeler.
A Notebook tile, rail button, launcher entry, tab and #/notebook route mount <notebook-app> with this profile's own notebook database (ooxml-suite-notebooks), the suite profile's name and the suite theme. An embedded Word, Excel, PowerPoint or Visio file opens in the suite's editor as a library copy keyed by its container; the standalone apps gain apps/notebook.
Rich text and persistence across reloads, sections, subpages and undo of a delete, search and the To Do list, pen and eraser, pictures, a live Word embed and .docx export, and two tabs editing one notebook with presence.
The notebook product is OpenNotes and its packages opennotes-<framework>-viewer (first opennotes-react-viewer, docs opennotes-docs). The core and ui areas keep the neutral notebook name and the element stays <notebook-app>.
y-prosemirror 1.3.7 measures the local selection with the view root's createRange while it applies a remote change; a ShadowRoot has none, so applying a collaborator's edit to a focused text container threw and the edit was lost (the other way round worked while the receiving editor was unfocused). Each editor view's own root now gets the document's createRange.
Synthetic Cmd+A followed at once by an arrow key does not always collapse the selection before the next key, so typing replaced the text. The specs put the cursor at the end through the editor; the rich-text spec now also expects a to-do tag to carry over on Enter and drop on an empty line, and the to-do list spec ticks an item rather than the filter.
Passing undefined for the IndexedDB factory fell back to the global one, so the memory-only mode depended on what else had installed a global IndexedDB (another test in the same worker did). null now means none; an omitted argument still means the browser's.
The open-file event now carries the embedded file's container id; the binding test and the viewer docs list it.
A save cleared the dirty flag before writing and swallowed the error, so flush() resolved and the next flush or close skipped the snapshot: a storage failure followed by closing the app lost the edits. The notebook and the device's notebook list now stay unsaved after a failed write, the next change, flush or close tries again, and flush() rejects. IndexedDB writes resolved when the request succeeded, before the transaction committed; they now wait for completion and reject when the transaction aborts (quota or disk errors surface at commit). Save and load failures are reported as save-failed and open-failed instead of the collaboration error.
Every container decoded its media entry again and kept the result, so a small archive whose manifest names one 1 MiB entry two thousand times stayed under the zip limits and still allocated about 2 GiB. Each media path is now inflated once, and the media all containers take together is held to a budget (512 MiB by default, maxMediaBytes to change it); going over it fails the import with NotebookArchiveError.
Changing the style of a selection read the to-do tag of its first block and gave it to every block, so turning a plain line and a done to-do into a heading cleared the to-do (or tagged every line). Each block now keeps its own tag; only the type and level change. With the cursor inside a link, Insert > Link pre-filled the address but Remove link removed nothing and a new address was inserted as a second link. linkRangeAt finds the link around the cursor, setLink edits or removes all of it, and the dialog only offers an address a viewer may open (a collaborator can store any). The text field is only typed in when a new link is inserted at the cursor; for a selection or a link the text comes from the page.
A stroke counted as a dot when its bounds were no wider than the pen, so a straight vertical line (constant x) of any length was drawn as a dot at its first point. It is now a dot only when it moved in neither direction.
Moving a page always lifted its block to the top level, so reordering a subpage under the same parent made it a page of its own. The levels are now only reset when the block moves to another section.
A list typed as "3. " starts at 3 in the editor, but the export created its numbering from the list kind alone and restarted it at 1. The new numbering instance now overrides the first level's start.
The React binding only passed a config on to the element when it was set, so removing the prop kept the previous server configuration and the notebook went on syncing with that server. Omitting it now resets the element to local mode, as documented.
The notice's Undo restored the trash batch in whichever notebook was open when it was clicked, so deleting a page or section, switching notebooks and pressing Undo searched the wrong notebook and the page stayed deleted. Undo now reopens the notebook the delete came from first.
The ink layer worked out the page's zoom from its SVG's layout width, which not every browser reports (some give 0 for SVG elements), and then drew and erased at the wrong place on a zoomed page. The page now passes its zoom, as it does for its own pointer positions.
|
Seventeenth review round (d79b15e): two seats clean; 6 distinct findings (one from three seats), each checked against the code. Five confirmed and fixed with tests that fail on the old code:
Not reproduced: undo of a new section leaving the section behind. Each action is its own undo step ( Local: core notebook and geometry 121, UI notebook and Teams app 196, viewer unit 22, browser 12/12, both typechecks, oxlint and oxfmt clean. |
| beforeSwitch: async () => { | ||
| for (const id of sessions.sessions.keys()) await sessions.save(id); | ||
| teams?.client?.flushStorage(); | ||
| await notebook?.client?.flush(); |
There was a problem hiding this comment.
[P2] Switching or adding a profile can stay blocked until the page is reloaded. NotebookClient.flush() runs registry.flush(), and that rethrows the stored failed error. When the notebook list could not be read at startup, client-registry.ts sets readFailed, sets failed to the load error and never clears it, because save() returns early while readFailed is true. From then on every flush() rejects. So beforeSwitch throws, and mountProfile's switchTo and the add-profile form abort every time, even though nothing new can be saved. A notebook save that keeps failing (storage full) has the same effect. The Teams flush above is not awaited and does not block a switch.
Fix: either let the registry's flush() resolve when the only error is the unreadable list (there is nothing it could save), or catch the notebook flush here and ask the user to confirm instead of refusing the switch outright.
A notebook list that could not be read made every later flush fail with that load error, even with nothing changed, so the suite could never switch or add a profile until a reload. The list's flush now fails only while changes are unsaved. The suite still waits for unsaved notes before it reloads for another profile, which would lose them, and now says so in plain words.
An export wrote a picture or file over the 32 MB an import accepts, making a backup no import could open. Export now refuses it.
Opening a notebook stored in more than one piece always compacted it, so after any session's edits the next open re-encoded and wrote the whole notebook, pictures and files included. Opening now compacts only an older version's single copy, several bases (clients that compacted at once), a log past the usual threshold, or a store that has shrunk: when the live document encodes to less than half of what is stored, as after deleting a large file, which a smaller base then replaces.
|
Eighteenth review round (abe4af7): five of six seats clean; 3 findings, each checked against the code, all confirmed and fixed with tests that fail on the old code:
Local: core notebook and geometry 123, UI notebook and Teams app 196, viewer unit 22, script tests 205, browser 12/12, core typecheck, oxlint and oxfmt clean. |
A picture's type came from the shared document, checked only for its shape, and the page showed the picture from a blob URL of the app's own origin. A peer could store an SVG with a script, or label a picture text/html, and opening the picture on its own (Open image in new tab) then ran that script in the app's origin, with every notebook on the device in reach. A picture's type is now one of the image types the notebook takes, else PNG, and an SVG is shown as a PNG drawn from it at its frame's size, so the page never hands out a URL that runs.
Renaming or recolouring a closed notebook set one pending flag, and the next open wrote both the cached name and colour into the shared document, so recolouring it reverted a collaborator's rename made meanwhile. The name and the colour are now pending one by one, and only what changed is written; an earlier flag still stands for both.
Without IndexedDB the status said notebooks last until the tab closes, but they live in the page's memory, so a reload loses them too. The status says so in every language.
|
Nineteenth review round (87d7ead): four seats clean (the Claude review job did not finish); 3 findings, each checked against the code, all confirmed and fixed with tests that fail on the old code:
Local: core notebook and geometry 125, UI notebook and Teams app 196, viewer unit 22, browser 13/13, both typechecks, oxlint and oxfmt clean. |
| }, | ||
| }); | ||
| if (destroyed) return void (await next.close()); | ||
| if (entry.pending.name || entry.pending.color) { |
There was a problem hiding this comment.
[P2] entry here is the registry entry read at line 258, before the awaits on previous.flush(), previous.close() and openNotebook(). While those run, open is null, so a renameNotebook or setNotebookColor on this notebook only sets pending in the list (line 414/418). Two things can then go wrong:
- If the stale entry had no pending flag, the new name is never written into the document. Its
pendingflag also stays set, soafterComputestops mirroring, and the document and collaborators keep the old name until the notebook is reopened. - If the stale entry did have a pending name, the old name is written and
pendingis cleared.afterComputethen copies that old name back over the list, so the rename is lost.
Fix: after await openNotebook(...), read the entry again with readRegistry(reg).find(...) and use that fresh entry for pending, name, color, lastSection and lastPage.
|
|
||
| override disconnectedCallback(): void { | ||
| super.disconnectedCallback(); | ||
| this.#destroy(); |
There was a problem hiding this comment.
[P2] The editor is torn down whenever its frame moves in the DOM. Containers are sorted by z (read.ts:196) and drawn with keyed repeat in page-canvas.ts. When a z order changes (Bring to front from the menu, a collaborator raising a box, or undo/redo of either), Lit moves the frames with insertBefore. That fires disconnectedCallback and then connectedCallback, so the EditorView is destroyed and rebuilt. The user loses focus, the selection and any IME composition in progress in the box they are typing in.
Fix: defer #destroy() to a microtask and skip it if isConnected is true again by then. Alternatively, render frames in a stable order (for example by id) and apply stacking only through z-index.
| this.paragraph(runs, { ...(style ? { style } : {}), ...item }); | ||
| } else if (node.type === 'bullet_list' || node.type === 'ordered_list') { | ||
| const kind = node.type === 'bullet_list' ? 'bullet' : 'decimal'; | ||
| const level = list ? Math.min(8, list.level + 1) : 0; |
There was a problem hiding this comment.
[P3] The level is capped at 8, but the editor allows up to 32 list levels (MAX_LIST_LEVELS). Take a same-kind list nested under a level-8 list: it reuses the parent's numId (line 192) at the same level 8, so in Word it shares the parent's counter. For example, the parent item is "1.", the nested items are "2." and "3.", and the next parent item is "4.". Nothing is added to the report either. Fix: once list.level >= 8, start a new list definition (or write plain indented paragraphs) and record the approximation in report.skipped.
|
|
||
| picture(picture: ExportPicture, mime: string, name: string, alt: string, maxWidth: number): void { | ||
| const ext = WORD_PICTURES[mime] ?? 'png'; | ||
| const scale = picture.width > maxWidth ? maxWidth / picture.width : 1; |
There was a problem hiding this comment.
[P3] Pictures are scaled down only to fit the width, never the height. The page's ink is exported as one PNG, so a page whose ink spans a few thousand px (or a tall, narrow picture) becomes an inline picture much taller than the page's text area. Word does not shrink inline pictures, so the picture is cut off at the bottom of the page. Fix: also limit the height to the page's text height, with Math.min(maxWidth / w, maxHeight / h, 1).
| if (!open) throw new Error('No notebook is open'); | ||
| // The archive is built from the open document; a save that failed was announced already. | ||
| await open.flush().catch(() => undefined); | ||
| return exportArchive(open); |
There was a problem hiding this comment.
[P3] exportArchive(open) reads the shared open again after await open.flush(). If a switch or delete runs during the flush, this either exports a different notebook or throws a TypeError on null. Also, unlike exportPage, a failure never sends 'export-failed', so the errors exportNotebookArchive throws on purpose (a picture missing from this device, too large, too many items) never reach the UI as a notice. Fix: capture const target = open before the await, and wrap the call in the same try/catch with notice('export-failed', error).
| } | ||
| return create( | ||
| { name: snapshot.name, color: snapshot.color }, | ||
| (ctx) => void writeSnapshot(ctx, snapshot), |
There was a problem hiding this comment.
[P3] writeSnapshot returns how many items it could not write, but void throws that count away. For example, a stroke left with fewer than 3 usable points after inkTriples drops non-numeric values is refused by addStroke. Such items vanish from the imported notebook without a word, although archive.ts otherwise refuses rather than drops ("never drops part of a notebook unsaid"). Fix: report the count through a notice or the return value, or have importNotebookArchive reject these strokes.
| const cutoff = options.now() - PURGE_AFTER_MS; | ||
| for (const entry of readRegistry(doc)) { | ||
| if (!entry.deleted || entry.deleted > cutoff) continue; | ||
| unregisterNotebook(doc, entry.id); |
There was a problem hiding this comment.
[P3] The entry is removed from the list before its stored copy is deleted. If removeNotebookCopy fails (a transient IndexedDB error, or a connection closed by onversionchange), only an error is reported. Because the notebook is no longer listed, no later purge will find it, and its log and media stay on the device for good. Fix: delete the stored copy first, and unregister the entry only once that succeeds.
The undo filter took the topmost history entry as the one being undone, but Yjs skips an entry that changes nothing (a box a collaborator deleted) and undoes the next. The filter then judged the next entry's fields against the wrong one and let undo strip the page and position of a box a collaborator had written in, hiding their text. It now reads the entry in hand: Yjs pops each before processing it.
An archive could list a page in a section it does not have (or in a group), or an item on a page it does not have. It imported, but such a page or item never showed, and the next export left it out. An import now refuses such an archive.
Opening a notebook used the list entry read before it waited for the open, so a rename made meanwhile was never written, or was reverted; it now reads the entry again. Exporting a notebook read the open one again after its save, which could be another by then; it keeps the one asked for. And a purge took a notebook off the list before removing its stored copy, so a removal that failed left the copy on the device for good; the copy now goes first, and a failure keeps the notebook listed in the bin for the next try.
An export still running when the app switched to another profile handed its file to the host when it finished, so a host that uploads exports under the account on screen could receive the previous account's notebook. A finished export is now dropped once another client is on screen.
The shortcuts left any focused input alone, including a to-do's checkbox, so undo and redo did nothing right after ticking a to-do. Only inputs that take typing hold the shortcuts back now.
Frames were drawn in stacking order, so bringing a box to the front (or a collaborator restacking, or undo) moved its element in the page, which ended its editor: the focus, the selection and any input method composition were lost. Frames now keep a fixed order (by id) and stacking only sets their z-index. The collaboration spec finds a box by its text instead of by its place in the page, which no longer follows stacking.
Pictures and ink were scaled down to the page's text width but never to its height, so a tall one ran off the page. They now fit both.
|
Twentieth review round (7fbeacf): four seats clean; 11 findings across two seats and the Claude review (6 P2, 5 P3), each checked against the code. Fixed, with tests that fail on the old code unless noted:
Answered, not changed:
Local: core notebook and geometry 131, UI notebook and Teams app 199, viewer unit 22, browser 13/13, both typechecks, oxlint and oxfmt clean. |
A stroke with no whole point imported and was then skipped when the notebook was written, without a word. An import now refuses it, so an import that succeeds writes every item it read.
|
Twenty-first review round (1cc95fe): all six Hydra seats clean, no findings. The Claude review did not finish, twice (the second run was a re-run): the PR is over GitHub's 20,000-line diff limit, and its four parallel sub-reviews did not report back in the job's time. It posted no findings. Its recommended areas were checked by hand instead: the archive import goes through the shared zip limits ( CI on 1cc95fe: green. The first attempt failed one PowerPoint browser test ("Rounded selection is absent from fallback PNG export", a click timeout, in |
|
Held (2026-11-25). Not merged, and merging into this fork's What I checked:
What is left, in order:
The branch is untouched. |
OpenNotes: a free-form notebook app (first cut)
A notebook application beside Word, Excel, PowerPoint, Visio and Teams, structured exactly like
the team workspace: DOM-free logic in
src/core/notebook, the app as Lit elements insrc/ui/src/notebook(ooxml-ui/notebook), the React binding, demo, browser tests and docs underviewers/notebook,demos/notebookande2e/notebook, and a Notebook tile in the Office suite.What works
levels). Create, rename (inline), recolour, reorder (menus, Alt+Arrow, drag and drop) and
delete with Undo. Each page shows its title and creation date.
it. Pictures go in by paste, drop or Insert > Picture; new items go below what is on the page.
Pictures and files are in the tab order and move with the arrow keys. Ink has a pen, a
highlighter and a whole-stroke eraser (pointer events with pressure) and draws over everything
on the page. Word, Excel, Visio and PowerPoint files are shown live and read-only by the
existing viewers, with Open and Download; files over 32 MB are refused before they are read.
underline, strikethrough, highlight, links (http, https, mailto), headings 1 to 3, bullets and
numbering with nesting, to-do checkboxes, and undo/redo through one notebook-wide undo manager
that never reverts a collaborator.
list of every checkbox tag.
ooxml-suite-notebooks[-id]),surviving reloads. A write only counts once its transaction commits; a failed save keeps the
changes unsaved, says so, and is retried on the next change or when the page closes.
collab(Yjs): two tabs share a notebook overBroadcastChannel with presence (who is on which page and in which container, and their carets).
A server mode speaks the y-websocket protocol through the shared
collabWebSocket transportthe team workspace uses; this cut tests it only through that transport's own tests, not against
a running server.
docxarea. Containers go in reading order (top tobottom, then left to right). Lists become Word numbering, to-dos become checkbox content
controls, pictures stay pictures, and the page's ink becomes one PNG drawn by a canvas. Anything
approximated is reported. A whole notebook exports to and imports from a zip archive (JSON
manifest plus media).
keyboard navigation; light and dark themes through the shared tokens (the page stays paper
white, as Word's does); every string in en, de, es, fr and zh-CN.
<notebook-app>, theopennotes-react-viewerbinding (<Notebook>plususeNotebookrawhooks), a React demo, a docs site under
/ooxml/notebook/, and the suite tile, route andstandalone app.
Small shared extractions made on the way (each re-exported, no API change):
reorderFractionalmoved from xlsx/collab to
collab/ordering;detectOfficeKindmoved from teams toopc; thesafe localStorage helper moved out of the teams app.
How it was verified
bun run verifyon the final commit (the CI plan for these commits, with CI's Bun 1.4.2): all 49steps passed. They cover lint, the formatter on changed files, the core and ooxml-ui builds,
both core typechecks and the ooxml-ui typecheck, the full core suite (1989 files, 33301 tests),
the ooxml-ui suite (1337 files, 14600 tests), the script and MCP tests, and the own checks of
every viewer the change reaches (docx, xlsx, visio, teams, notebook and the pptx packages).
Browser suites are not part of it; the notebook's is listed below.
with y-prosemirror's own converters, canvas and ink, the search index, .docx export read back
through
loadDocx, archive round trip and hostile archives, the client with two simulated tabssyncing with presence, local-only undo and a failed save that is retried, editor commands and
input rules). UI 6 files / 48 tests: a happy-dom integration test mounts
<notebook-app>anddrives typing, the ribbon, links at the cursor, paste, ink, export, delete and Undo across
notebooks, and German; plus the locale contract (5 locales), tokens-only CSS, the React prop
mapping, file intake, and IndexedDB storage including a transaction that aborts after its write
succeeded.
viewers/notebook, Playwright on Chrome), 6 specs, green twice in a row on thefinal commit: rich text that survives a reload; sections, pages and subpages with an undone
delete; search and the to-do list; pen, eraser and undo; a picture moved with the keyboard and a
live Word document, exported to .docx; two tabs editing one page in real time with presence.
check:publishedand the local pack smoke test; the Pages build with the docs site and demo.build:suiteand headless checks of the tile, route, profile isolation, theme and anembedded .docx opening in the Word editor.
findings, each confirmed against the code and fixed with a regression test. Among them: edits
lost after a failed save, media amplification in archive import, links not editable at the
cursor, numbered list starts lost in Word export, Undo restoring in the wrong notebook, pictures
out of keyboard reach, IndexedDB commit failures reported as saved, oversize files read into
memory, and paste into the page title.
Not done (follow-ups)
.one,.onepkg): that codec belongs in its own package,like
ole2.notebook reuses it today).
opennotes-react-viewerneeds the maintainer bootstrap described indocs/releasing.md; the binding needs core and ui released with./notebookfirst.Known baseline failure (not from this branch)
scripts/suite-regression-check.mjsstops at about line 103 on the selector.pptxv-options-dialog, which no longer exists in the source (and an old#dialogstartscreen); neither exists anywhere in the source any more, independent of this branch.