Repository navigation
feat(editor): default-on toolbar + controlled typography + fidelity fixes (wiki-v2 #135) - #9
Merged
Merged
Conversation
…eholder fixes (docmost#135) Keep the stock Docmost fixed toolbar and polish it in place (no new toolbar): turn it ON by default, add a Link button, controlled font size (14/16/18/20) and a Default/Serif/Monospace family selector, surface strikethrough, improve highlight discoverability, add roving-tabindex a11y, 44px touch targets, brand active state, print + responsive fixes. Typography is allowlist-gated attributes on the existing textStyle mark (CccFontSize/CccFontFamily), registered on BOTH the client and server schemas so the schema-bound server paths no longer strip them. Internal ProseMirror copy/paste now preserves formatting; a fork placeholder shows on empty unfocused pages. All genuinely-new code lives in fork-owned excluded dirs (features/editor-ux/, packages/editor-ext/src/lib/ccc/, editor-compat/); upstream edits are minimal seams documented as UPSTREAM_MODIFICATIONS #51-#62. Co-Authored-By: Claude Opus 4.8 <[email protected]>
…ocmost#135) Sync EditorLinkMenu's showLinkMenu ref during render so the panel's shouldShow sees the correct value on first evaluation (was racy / never opened from a programmatic trigger). Extract the toolbar Link word-selection into a tested fork helper. Browser-validated end-to-end. Co-Authored-By: Claude Opus 4.8 <[email protected]>
…, roving stability, tests (docmost#135) Round-justifying (Priority Level 3+) findings from the 7-lens review of PR docmost#146 / docmost#9: - Frontend + Correctness (L3): the toolbar Link button on an empty caret inserted a literal "link" word that stayed behind if the panel was dismissed without a URL. `ensureLinkableSelection` now returns the placeholder range; `LinkGroup` removes it on a cancelled panel (no link mark applied), keeping applied-link behavior unchanged. - Architecture (L3): `scale.ts` hand-duplicated the size scale in `PX_BY_SIZE`; derive it from the single-source `ALLOWED_FONT_SIZES` + the Normal (16px) anchor, sorted ascending to preserve the tested round-toward-smaller tie-break. - Testing (L3 x3): added tests for `collectTextStyleAttr` (incl. the "mixed" multi-value branch), `ensureLinkableSelection`'s link-active branch (with a real Link mark), and a raw-attr render-gate bypass for fontFamily — symmetric with the existing fontSize gate test, on both client and server. Opportunistic (converged L2, same files): stabilize `useRovingToolbar`'s `onExit` via a ref so the effect no longer tears down listeners and resets the roving tab stop on every toolbar re-render; correct a stale "Mixed" docstring in `FontSizeGroup`. Client vitest 33/33, server editor-compat jest 10/10, client tsc clean. Co-Authored-By: Claude Opus 4.8 <[email protected]>
…ocmost#135 review r2) Round-2 re-review surfaced two Priority Level 3 findings, both from the round-1 cancel-cleanup path: - Correctness (L3): `LinkGroup` stored the placeholder's absolute `{from,to}` at panel-open and fed them UNMAPPED into `deleteRange` at panel-close. Safe single-user, but in the Yjs/Hocuspocus collaborative editor a concurrent remote edit before the placeholder could make the range stale → delete the wrong content, miss the placeholder, or throw a Position-out-of-range RangeError. Now the range is mapped through every transaction (local + remote) via `editor.on("transaction")`, and the delete is gated by a new pure `shouldRemovePlaceholder(editor, range)` helper that only approves an in-bounds range still holding exactly the placeholder text with no link mark — so a stale/rewritten range is left untouched instead of mis-deleting. - Testing (L3): the `placeholder: null` return invariant (which guards that destructive delete) was asserted on only 2 of 4 branches. Added assertions on the word-at-caret and keep-selection branches, plus four `shouldRemovePlaceholder` unit tests (intact / linked / rewritten / out-of-range) — which also gives the previously-untested cleanup decision direct coverage. Extracting the decision into `shouldRemovePlaceholder` also resolves the round-2 Architecture L2 (helper extraction) and Testing L2 (untested cleanup logic). Client vitest 37/37, client tsc clean. Co-Authored-By: Claude Opus 4.8 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fork half of wiki-v2 issue docmost#135 (editor WYSIWYG UX). Parent PR bumps the submodule to this branch.
Keeps the stock Docmost fixed toolbar and polishes it in place — no parallel toolbar. All genuinely-new code lives in three new boundary-excluded fork dirs (
apps/client/src/features/editor-ux/,packages/editor-ext/src/lib/ccc/,apps/server/src/editor-compat/); every upstream edit is minimal and documented in the parent'sUPSTREAM_MODIFICATIONS.md(#51–#63).Highlights
resolveEditorToolbarPrefhelper; explicit opt-out honored; no migration).textStylemark — registered on both client and server schemas in lockstep (closes the "server strips unknown textStyle attrs" trap).Tests
apps/server/src/editor-compat/(9): schema + ydoc round-trip, render-path allowlist gate,text_contentinvariance, Markdown degradation, legacy fixture.Editorfont commands + gate, allowlist, paste sanitizer, link word-selection.tsc --noEmitclean; editor-ext + server build clean.Browser-validated (desktop + phone × light/dark). Fidelity policy in parent ADR 0012.
🤖 Generated with Claude Code