Commit Graph
1447 Commits
Author SHA1 Message Date
DarkSky a6bb03e702 feat(editor): restore 0.27.5 mobile keyboard toolbar, native previews, and fold CRDT codecs 2026-11-27 08:18:25 +09:00
DarkSky 531da7466d feat(editor): add S3 rich blocks, live CRDT table cells, and mobile input
Add the S3 PageEditor stack on top of darksky/np/mobile:

- Read and render seven rich block kinds (callout, table, attachment,
  LaTeX, embed linked doc, embed synced doc, and surface ref) with pure
  Rust RaTeX math layout, syntax highlighting, Hayro PDF previews, and
  shared premultiplied RGBA-to-BGRA conversion via ui::swap_rgba_pa_to_bgra.
- Replace offline table cell string diffing and the conflict popover
  with direct in-place Y.Text CRDT splicing, O(1) read_table_block with
  zero-clone replacement, split_delta preedit, and RichParagraph cells.
- Share insertion_marks_at across paragraphs, table cells, surface
  elements, and block titles via single-delta splice_live_text; share
  AnchoredInlineInput and finish_inline_targets across table cells and
  Edgeless labels with unselected root-input suppression and same-target
  preedit commit on pointer press.
- Land mobile keyboard toolbar with 0.27.5 @blocksuite/icons tokens,
  bidi selection, touch gestures, native web clipboard paste, shared
  HTML/Markdown slice builders, and host-layer Emoji font registration.
2026-11-27 06:55:48 +09:00
DarkSky e88ee8e9fe feat(web): add GPU recovery, canvas selection menu, lazy PDF client, and zero-3p-JS gate
Add WebGL2 context loss recovery, epoch-guarded async restore, single-flight fallback locking, and WebGPU canvas compositing to the Web Mobile host.
Flush pending IndexedDB writes before legacy shell navigation and recreate a visible retry banner on flush failure.

Add canvas-drawn selection highlights, teardrop handles, pointerup action triggers, and selection-guarded clipboard actions.
Add a lazy hayro PDF worker client with crash recovery, clamped scale rendering, transfer-safe deduplication, and asset root pinning.
Add a static zero-third-party-JS gate script and wire both web host gates into mobile CI.
2026-11-27 06:55:48 +09:00
DarkSky 9a3195bf81 feat(mobile): add S3 mobile shell, breadcrumb engine, and outbound doc refs
Implement the S3-Shell deliverables across L1 to L4:
- Add read-only outbound document reference extraction in `blocksuite/crates/doc/src/refs.rs` with zero-writeback tests.
- Add baked keyframe micro-icons, domain-neutral Breadcrumb layout, and RTL mirror tests in `packages/ui/kit`.
- Add sanitized FolderForest caching, NavHistory with 128-entry cap, pure breadcrumb derivation, and LinkGraph backlinks in `packages/frontend/client`.
- Add `affine-mobile` with interactive 4-TabBar routes, 10-section Settings, Location and Trail sheet, and `mobile-harness`.
2026-11-27 06:55:48 +09:00
DarkSky 0036df69b5 fix(frontend): close S2.1 parity gaps across editor, web, and CI
Close the S2.1 parity and review items across the editor, web host,
and CI workflows.

- Add affine:latex block layout and the equation editor popover.
- Support Space and Enter triggers, inline rendering, click-to-edit
  chips, IME commit on Done, and Web slash copy.
- Guard open equations with zero-width CRDT identity checks and skip
  writes when closing an unchanged equation.

- Align web sign-in OTP validation, resend state, anti-reentry,
  cross-Back cooldown, preflight races, and initial OTP errors.
- Align step-bound email submit, deployment Terms display, and native
  Chromium discovery in verify-idb-real-browser.

- Key WebTextSystem Canvas fallback descriptors by logical font ID so
  static single-face fonts preserve requested weights.
- Keep Release LTO active for s1-probes-bench in np-mobile.yml.
2026-11-27 06:55:48 +09:00
DarkSky 6efd971122 feat(editor): add web CJK/RTL fallback, touch dispatch, and BlockSuite parity
Enable browser Canvas CJK and fullwidth punctuation fallback by default,
bundle Noto Sans Arabic and Noto Sans Hebrew for native RTL shaping, and
bridge touch tap and pan gestures to window mouse and scroll listeners.

Align BlockSuite editor behavior with Web:
- Trigger the linked-doc menu on mid-word `@`, `[[`, and `【【`.
- Add all eight inline Markdown rules on ASCII space or Enter with IME
  guards and non-leaking trailing space or pending marks.
- Support block-level Markdown on Enter and inside list and quote blocks.
- Outdent nested empty list items on Enter and exit quote blocks on two
  Enter keys without an extra blank paragraph.
- Use subsequence fuzzy matching in the slash menu, pass through Enter
  and arrow keys when in-document search has no match, and split Linked
  Page into New Doc and Linked Doc commands.
- Add block conversion shortcuts, Mod-k link focus, and Escape / second
  Mod-a whole-block selection.
2026-11-27 06:55:48 +09:00
DarkSky ed72cca4a3 feat(mobile): deliver S1 thin hosts, Mermaid font measurer, and release probes
Add thin Web, iOS, and Android mobile hosts, harden the blocksuite-preview
Mermaid renderer and Wasm exports, and add S1 release performance probes
with CI artifact and native host linking gates.

- Preview: use FontPoolWidthMeasurer with variable-font HVAR weight
  instantiation, integer pixel ceil widths, front-matter theme injection,
  high-contrast Light and Dark palettes, premultiplied RGBA PNG compositing,
  and Wasm theme parameters.
- Probes and CI: add s1_sqlite_probe and s1_probes release tests, record
  measured latency and peak RSS in BENCHMARK.md, add timeout-minutes on all
  np-mobile jobs, upload s1-probes-artifacts, and link Android NDK .so,
  kotlinc Activity, and iOS Simulator swiftc executable in CI.
- Web host: use an offscreen canvas GPU probe, add OAuth redirect-loop and
  runtime GPU loss guards, restrict embed URLs and sandbox tokens, match
  /api/auth/captcha Turnstile headers, and launch four independent ES module
  Blob workers pinned to site root.
- iOS host: add affine-ios-host staticlib crate implementing all C-ABI
  functions with surrogate-pair safe UTF-16 editing, weak DisplayLinkProxy,
  absolute ime_bottom contract, and in-memory LegacyCapacitorSchemeHandler.
- Android host: implement hand-written JNI bridge with absolute ime_bottom
  logical-dp conversion, predictive and legacy back gesture handling, and a
  pure Android platform SDK MainActivity and LegacyLocalStorageProbe.
2026-11-27 06:55:47 +09:00
DarkSky 8e0b345036 feat(editor): extract ui-tokens, ui-kit, and blocksuite-editor crates
Add the zero-dependency ui-tokens crate to export generated theme tokens,
icon definitions, and bundled font bytes without cross-tree include_bytes!
paths.

Add the domain-neutral ui-kit crate with logical geometry helpers, SafeArea,
VirtualList, SwipeDialog, and SwipeMenu state machines backed by scheduler
time and four-rate replay invariance tests.

Extract blocksuite-editor from playground with the WorkspaceDocDirectory
host port, exact substring UTF-16 highlight matching, and LTR/RTL logical
start/end block flow layout. Slim playground to the demo and harness host.
Update workspace manifests, static invariant guards, CI workflows, and
AGENTS.md files.
2026-11-27 06:55:47 +09:00
DarkSky d619bfbcda feat(preview): add pure-Rust offline preview kernel crate 2026-11-27 06:55:47 +09:00
DarkSky 6f9f1cace5 refactor(workspace): dissolve native-playground into domain directories 2026-11-27 06:55:47 +09:00
DarkSky c245d8e1f7 feat(server): add domain, mail, blob, sync services and writing rules
Add server-domain, server-mail, server-blob, and server-sync under packages/backend with y-octo 0.4.0.
Wire auth, blob, mail worker, and Socket.IO routes into server-http and affine-server.
Extend the parity harness and CSF frame audit checks.
Fix mail error redaction, expired terminal error codes, database clock reads in blob checks, and permission docs.
Add the STE writing skill and update AGENTS.md rules.
2026-11-23 16:04:20 +09:00
DarkSky b375374c7f refactor(server): move server crates under packages/backend and upgrade y-octo to 0.4.0
Move the server Rust workspace directly under packages/backend.
Exclude native and server from that workspace.
Move frame-audit to tools/frame-audit as a standalone crate.
Isolate packages/backend/native under the root workspace.
Upgrade y-octo to 0.4.0 in native-playground and remove the old removal workarounds.
Update CI workflows, static gates, and docs for the new paths.
2026-11-23 15:12:26 +09:00
DarkSky 82e166f49b test(parity): frozen v0.27.5 self-parity run, web build lane, fewer waitForTimeout
Parity harness:
- `compare` re-runs the comparison on a recorded report offline through
  the same protocol/database/effects path as live runs, and like `run`
  rejects scenarios without steps.
- `require` lists per-side checks (equals, length, contains); an unmet one
  is a difference at /require/<side><pointer>, so two sides failing the
  same way are never green.
- Timestamps also accept RFC 2822 HTTP dates (cookie Expires), with both
  sides in the same format.
- Socket.IO `record_events` limits which pushed events are reported;
  `wait_event` still sees all of them.
- scripts/run-v0275-self-parity.mjs boots two @affine/server instances of
  the checkout given by --server-root (the frozen baseline,
  darksky/before-stable-fix c2929acf2d) on
  leased PG16 clones, two Redis containers, two SMTP capture ports and
  separate HOMEs, in a run directory of its own; runs the data migrations,
  validate-cutover and workspace lifecycle activation; replays
  scenarios/v0275-self-parity.json (/info, GraphQL setup/auth/workspace/
  quota, Socket.IO join/push/load, a real test mail) and requires 0
  differences across protocol, all user tables, SMTP and Redis plus every
  requirement (doc accepted and stored, schema_baseline_0275 checkpoint,
  one mail, invalidation and event bus messages), then a tampered
  right-side DB row and GraphQL field reported at exactly their paths.
  Only a passing run writes --record, atomically, with the server SHA;
  cleanup failures fail the run; a temporary static manifest is removed.
- tests/v0275_self_parity.rs replays a committed recording of the frozen
  baseline, injects one change per dimension and checks that both sides
  losing the same results fail their requirements.

CI:
- np-web-build.yml builds @affine/web, @affine/mobile and @affine/admin on
  ubuntu-24.04 without Electron/Playwright/Sentry downloads, each bundle
  within eight minutes, and checks the bundle entry exists;
  native-playground.yml calls it only when frontend sources change.

Test debt:
- Delete the unused blocksuite std inline test helper and the unused
  selectVisibilitySelector; drop sleeps already covered by auto-waiting
  assertions and click(); poll getIndexCoordinate per animation frame.
  waitForTimeout ceiling 378 -> 370.
2026-11-23 13:58:04 +09:00
DarkSky 4a08e49642 feat(ci): add crates/ test harness workspace, shared frame audit and fast CI lanes
- crates/: standalone server-side Rust workspace (resolver 3, edition
  2024, own lock and toolchain 1.98.1)
  - frame-audit: the one serde-only FrameSnapshot schema and audit
    engine; native-playground's ui depends on it by path and re-exports
    it. The six structural rules keep their ids; evidence rules (first-
    line baseline, footer reverse wrap, divider placement, static cursor,
    overlay z-order via renderer hit-test probes, text truncation) report
    missing evidence instead of skipping, and concentric radii reject
    negative and step-limited radii. Old snapshots still load.
  - test-db-harness / affine-test-env: a marker-checked PostgreSQL test
    cluster (explicit URL or a reused machine-wide pgvector container),
    read-only migration-digest templates with Prisma bookkeeping,
    template clones under owner-token leases, and an orphan reaper. Clone,
    heartbeat, release and reap serialize per database on an advisory
    lock and re-check under it; every maintenance connection re-checks
    the cluster marker. Private Redis or a prefix-isolated URL. Images
    pinned to multi-arch digests; only private harness containers of the
    expected run, by full id, can be removed. run.json reports.
- scripts/ci/check-l0-tier-a.mjs: dependency-free gates for crates/
  layering and hygiene, a waitForTimeout/.skip ratchet with per-file
  ceilings, workflow references, pinned test images and .gitignore.
- native-playground.yml: resolve the change base to a commit SHA, call
  np-web-fast.yml (lint, typecheck, Node-only Vitest projects without
  Electron, browser or Rust-binary dependencies) when web sources
  change, and always run L0, the frozen server contract checks, crates/
  and the parity harness (fmt, clippy, tests against real services).
- Web lint and format: the frozen contract artifacts and
  blocksuite/native-playground (checked by its own lane) are ignored via
  .prettierignore, from which .oxlintrc.json is generated; the server
  contract and parity harness scripts are formatted and lint-clean.
- tools/parity-harness/rustfmt.toml keeps the default style there.
- Remove the copilot cron workflows and the skipped migration spec;
  ignore test-results/ and .artifacts/.
2026-11-23 13:58:04 +09:00
DarkSky 033803f1a4 refactor(native-playground): modularize large modules and tighten render hot paths
Split oversized modules across crates/doc and crates/playground into cohesive submodules under 800 non-test lines, enable workspace-wide Rust structure checks in scripts/check-invariants.sh, add solid-quad fast path in WGSL and Metal shaders, remove redundant page viewport background overdraw, and cache theme token lookups.
2026-11-23 13:58:04 +09:00
DarkSky ebc5eb6fb2 feat(native-playground): add interactive edgeless authoring and polish 2026-11-23 13:58:04 +09:00
DarkSky 5565057fb6 feat(playground): read and render typed whiteboard surfaces 2026-11-23 13:58:04 +09:00
DarkSky ba55dd7058 feat(native-playground): add GPU 2D transforms, procedural dot-grid, and Edgeless Note/Frame/Text canvas
Add GPU paint transform and local content-mask stacks across Metal, wgpu, and WebGL2 shaders, quarter-octave glyph zoom bucketing, and procedural single-draw-call dot-grid backgrounds in crates/ui (plus TextSystem::line_gap).

Implement the Edgeless spatial canvas (camera, dot-grid, Surface-parented Frame and EdgelessText, Note scale/collapse/style parity, cached per-note BlockFlow with zero pan/zoom relayouts, and zoom bar), register edgeless_1k_pan_zoom_blocks_relayout in perf/compare-n3.mjs, and add cross-backend headless regression tests and Chromium WebGL2 smoke assertions.
2026-11-23 13:58:04 +09:00
DarkSky 5b82831fd8 feat(native-playground): add slash menu, formatting toolbar, drag handle, and interactive block controls
Page mode gains its floating controls on top of the page editor: a slash menu typed in the document, a formatting toolbar over the text selection, a gutter drag handle with a drop indicator, and clickable to-do boxes, toggle and heading chevrons and a code copy button. The editor stays the single owner of the selection, the caret and text edits; every overlay edit goes through its `PageDocSession`, is one undo step, and reaches a live room like any other editor commit.

- crates/playground `overlays.rs` (new): `Overlays` takes an `OverlayScene` (page snapshot, world-space layout, window geometry) with an `OverlayEvent` or a key and answers with `OverlayEffects` (document edits, clipboard text, a timer to start). The `PlaygroundView` glue at the end of the file feeds it input and carries the effects out; `dispatch_overlay` is the entry for pointer listeners, hosts and tests. The overlays read the editor's selection as a `SelectionFormat` (its box, the marks every selected unit carries, the shared alignment) and paint no caret or selection of their own.
- Pointer and keys: a press on the page dismisses the slash menu, the link field and a block drag and then goes to the editor; moves and the release are handled at the window root, so a drag continues outside the page, and a pointer on an open popover does not change the hovered block under it. `editor_key_down` offers every key to the overlays first: an open link field takes every key but the ones that type text, the slash menu takes `Up`, `Down`, `Tab`, `Shift+Tab`, `Enter` and `Escape`, and the rest is the editor's.
- Slash menu: typing `/` at a caret in paragraph or list text, outside inline code, opens the menu on that character, remembered as a relative position, so text a peer inserts before it moves the menu along. The text between the `/` and the caret is both document text and the filter; the menu closes when the caret leaves that text, whitespace follows the `/`, or the character at the position is no longer that `/` (deleted, or deleted and typed again by a peer). Running an item is one `structural_edit` after BlockSuite's `updateBlockType` and `appendDivider`: it removes the typed command, then a paragraph type, a list type or code converts the block with the text it has left (in place within a flavour, as a fresh block across flavours), and a divider goes right below the block, followed by an empty paragraph when the block was the last of its parent. One undo restores the typed command. `Tab` and `Shift+Tab` step through the items, and `Enter` without a match closes the menu without splitting the block. `OpenSlashMenu` keeps a menu with a query row of its own for hosts. Items follow BlockSuite's order in two groups with all six headings listed; each icon sits in a bordered 28 px box; the menu is 8 px round with 4 px padding and 4 px rows, without a border, scrolls under a cap with a thumb and keeps a `No results` row.
- Formatting toolbar: bold, italic, underline, strikethrough, inline code, a link field with `Apply` / `Remove`, and left / center / right alignment above a finished, non-empty selection of paragraph and list text, in one block or across blocks; a selection touching the title or code gets none. It waits while the button of a plain press is held and opens at once on a double or triple click. Marks use the editor's `format_mark`; a link and an alignment run in one `structural_edit`, the alignment on every selected paragraph and list block, empty ones included, and a block that sets no alignment reads as its nearest aligned ancestor's.
- Link field: `LinkBar` is a one-line text input with its own text, selection and input-method composition. While it is open it is the view's text input: every `EntityInputHandler` call goes to it, the document's text, selection and composition stay untouched until `Apply`, and the platform is told whenever it opens, closes or changes. Caret keys, deletion, select-all, copy and cut edit the field, `Escape` abandons a composition before it closes the field, and a keyboard paste reads the clipboard where the platform can; in a browser the key keeps its default action so the `paste` event that follows reaches the field.
- Drag handle: shown for the hovered or dragged block, 24 px left of it and at least 4 px from the window edge, one step further out beside a heading's collapse chevron. It draws BlockSuite's grabber, a 4 × 12 px bar that turns into two columns of dots on a pill under the pointer or in a drag. A drag picks the nearest slot among the block's siblings, looked up in one pass over the layout, and drops through `reparent_block`, so numbered runs are renumbered.
- Block controls: 24 px targets toggle `prop:checked` and `prop:collapsed` as isolated undo steps; the chevron turns over 150 ms. A hovered code block offers a copy button that reads `Copied` for 1.5 s on the scheduler clock, and a sideways scroll moves the lines of an unwrapped code block instead of the page; the caret, the selection, the bounds given to the input method, collaborators' carets and selections, and pointer hit-testing follow that scroll and stay inside the code area.
- Positioner and motion: the pure, screen-space `place_popover` places a popover `Above` (centered) or `BelowStart` its anchor, flips it at the top bar and the window bottom, and clamps it inside the edge margins on the pixel grid. Popovers fade with an ease-out cubic `EaseOut` evaluated at scheduler time; a fully transparent popover is not mounted, and one fading out carries no listeners.
- crates/playground `editor_session.rs`: the first selection box records `page.selection`; typing `/` reports its position to the overlays, and a remote update moves the typed slash menu with its character; the input handler answers for the link field while that is open; a dropped selection publishes an empty `<pageId>:native` awareness entry, so peers stop drawing the caret and keep the name and color.
- crates/playground `block_flow.rs`: `page_elements` takes a `PagePaint` (a chevron in flight, a code block's scroll); `ScrolledCode` maps carets and selection boxes onto the scrolled lines of a code block; `BlockBody` exposes its chevron and `code_scroll` range, and `PageViewport` maps world rectangles into the viewport element.
- crates/playground `theme.rs`: `PlaygroundTheme::shadows` parses the `--affine-*-shadow` tokens, and `IconPaint::paint_rotated` turns an icon around its center.
- crates/doc: `PageDocSession::correct_numbered_order_from` is public, for a numbered item inserted by a command; `bs_doc_driver` learns the `reorder`, `align` and `link` structural edits.
- `bs-harness`: `render --state <name>` renders one overlay state of the showcase, `audit-states` audits every state in both themes at 1280 px and 320 px, `fps-check` also replays the slash menu and the formatting toolbar opening and closing at 60, 120, 24 and 7 fps, and `record-demo <dir>` writes the audited frames of a 60 fps walk through typing, composition, the slash menu, the toolbar, the block controls and undo.
- `scripts/web-smoke.mjs` opens the link field over a selection in Chromium and checks composition, the paste key and the `paste` event against the hidden textarea, and that the paragraph is untouched afterwards.
- `perf/accepted.json` acknowledges the larger Web bundle and headless binary.
- Tests: popover placement and flipping, easing end states, slash filtering and grouping, typed commands on empty and non-empty blocks with one-step undo, a typed `/` followed through a peer's concurrent edits, slash menu keys, mouse selection into toolbar marks, links and alignment across blocks, the link field as a text input with composition, block controls, code scrolling with local and remote carets, drag reordering, popover hover shielding, narrow windows, overlay edits and a cleared selection reaching the peers of a live room, and the JS room-sync suite observing a native reorder, alignment and link.
2026-11-23 13:58:04 +09:00
DarkSky 222d6d6de0 Add collaborative rich-text editing to the native page 2026-11-23 13:58:04 +09:00
DarkSky bdad4ecff5 feat(native-playground): add BlockFlow page renderer, light/dark themes, and live room sync
Renders any page document in Page mode from the same y-octo CRDT state the JavaScript editor edits, in both themes, on macOS, Linux headless and the Web.

- crates/doc: typed read snapshot (`read.rs`, `PageDocSession::read_page_snapshot`) returning an ordered `PageSnapshot` tree for every supported block flavour with the normalized JSON of each `prop:*`, numbered-list run indices, `prop:textAlign`, the note display modes by their wire values (`both` / `doc` / `edgeless`), detached blocks and lossless `Unknown` blocks; `add_raw_block` for flavours without a typed spec; the room hub now forwards the equal-clock live-to-`null` awareness removal once the last owning connection releases a client; `RoomAwareness::reannounce_local_payload` lands a reconnecting client above the tombstone the relay wrote for it.
- crates/playground `theme.rs`: `PlaygroundTheme::{Light, Dark}` resolved from the generated `tokens.rs` / `icons.rs` (included, never copied), `IBM Plex Mono` registered next to `Inter`, and a top bar theme toggle.
- crates/playground `block_flow.rs`: world-space `BlockFlow` layout mapped to the screen by `PageViewport`, with per-block reuse across passes. Title, paragraphs and headings, quotes, nested bulleted / numbered / to-do / toggle lists, dividers, code, images, bookmarks and unknown-block cards follow BlockSuite's page metrics (collapsing margins, first-line list prefixes, heading letter spacing, 944px container narrowing below 640px). Text alignment is inherited by nested children, a collapsed heading hides its own children and the siblings under it, and remote carets, selections, name tags and presence badges are drawn from `selectionV2` entries of the shown page only.
- crates/playground `rich_text.rs`: `RichParagraph` is the one rich-text engine. `BlockFlow` lays out and paints paragraph and list text with it (`LaidOutRichParagraph::paint_at`) and reads remote carets and selections from its geometry. It now resolves `color` and `background` marks through the theme, follows CSS `bolder`, paints the generated `LinkedPageIcon` for references, wraps a reference as one inline object so the words before it stay on their line, aligns lines left, center or right together with their carets and decorations, and takes its code box metrics from constants a test keeps equal to `tokens/style-oracle.json` instead of embedding the oracle.
- crates/playground `room_client.rs`: sans-I/O `RoomProtocol` for the relay's binary room protocol with `tokio-tungstenite` (`--room` / `--relay`) and browser `WebSocket` (`?room=&ws=`) transports, blob fetch (a bare HTTP/1.1 `GET` over TCP natively, `fetch` on the Web) and reconnect with backoff. Native transports reject `wss://` / `https://` relays up front, and a pending connect times out and never holds up blob fetches or shutdown.
- Images decode PNG, JPEG, WebP, GIF and BMP once; bytes that are no image stay unavailable. A blob the page references before its upload finished is fetched again on the scheduler clock with a backoff capped at 4 s for as long as the page references it, showing `Loading image`, then `Image unavailable`, then the image.
- Deterministic `seed_showcase_doc` workspace when no room is given; `bs-harness render` gains `--theme light|dark` and `--mode page|edgeless`.
- `scripts/web-smoke.mjs` gains `--query` and `--min-title-ink` so a page that arrives over a live room is captured after it rendered.
- `perf/accepted.json` acknowledges the larger Web bundle and headless binary; the comparator's gate self-test no longer depends on the repository's acceptance file.
- Tests: token and block metrics against `tokens/style-oracle.json` in both themes on constants and rendered frames, showcase and edge-content audits across viewports down to 320px, scroll mapping, incremental relayout, text alignment with an inherited child and a remote caret, selection key matching, and live in-process relay tests covering edits, blobs, awareness, a blob uploaded after its image block, and presence after a reconnect.
- @blocksuite/playground: `reusePartialSeedDoc` keeps `doc.load(initFn)` initializers working when a promoted seed winner fills a partially seeded doc (a bare `load()` leaves the initializer for the `load(initFn)` that follows), and `initRoomDocWithSeed` rejects a winner whose seed leaves no `affine:page` root.
2026-11-23 13:58:04 +09:00
DarkSky 25a35c83b8 feat(native-playground): lay out and paint rich paragraphs 2026-11-23 13:58:03 +09:00
DarkSky 4e26a040ee feat(native-playground): add y-octo doc engine, binary room sync, and unified workspace
Unifies the 3-crate native-playground workspace (ui, doc, playground) with:
- crates/doc (#![forbid(unsafe_code)], y-octo 0.3.0, 53-bit JS-safe client IDs, full block & surface element schemas with 0-writeback defaults, blocks-scoped undo/redo with SelectionSnapshot, deterministic RoomAwareness with BlockSuite TextSelectionState, Sans-I/O binary room framing, Axum room hub / bs-relay with WS-only seed-claim FIFO waiter promotion & equal-clock awareness refcount hardening & permissive blob CORS, and bs_doc_driver).
- @blocksuite/sync DocPeer finishPull listener ordering (preserving 0-writeback while capturing mid-handshake edits) and pendingIncomingUpdates subdoc buffer.
- @blocksuite/playground RoomWebSocketClient (+2 awareness clock re-announce on reconnect, disconnect removal before detaching listener, socket-only detached offline fallback, in-place Proxy reuse for partial-seed recovery without destroying shared subdocs, winner flush & non-winner affine:page root wait, ?ws= relay origin forwarding to MockServerBlobSource) + live Rust-JS E2E convergence suite.
- Real doc_1k_edits_ms and room_sync_1k_ops_ms benchmarks in bs-harness bench.
- Updated check-invariants.sh (doc GUI isolation + forbid(unsafe_code)), AGENTS.md active invariants, and native-playground CI workflow (wasm32 doc check, macOS doc tests, and parallel js-room-coop job).
2026-11-23 13:58:03 +09:00
DarkSky 74bcafa70f feat(native-playground): add N-3 perf guardrail, theme/style oracle, and CI self-tests 2026-11-23 13:58:03 +09:00
DarkSky dbe1e2f2c7 feat(native-playground): headless GPUI harness, variable Inter weights, web bundle, and CI gates
- Prune undeclared cfg gates in crates/ui and enforce unexpected_cfgs = deny
- Restore lean HeadlessPlatform driving real PlaygroundView via Window::draw()
  and Element::paint() FrameSnapshot capture (removing shadow scene builder)
- Restore PlatformWindow::draw invocation in Window::present for desktop and web
- Support OpenType variable-font 'wght' axis across CosmicTextSystem (Linux and
  WebAssembly) and AppleTextSystem (macOS CoreText) with Bold vs Regular advance
  width and rasterized ink unit test
- Bundle tracked Inter variable font in crates/playground across macOS, Linux,
  and WebAssembly; add minimal Web HTML harness and headless Chromium smoke test
- Unify animation time onto TestScheduler / BackgroundExecutor::now() and verify
  60/120/24/7 fps PlaygroundView pill transitions with identical terminal snapshots
- Add warm 30-frame steady-state bench with schema-aligned ci_wall_ms object,
  optional unmeasured v1 metric fields, and strict 40-hex commit resolution
- Commit Cargo.lock, enforce --locked in CI, harden check-invariants.sh link-flag
  check, align CI wasm-bindgen CLI with Cargo.lock, and keep AGENTS.md exact
2026-11-23 13:58:03 +09:00
Mohamed Hussein a2dbbec72b fix(editor): keep select all in the equation editor on Firefox (#15858)
Fixes #15643

## Problem

In Firefox, pressing Ctrl+A in the LaTeX editor popup (inline equation
or equation block) selects the formula for a moment, then the selection
disappears. After that, typing has no effect. Chromium works.

Two things go wrong on Firefox:

1. **The select-all is dropped.** Firefox places the native select-all
range on the inline root rather than on text nodes. The editor's range
sync (`RangeBinding._onNativeSelectionChanged`) removes ranges whose
endpoints aren't inside a `v-text`. Table and database cells already
handle `Mod+A` themselves with `inlineEditor.selectAll()`, but the popup
didn't.
2. **Input over a full selection goes to the end.** Even with a proper
selection, Firefox's `beforeinput` `getTargetRanges()` starts at the
inline root (for example `DIV[data-v-root]@2`, just before the
`v-line`). That point resolves to the end of the text.
`EventService._onBeforeInput` then lets the target range replace the
native one, so `a+b=c` + `x` became `a+b=cx` instead of `x`, and
Backspace did nothing.

## Fix

- `LatexEditorMenu` handles `Mod+A` with `inlineEditor.selectAll()` and
stops the event, the same way `table-cell.ts` and the database cell
renderers do.
- `EventService._onBeforeInput` uses the target range only when the
native selection is collapsed. A non-collapsed selection is exactly what
the input replaces. Target ranges are still used for collapsed
selections, e.g. word deletion and the embed/empty-line case above it.

## Testing

- New unit test in `event-beforeinput.unit.spec.ts`. It selects the
whole text and feeds a Firefox-shaped target range that starts at the
inline root.
- Without the `event.ts` change it fails with `expected 'a+b=cx' to be
'x'`, the same result as in Firefox.
  - With the change it passes.
- `yarn vitest run` in `blocksuite/framework/std`: 12 files, 102 tests
pass.
- `oxlint --deny-warnings` and `oxfmt --check` pass on the changed
files, and `tsc -b blocksuite/affine/inlines/latex/tsconfig.json`
passes.
- I couldn't run a patched build in Firefox. Instead I checked both
changes in Firefox and Chromium (Playwright, headless) on
app.affine.pro, using a guest doc and injecting equivalent handlers into
the page. With both changes, Ctrl+A in the inline equation editor keeps
`a+b=c` selected, typing `x` gives `x`, and Backspace clears it. Without
them, Firefox shows the bug described in the issue.


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

* **Bug Fixes**
* Select-all now works in the LaTeX editor with the platform’s standard
keyboard shortcut.
* Fixed text replacement after selecting all, including cases where the
browser reports the selection from the start of the editor.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-11-20 18:23:36 +08:00
DarkSky dc2b221244 fix(editor): resolve doc title with references (#15865)
fix #15850



#### PR Dependency Tree


* **PR #15865** 👈

This tree was auto-generated by
[Charcoal](https://github.com/danerwilliams/charcoal)

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

* **New Features**
* Search results now include database rows that reference matching
documents, showing the referenced document’s current title.
* Linked-document titles appear consistently in database title and
rich-text values, including after a title changes.
* Search includes ordinary text matches alongside linked-document
references and supports retrieving additional results.
* **Bug Fixes**
* Rows referencing unavailable documents are not presented as
linked-title matches.
* If linked-row lookup fails, ordinary document search results remain
available.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-11-17 18:05:20 +08:00
DarkSky 1433ac7b35 fix(editor): malformed database cells at the read boundary (#15809)
fix #15746



#### PR Dependency Tree


* **PR #15809** 👈

This tree was auto-generated by
[Charcoal](https://github.com/danerwilliams/charcoal)

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

* **Bug Fixes**
* Database cells with values that don’t match their property type now
display the property’s default value instead of appearing empty or
undefined. Valid values continue to display as before, and the stored
cell value is not changed. This provides a more consistent display for
affected cells while preserving existing behavior for valid data.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-11-08 22:20:11 +08:00
Arnaud A. a2d15841a5 fix(editor): handle empty column names in kanban view (#15807)
## Description

Allows columns and tags with empty or whitespace names to remain visible
and clickable in Kanban and Table views.

- Display fallback `"Untitled"` label and placeholder when tag name is
empty or whitespace.
- Set minimum height on `SelectGroupView` tag pill to prevent height
collapse.
- Add unit test verifying fallback rendering.

<img width="519" height="633" alt="image"
src="https://github.com/user-attachments/assets/1fed7a72-5154-4dcb-a5f8-a7c6f6ac132f"
/>


Closes #15805
2026-11-08 22:19:53 +08:00
Leo Camus 4ac16368e6 fix(core): keep fractional index keys below the next key (#15709)
## Description

`generateFractionalIndexingKeyBetween(a, b)` can return a key that sorts
after `b`.

When the subkeys of `a` and `b` share a prefix, the key is built as
`generateKeyBetween(a, b) + '0' + postfix()`. If `b` itself starts with
`generateKeyBetween(a, b) + '0'`, the order against `b` is decided by
the random postfix. For example, with `a =
Zz0KDAn9nhfbtFAOnyTqT45wXkV4SGW7XBh` and `b =
Zz10c5IY1TbnCK75NE22mfQEp2rpu6q1n6Z7`, `generateKeyBetween(a, b)` is
`Zz1` and the returned key was `Zz10UESACG9CHEXJNxgEDqhyCILR7N91EmcV`,
which is greater than `b`.

This is easy to reach from the UI helpers: `FolderNode.indexAt('after',
firstId)`, the favorites list, pinned collections, workspace properties
and table rows/columns all call it with their neighbours and sort with a
plain string compare. Starting from an empty list, adding one item
before the first and then repeatedly inserting right after the first
item breaks the order in 1000 out of 1000 runs within 20 inserts; the
inserted item ends up after its intended next neighbour.

The fix keeps stepping towards `b` with `generateKeyBetween(key, b)`
while `b` still starts with `key + '0'`, so the appended postfix can no
longer push the key past `b`. Each step lengthens the shared prefix with
`b`, so the loop ends. Both copies of the helper (`@toeverything/infra`
and `@blocksuite/affine-shared`) get the same change.

Proof: the added tests in `fractional-indexing.spec.ts` and
`fractional-indexing.unit.spec.ts` insert right after the first key 50
times, 100 rounds each. Before the fix both fail (`key < b` is false);
after, both pass across 5 reruns. I also fuzzed 1500 sequences of 200
inserts with mixed insertion strategies: 677 ordering violations before,
0 after, no throws.
2026-11-08 16:11:08 +08:00
Wei-Lun Li 2e0f1156dd fix(editor): keep numbered list start number in markdown and html export (#15726)
## Description

Closes #14098

When a numbered list doesn't start at 1 (for example it picks up at 3
after a paragraph or a code block), AFFiNE keeps that number in the list
block's `order` prop. Importing markdown/html already reads the list's
start number into `order`, but the markdown and html exporters never
wrote it back, so the exported list always restarted at 1.

This sets `start` on the exported markdown list / `<ol>` from the first
item's `order` when it's above 1. Lists that start at 1, or older blocks
without `order`, export exactly as before. I added a test for each
exporter; the markdown one is the reverse of the existing "non
consecutive numbered list" import test. PDF export already used `order`,
so it wasn't affected.
2026-11-08 16:10:09 +08:00
DarkSky e1261c40bf chore: bump deps (#15795) 2026-11-06 00:58:55 +08:00
DarkSky 3b41302757 fix(editor): preserve canvas input ownership in table selection (#15791)
fix #15770
fix #15605


#### PR Dependency Tree


* **PR #15791** 👈

This tree was auto-generated by
[Charcoal](https://github.com/danerwilliams/charcoal)

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

* **Bug Fixes**
* Text insertion at the end of a table cell now produces the expected
cell content while keeping the table selection consistent.
* Selecting and clearing a table column no longer changes an unrelated
canvas selection in edgeless mode. In page mode, clearing the column
selection leaves the graphics selection empty.
* These selection behaviors are verified in both page and edgeless
modes.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-11-04 22:18:36 +08:00
DarkSky 91ac3ca384 fix(editor): prevent code menu switches from toggling twice (#15782)
fix #15706
fix #15336
fix #15760
fix #15314

#### PR Dependency Tree


* **PR #15782** 👈

This tree was auto-generated by
[Charcoal](https://github.com/danerwilliams/charcoal)

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

* **Bug Fixes**
* Fixed the code block’s wrap and line-number switches so their
displayed states stay in sync with the selected settings.
* Clicking a switch’s label or control now applies the setting
consistently, and the menu remains open while toggling.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-11-02 21:43:59 +08:00
DarkSky e32f8dce04 chore: bump deps (#15729)
#### PR Dependency Tree


* **PR #15729** 👈

This tree was auto-generated by
[Charcoal](https://github.com/danerwilliams/charcoal)

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

* **Deployment**
* Updated the Cloud SQL Proxy image and integrated it with deployment
charts.
* Containers now run with stricter security settings, including non-root
execution and read-only filesystems.
* **Desktop**
* Updated Electron and Node versions and adjusted Windows builds to
support multiple architectures.
* **Maintenance**
  * Updated Vite and Storybook versions across development tools.
  * Improved production GraphQL schema handling.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-10-22 16:38:31 +08:00
DarkSky 9be1a8284a feat: bump deps (#15698)
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **New Features**
* Workspace selection, creation, and navigation after import now use
consistent view transitions, including in browsers without native
transition support.
* **Chores**
* Updated supporting components for mathematical notation, diagrams,
desktop functionality, and backend services.
* Refreshed tools used by the app and its documentation, including
components for error reporting and GraphQL operations. These updates do
not change the rendered equations.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-10-10 23:28:25 +08:00
DarkSky 1e725357af fix(native): improve obsidian & onenote import (#15695)
fix #15659
fix #15629

replace #15640

#### PR Dependency Tree


* **PR #15695** 👈

This tree was auto-generated by
[Charcoal](https://github.com/danerwilliams/charcoal)

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **Import Improvements**
* Repeated imports now update existing documents without duplicating
folder links, while preserving existing dates and metadata.
* Invalid document snapshots are rejected without replacing previously
imported content.
  * Existing folders with matching names are reused during import.

* **Removed Support**
  * OneNote file and notebook imports are no longer available.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-10-10 17:56:47 +08:00
renovate[bot] 1c90d02b0c chore: bump up katex version to ^0.18.0 [SECURITY] (#15680)
This PR contains the following updates:

| Package | Change |
[Age](https://docs.renovatebot.com/merge-confidence/) |
[Confidence](https://docs.renovatebot.com/merge-confidence/) |
|---|---|---|---|
| [katex](https://katex.org)
([source](https://redirect.github.com/KaTeX/KaTeX)) | [`^0.16.27` →
`^0.18.0`](https://renovatebot.com/diffs/npm/katex/0.16.47/0.18.2) |
![age](https://developer.mend.io/api/mc/badges/age/npm/katex/0.18.2?slim=true)
|
![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/katex/0.16.47/0.18.2?slim=true)
|

---

### KaTeX: Existing prototype pollution can bypass trust restrictions
[CVE-2026-103923](https://nvd.nist.gov/vuln/detail/CVE-2026-103923) /
[GHSA-238p-pmpm-9mq7](https://redirect.github.com/advisories/GHSA-238p-pmpm-9mq7)

<details>
<summary>More information</summary>

#### Details
##### Impact

KaTeX can act as a read-side prototype pollution gadget in applications
where `Object.prototype` has already been polluted, or where an attacker
can influence the prototype of the renderer options object. (KaTeX does
not enable said prototype pollution. This advisory applies when
combining KaTeX with other vulnerable software that allows for prototype
pollution.)

Affected versions may treat inherited properties from `Object.prototype`
as renderer options, internal setting metadata, or namespace entries. In
particular, an inherited `trust` value will be treated as though the
application explicitly enabled trusted rendering, rather than using the
documented default of `false`.

With attacker-controlled mathematical expressions, this can produce
links capable of user-interaction cross-site scripting or load
attacker-selected external resources. Exploitation requires the
consuming application to insert KaTeX output into a web page without a
separate sanitizer. (KaTeX does not execute scripts merely by rendering
an expression.)

Other inherited settings can alter rendering behavior or resource
limits. Inherited setting metadata can affect how defaults and supplied
options are processed, while inherited namespace properties can be
mistaken for defined macros or other internal values.

##### Patches

Upgrade to KaTeX v0.18.2 to remove this vulnerability.

##### Workarounds

- Address any prototype-pollution vulnerability in the application or
its dependencies.
- `delete Object.prototype.trust`, `delete Object.prototype.default`,
and `delete Object.prototype.processor` before calling KaTeX
- Do not allow untrusted input to control the renderer options object or
its prototype.
- Sanitize KaTeX-generated HTML before inserting it into a document.

##### Details

KaTeX previously used ordinary JavaScript property access in the
following contexts:

- Renderer settings could be inherited from the prototype of the options
object.
- Internal `default` and `processor` setting metadata could be inherited
from `Object.prototype`.
- Namespace lookup could treat inherited properties as built-in
definitions.
- Namespace group restoration could preserve an inherited property as
though it had been an explicitly defined value.

The fix adds own-property checks to each of these paths. Inherited
properties are no longer accepted as renderer settings, setting
metadata, namespace definitions, or values to be restored after a group
ends.

##### For more information

If you have any questions or comments about this advisory:

- Open an issue or security advisory in the [KaTeX
repository](https://redirect.github.com/KaTeX/KaTeX/)
- Email us at [katex-security@mit.edu](mailto:katex-security@mit.edu)

#### Severity
- CVSS Score: 2.1 / 10 (Low)
- Vector String:
`CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:A/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N`

#### References
-
[https://github.com/KaTeX/KaTeX/security/advisories/GHSA-238p-pmpm-9mq7](https://redirect.github.com/KaTeX/KaTeX/security/advisories/GHSA-238p-pmpm-9mq7)
-
[https://nvd.nist.gov/vuln/detail/CVE-2026-103923](https://nvd.nist.gov/vuln/detail/CVE-2026-103923)
-
[https://github.com/KaTeX/KaTeX/pull/4260](https://redirect.github.com/KaTeX/KaTeX/pull/4260)
-
[https://github.com/KaTeX/KaTeX/commit/0adf7e77db6915d991803b29699f82b1ccf8d4f4](https://redirect.github.com/KaTeX/KaTeX/commit/0adf7e77db6915d991803b29699f82b1ccf8d4f4)
-
[https://github.com/KaTeX/KaTeX/releases/tag/v0.18.2](https://redirect.github.com/KaTeX/KaTeX/releases/tag/v0.18.2)
-
[https://github.com/advisories/GHSA-238p-pmpm-9mq7](https://redirect.github.com/advisories/GHSA-238p-pmpm-9mq7)

This data is provided by the [GitHub Advisory
Database](https://redirect.github.com/advisories/GHSA-238p-pmpm-9mq7)
([CC-BY
4.0](https://redirect.github.com/github/advisory-database/blob/main/LICENSE.md)).
</details>

---

### Release Notes

<details>
<summary>KaTeX/KaTeX (katex)</summary>

###
[`v0.18.2`](https://redirect.github.com/KaTeX/KaTeX/blob/HEAD/CHANGELOG.md#0182-2026-08-08)

[Compare
Source](https://redirect.github.com/KaTeX/KaTeX/compare/v0.18.1...v0.18.2)

##### Bug Fixes

- prevent prototype pollution in settings
([#&#8203;4260](https://redirect.github.com/KaTeX/KaTeX/issues/4260))
([0adf7e7](https://redirect.github.com/KaTeX/KaTeX/commit/0adf7e77db6915d991803b29699f82b1ccf8d4f4))

###
[`v0.18.1`](https://redirect.github.com/KaTeX/KaTeX/blob/HEAD/CHANGELOG.md#01811-2026-10-01)

[Compare
Source](https://redirect.github.com/KaTeX/KaTeX/compare/v0.18.0...v0.18.1)

##### Features

- handle character metrics warnings via `strict`
([#&#8203;4243](https://redirect.github.com/KaTeX/KaTeX/issues/4243))
([4237070](https://redirect.github.com/KaTeX/KaTeX/commit/423707055a37803acafef4c1533832273192ea0e))

###
[`v0.18.0`](https://redirect.github.com/KaTeX/KaTeX/blob/HEAD/CHANGELOG.md#0180-2026-07-17)

[Compare
Source](https://redirect.github.com/KaTeX/KaTeX/compare/v0.17.0...v0.18.0)

##### Features

- prefix css classes
([#&#8203;4229](https://redirect.github.com/KaTeX/KaTeX/issues/4229))
([6f5c44f](https://redirect.github.com/KaTeX/KaTeX/commit/6f5c44f69bae0703877a3a8d934e20c47bbbbc32))

##### BREAKING CHANGES

- users who apply custom styles or have allowlists targeting KaTeX's
internal classes must update their selectors.

###
[`v0.17.0`](https://redirect.github.com/KaTeX/KaTeX/blob/HEAD/CHANGELOG.md#0170-2026-05-22)

[Compare
Source](https://redirect.github.com/KaTeX/KaTeX/compare/v0.16.47...v0.17.0)

##### Performance Improvements

- simplify `defineFunction` to avoid destructuring, improve typing
([#&#8203;4222](https://redirect.github.com/KaTeX/KaTeX/issues/4222))
([fb604e6](https://redirect.github.com/KaTeX/KaTeX/commit/fb604e6ba63e99809e242d37f9c8359209d55431))

##### BREAKING CHANGES

- The internal API for `__defineFunction` changed: you should no longer
wrap properties in `props`.

####
[0.16.47](https://redirect.github.com/KaTeX/KaTeX/compare/v0.16.46...v0.16.47)
(2026-05-16)

##### Bug Fixes

- correct size of `[` big delimiter
([#&#8203;4217](https://redirect.github.com/KaTeX/KaTeX/issues/4217))
([7ba0027](https://redirect.github.com/KaTeX/KaTeX/commit/7ba0027d2f04abddd3b215362f867ab8260b09d7)),
closes
[#&#8203;4215](https://redirect.github.com/KaTeX/KaTeX/issues/4215)

####
[0.16.46](https://redirect.github.com/KaTeX/KaTeX/compare/v0.16.45...v0.16.46)
(2026-05-13)

##### Bug Fixes

- preserve math font in some styling commands
([#&#8203;4214](https://redirect.github.com/KaTeX/KaTeX/issues/4214))
([e9ee046](https://redirect.github.com/KaTeX/KaTeX/commit/e9ee0464ddb31da9bf9649eeb70e52236e7a974a)),
closes
[#&#8203;4213](https://redirect.github.com/KaTeX/KaTeX/issues/4213)

####
[0.16.45](https://redirect.github.com/KaTeX/KaTeX/compare/v0.16.44...v0.16.45)
(2026-04-05)

##### Bug Fixes

- wrap vcenter mpadded in mrow for valid MathML
([#&#8203;4193](https://redirect.github.com/KaTeX/KaTeX/issues/4193))
([ee66b78](https://redirect.github.com/KaTeX/KaTeX/commit/ee66b78d24340edbbd05b08a4a429ce9ed158b25)),
closes
[#&#8203;4078](https://redirect.github.com/KaTeX/KaTeX/issues/4078)

####
[0.16.44](https://redirect.github.com/KaTeX/KaTeX/compare/v0.16.43...v0.16.44)
(2026-03-27)

##### Bug Fixes

- remove extra \jot space at bottom of align/gather/etc.
([#&#8203;4184](https://redirect.github.com/KaTeX/KaTeX/issues/4184))
([3870ee9](https://redirect.github.com/KaTeX/KaTeX/commit/3870ee913e27fdde7bce244e4c6c5d63e2b28a62))

####
[0.16.43](https://redirect.github.com/KaTeX/KaTeX/compare/v0.16.42...v0.16.43)
(2026-03-26)

##### Bug Fixes

- use makeEm() consistently to truncate long CSS decimals
([#&#8203;4181](https://redirect.github.com/KaTeX/KaTeX/issues/4181))
([0967dcc](https://redirect.github.com/KaTeX/KaTeX/commit/0967dcc0278f20d4501a93f01c7343c70abb3fcd))

####
[0.16.42](https://redirect.github.com/KaTeX/KaTeX/compare/v0.16.41...v0.16.42)
(2026-03-24)

##### Features

- \underbracket and \overbracket
([#&#8203;4147](https://redirect.github.com/KaTeX/KaTeX/issues/4147))
([5be9abb](https://redirect.github.com/KaTeX/KaTeX/commit/5be9abb0b4d687a2a196b8adf9b5b9deeb60f7bc))

####
[0.16.41](https://redirect.github.com/KaTeX/KaTeX/compare/v0.16.40...v0.16.41)
(2026-03-24)

##### Bug Fixes

- \sout in text mode
([#&#8203;4173](https://redirect.github.com/KaTeX/KaTeX/issues/4173))
([e748578](https://redirect.github.com/KaTeX/KaTeX/commit/e748578b63e07ad30d5e404e60b04e5e794c0a5a))

####
[0.16.40](https://redirect.github.com/KaTeX/KaTeX/compare/v0.16.39...v0.16.40)
(2026-03-20)

##### Bug Fixes

- **css:** specify position: relative for .katex
([#&#8203;4170](https://redirect.github.com/KaTeX/KaTeX/issues/4170))
([020f0d8](https://redirect.github.com/KaTeX/KaTeX/commit/020f0d89567d59229bac5fc8d8f5832a9508a85f))

####
[0.16.39](https://redirect.github.com/KaTeX/KaTeX/compare/v0.16.38...v0.16.39)
(2026-03-19)

##### Bug Fixes

- middle dot in text mode
([#&#8203;4169](https://redirect.github.com/KaTeX/KaTeX/issues/4169))
([edb45b0](https://redirect.github.com/KaTeX/KaTeX/commit/edb45b0b17c7b33349ce5142fe39156da05cb4d8)),
closes
[#&#8203;3641](https://redirect.github.com/KaTeX/KaTeX/issues/3641)

####
[0.16.38](https://redirect.github.com/KaTeX/KaTeX/compare/v0.16.37...v0.16.38)
(2026-03-08)

##### Bug Fixes

- accent skew mixed with font specifiers
([#&#8203;4159](https://redirect.github.com/KaTeX/KaTeX/issues/4159))
([aea3375](https://redirect.github.com/KaTeX/KaTeX/commit/aea33758d6c98896017007d0244885301773856a)),
closes
[#&#8203;4121](https://redirect.github.com/KaTeX/KaTeX/issues/4121)

####
[0.16.37](https://redirect.github.com/KaTeX/KaTeX/compare/v0.16.36...v0.16.37)
(2026-03-06)

##### Bug Fixes

- negative-width `\hphantom` and symmetric `\smash`
([#&#8203;4153](https://redirect.github.com/KaTeX/KaTeX/issues/4153))
([d4799ca](https://redirect.github.com/KaTeX/KaTeX/commit/d4799cae585d909e2a4e3dedbebdc2f142998ca9))

####
[0.16.36](https://redirect.github.com/KaTeX/KaTeX/compare/v0.16.35...v0.16.36)
(2026-03-06)

##### Bug Fixes

- contrib esm bloat
([#&#8203;4157](https://redirect.github.com/KaTeX/KaTeX/issues/4157))
([2bde1ad](https://redirect.github.com/KaTeX/KaTeX/commit/2bde1adab2a23f61519145923329c915b04d4778))

####
[0.16.35](https://redirect.github.com/KaTeX/KaTeX/compare/v0.16.34...v0.16.35)
(2026-03-05)

##### Bug Fixes

- version number regression
([#&#8203;4155](https://redirect.github.com/KaTeX/KaTeX/issues/4155))
([db26b73](https://redirect.github.com/KaTeX/KaTeX/commit/db26b733805f2d0d71e82596475b313c8706557e))

####
[0.16.34](https://redirect.github.com/KaTeX/KaTeX/compare/v0.16.33...v0.16.34)
(2026-03-05)

##### Bug Fixes

- emoji with variation selector
([#&#8203;4151](https://redirect.github.com/KaTeX/KaTeX/issues/4151))
([c2606e5](https://redirect.github.com/KaTeX/KaTeX/commit/c2606e5db91ae199ee1ff0c8c2f7f9f70fcf589b))

####
[0.16.33](https://redirect.github.com/KaTeX/KaTeX/compare/v0.16.32...v0.16.33)
(2026-02-23)

##### Bug Fixes

- **scss:** forward variables to fonts module
([#&#8203;4146](https://redirect.github.com/KaTeX/KaTeX/issues/4146))
([9349a64](https://redirect.github.com/KaTeX/KaTeX/commit/9349a64a051ca408da713baf061e32ade80ed22a))

####
[0.16.32](https://redirect.github.com/KaTeX/KaTeX/compare/v0.16.31...v0.16.32)
(2026-02-22)

##### Bug Fixes

- italic separation in \mathnormal
([#&#8203;4143](https://redirect.github.com/KaTeX/KaTeX/issues/4143))
([71305a0](https://redirect.github.com/KaTeX/KaTeX/commit/71305a05140ca6203092bfdc14f689168b26ab8c))

####
[0.16.31](https://redirect.github.com/KaTeX/KaTeX/compare/v0.16.30...v0.16.31)
(2026-02-22)

##### Bug Fixes

- `\*frac` sizing
([#&#8203;4137](https://redirect.github.com/KaTeX/KaTeX/issues/4137))
([ef51f18](https://redirect.github.com/KaTeX/KaTeX/commit/ef51f18ded4ab9ba54ba750f2866241c4676c41c))

####
[0.16.30](https://redirect.github.com/KaTeX/KaTeX/compare/v0.16.29...v0.16.30)
(2026-02-22)

##### Bug Fixes

- no line breaks after `\not`
([#&#8203;4140](https://redirect.github.com/KaTeX/KaTeX/issues/4140))
([2d1ba86](https://redirect.github.com/KaTeX/KaTeX/commit/2d1ba86143bd45540d5a773cfa456081318f3f33))

####
[0.16.29](https://redirect.github.com/KaTeX/KaTeX/compare/v0.16.28...v0.16.29)
(2026-02-22)

##### Bug Fixes

- `\imath` and other `\html@mathml` macros in arguments
([#&#8203;4139](https://redirect.github.com/KaTeX/KaTeX/issues/4139))
([a850cce](https://redirect.github.com/KaTeX/KaTeX/commit/a850cce7ccbf95a0b187313d1e54d8d40dfc7273))

####
[0.16.28](https://redirect.github.com/KaTeX/KaTeX/compare/v0.16.27...v0.16.28)
(2026-01-25)

##### Bug Fixes

- **type:** add missing types definition path to package.json
([#&#8203;4125](https://redirect.github.com/KaTeX/KaTeX/issues/4125))
([0ef8921](https://redirect.github.com/KaTeX/KaTeX/commit/0ef8921d189346b0ff8f84a77f7f552349b76893))

####
[0.16.27](https://redirect.github.com/KaTeX/KaTeX/compare/v0.16.26...v0.16.27)
(2025-12-07)

##### Features

- support equals sign and surrounding whitespace in \htmlData attribute
values
([#&#8203;4112](https://redirect.github.com/KaTeX/KaTeX/issues/4112))
([c77aaec](https://redirect.github.com/KaTeX/KaTeX/commit/c77aaec00c766f5bb02e332a1dc416b82a65fe8f))

####
[0.16.26](https://redirect.github.com/KaTeX/KaTeX/compare/v0.16.25...v0.16.26)
(2025-12-07)

##### Bug Fixes

- \mathop followed by integral symbol
([6fbad18](https://redirect.github.com/KaTeX/KaTeX/commit/6fbad18857351e4d2a88ed3e3348bd76caad9be3))

####
[0.16.25](https://redirect.github.com/KaTeX/KaTeX/compare/v0.16.24...v0.16.25)
(2025-10-13)

##### Features

- **css:** provide `katex-swap.css` that uses `font-display: swap`
([#&#8203;3940](https://redirect.github.com/KaTeX/KaTeX/issues/3940))
([b3f9ce6](https://redirect.github.com/KaTeX/KaTeX/commit/b3f9ce691e89a52dea7ec8f10cc6ed4ddc8fc161)),
closes
[#&#8203;2242](https://redirect.github.com/KaTeX/KaTeX/issues/2242)

####
[0.16.24](https://redirect.github.com/KaTeX/KaTeX/compare/v0.16.23...v0.16.24)
(2025-10-12)

##### Features

- support hex colors with alpha
([#&#8203;4090](https://redirect.github.com/KaTeX/KaTeX/issues/4090))
([8c9b306](https://redirect.github.com/KaTeX/KaTeX/commit/8c9b3063965acc0d6e6a0b6df4d051169de9e1a9)),
closes
[#&#8203;4067](https://redirect.github.com/KaTeX/KaTeX/issues/4067)
[#fA6](https://redirect.github.com/KaTeX/KaTeX/issues/fA6)
[#fA6f1](https://redirect.github.com/KaTeX/KaTeX/issues/fA6f1)

####
[0.16.23](https://redirect.github.com/KaTeX/KaTeX/compare/v0.16.22...v0.16.23)
(2025-10-03)

##### Bug Fixes

- Support `\def` with arguments via `macros` option
([#&#8203;4087](https://redirect.github.com/KaTeX/KaTeX/issues/4087))
([80a8158](https://redirect.github.com/KaTeX/KaTeX/commit/80a815856a8c26d78b3669e9c05fff00efe82247))

####
[0.16.22](https://redirect.github.com/KaTeX/KaTeX/compare/v0.16.21...v0.16.22)
(2025-04-09)

##### Bug Fixes

- \relax in base or exponent of super/subscript
([#&#8203;4045](https://redirect.github.com/KaTeX/KaTeX/issues/4045))
([1f43c84](https://redirect.github.com/KaTeX/KaTeX/commit/1f43c84a175fb689f8c8d1d72b1e8b896a8b43d1))

####
[0.16.21](https://redirect.github.com/KaTeX/KaTeX/compare/v0.16.20...v0.16.21)
(2025-01-17)

##### Bug Fixes

- escape \htmlData attribute name
([57914ad](https://redirect.github.com/KaTeX/KaTeX/commit/57914ad91eff401357f44bf364b136d37eba04f8))

####
[0.16.20](https://redirect.github.com/KaTeX/KaTeX/compare/v0.16.19...v0.16.20)
(2025-01-12)

##### Bug Fixes

- \providecommand does not overwrite existing macro
([#&#8203;4000](https://redirect.github.com/KaTeX/KaTeX/issues/4000))
([6d30fe4](https://redirect.github.com/KaTeX/KaTeX/commit/6d30fe47b06f9da9b836fe518d5cbbecf6a6a3a1)),
closes
[#&#8203;3928](https://redirect.github.com/KaTeX/KaTeX/issues/3928)

####
[0.16.19](https://redirect.github.com/KaTeX/KaTeX/compare/v0.16.18...v0.16.19)
(2024-12-29)

##### Bug Fixes

- **types:** improve `strict` function type
([#&#8203;4009](https://redirect.github.com/KaTeX/KaTeX/issues/4009))
([4228b4e](https://redirect.github.com/KaTeX/KaTeX/commit/4228b4eb529b8e35def66cc6e4fa467383b98c86))

####
[0.16.18](https://redirect.github.com/KaTeX/KaTeX/compare/v0.16.17...v0.16.18)
(2024-12-18)

##### Bug Fixes

- Actually publish TypeScript type definitions
([#&#8203;4008](https://redirect.github.com/KaTeX/KaTeX/issues/4008))
([629b873](https://redirect.github.com/KaTeX/KaTeX/commit/629b87354fdfc04a3769f09b69f6bbadebcb9ae8))

####
[0.16.17](https://redirect.github.com/KaTeX/KaTeX/compare/v0.16.16...v0.16.17)
(2024-12-17)

##### Bug Fixes

- MathML combines multidigit numbers with sup/subscript, comma
separators, and multicharacter text when outputting to DOM
([#&#8203;3999](https://redirect.github.com/KaTeX/KaTeX/issues/3999))
([7d79e22](https://redirect.github.com/KaTeX/KaTeX/commit/7d79e220f465c42d4334dc95f1c41e333667e168)),
closes
[#&#8203;3995](https://redirect.github.com/KaTeX/KaTeX/issues/3995)

####
[0.16.16](https://redirect.github.com/KaTeX/KaTeX/compare/v0.16.15...v0.16.16)
(2024-12-17)

##### Features

- ESM exports, TypeScript types
([#&#8203;3992](https://redirect.github.com/KaTeX/KaTeX/issues/3992))
([ea9c173](https://redirect.github.com/KaTeX/KaTeX/commit/ea9c173a0de953b49b2ce5d131e88b785f5dffa1))

####
[0.16.15](https://redirect.github.com/KaTeX/KaTeX/compare/v0.16.14...v0.16.15)
(2024-12-09)

##### Features

- italic sans-serif in math mode via `\mathsfit` command
([#&#8203;3998](https://redirect.github.com/KaTeX/KaTeX/issues/3998))
([2218901](https://redirect.github.com/KaTeX/KaTeX/commit/22189018b63c9312ec4ad126804514a7390d60b5))

####
[0.16.14](https://redirect.github.com/KaTeX/KaTeX/compare/v0.16.13...v0.16.14)
(2024-12-08)

##### Features

- \dddot and \ddddot support
([#&#8203;3834](https://redirect.github.com/KaTeX/KaTeX/issues/3834))
([bda35cd](https://redirect.github.com/KaTeX/KaTeX/commit/bda35cdb0a6bbbc52dd27c79e4d984688be3b745)),
closes
[#&#8203;2744](https://redirect.github.com/KaTeX/KaTeX/issues/2744)

####
[0.16.13](https://redirect.github.com/KaTeX/KaTeX/compare/v0.16.12...v0.16.13)
(2024-12-08)

##### Bug Fixes

- `\vdots` and `\rule` support in text mode
([#&#8203;3997](https://redirect.github.com/KaTeX/KaTeX/issues/3997))
([0e08352](https://redirect.github.com/KaTeX/KaTeX/commit/0e0835262345d991df61a435800a16b069a4d5c7)),
closes
[#&#8203;3990](https://redirect.github.com/KaTeX/KaTeX/issues/3990)

####
[0.16.12](https://redirect.github.com/KaTeX/KaTeX/compare/v0.16.11...v0.16.12)
(2024-12-08)

##### Features

- **css:** configurable margin for display math
([#&#8203;3638](https://redirect.github.com/KaTeX/KaTeX/issues/3638))
([3405001](https://redirect.github.com/KaTeX/KaTeX/commit/3405001225b8ee0cf8b35b2e3a6c1fa2191e5fef))

####
[0.16.11](https://redirect.github.com/KaTeX/KaTeX/compare/v0.16.10...v0.16.11)
(2024-07-02)

##### Features

- add \emph
([#&#8203;3963](https://redirect.github.com/KaTeX/KaTeX/issues/3963))
([9f34da4](https://redirect.github.com/KaTeX/KaTeX/commit/9f34da4b3cf228a7af8134c394394d780a089f2b)),
closes
[#&#8203;3566](https://redirect.github.com/KaTeX/KaTeX/issues/3566)

####
[0.16.10](https://redirect.github.com/KaTeX/KaTeX/compare/v0.16.9...v0.16.10)
(2024-03-24)

##### Bug Fixes

- \edef bypassing maxExpand via exponential blowup
([e88b4c3](https://redirect.github.com/KaTeX/KaTeX/commit/e88b4c357f978b1bca8edfe3297f0aa309bcbe34))
- escape \includegraphics src and alt
([c5897fc](https://redirect.github.com/KaTeX/KaTeX/commit/c5897fcd1f73da9612a53e6b5544f1d776e17770))
- force protocol to be lowercase for better protocol filtering
([fc5af64](https://redirect.github.com/KaTeX/KaTeX/commit/fc5af64183a3ceb9be9d1c23a275999a728593de)),
closes
[/datatracker.ietf.org/doc/html/rfc3986#section-3](https://redirect.github.com//datatracker.ietf.org/doc/html/rfc3986/issues/section-3)
- maxExpand limit with Unicode sub/superscripts
([085e21b](https://redirect.github.com/KaTeX/KaTeX/commit/085e21b5da05414efefa932570e7201a7c70e5b2))

####
[0.16.9](https://redirect.github.com/KaTeX/KaTeX/compare/v0.16.8...v0.16.9)
(2023-10-02)

##### Features

- Support bold Fraktur
([#&#8203;3777](https://redirect.github.com/KaTeX/KaTeX/issues/3777))
([240d5ae](https://redirect.github.com/KaTeX/KaTeX/commit/240d5aede915e0303929a9328745b1060e12004a))

####
[0.16.8](https://redirect.github.com/KaTeX/KaTeX/compare/v0.16.7...v0.16.8)
(2023-06-24)

##### Features

- expose error length and raw error message on ParseError
([#&#8203;3820](https://redirect.github.com/KaTeX/KaTeX/issues/3820))
([710774a](https://redirect.github.com/KaTeX/KaTeX/commit/710774aaebb38f43b1ec51c159fe9b9520c91424))

####
[0.16.7](https://redirect.github.com/KaTeX/KaTeX/compare/v0.16.6...v0.16.7)
(2023-04-28)

##### Bug Fixes

- **docs/support_table.md:** delete redundant "varPsi"
([#&#8203;3814](https://redirect.github.com/KaTeX/KaTeX/issues/3814))
([33a1b98](https://redirect.github.com/KaTeX/KaTeX/commit/33a1b98710c880d2d4a67aa0048f027a94b85702))

####
[0.16.6](https://redirect.github.com/KaTeX/KaTeX/compare/v0.16.5...v0.16.6)
(2023-04-17)

##### Bug Fixes

- Support `\let` via `macros` option
([#&#8203;3738](https://redirect.github.com/KaTeX/KaTeX/issues/3738))
([bdb0be2](https://redirect.github.com/KaTeX/KaTeX/commit/bdb0be201794d22adaee05438b07a2830efea9da)),
closes
[#&#8203;3737](https://redirect.github.com/KaTeX/KaTeX/issues/3737)
[#&#8203;3737](https://redirect.github.com/KaTeX/KaTeX/issues/3737)

####
[0.16.5](https://redirect.github.com/KaTeX/KaTeX/compare/v0.16.4...v0.16.5)
(2023-04-17)

##### Features

- \_\_defineFunction API exposing internal defineFunction
([#&#8203;3805](https://redirect.github.com/KaTeX/KaTeX/issues/3805))
([c7b1f84](https://redirect.github.com/KaTeX/KaTeX/commit/c7b1f84b7801a29dffdfa3db0ff35de289db80c0)),
closes
[#&#8203;3756](https://redirect.github.com/KaTeX/KaTeX/issues/3756)

####
[0.16.4](https://redirect.github.com/KaTeX/KaTeX/compare/v0.16.3...v0.16.4)
(2022-12-07)

##### Bug Fixes

- space should prevent optional argument to \
([#&#8203;3746](https://redirect.github.com/KaTeX/KaTeX/issues/3746))
([a0deb34](https://redirect.github.com/KaTeX/KaTeX/commit/a0deb3410fd92340556fc4c9edb8ab586077e5bf)),
closes
[#&#8203;3745](https://redirect.github.com/KaTeX/KaTeX/issues/3745)

####
[0.16.3](https://redirect.github.com/KaTeX/KaTeX/compare/v0.16.2...v0.16.3)
(2022-10-22)

##### Bug Fixes

- \hline after \cr
([#&#8203;3735](https://redirect.github.com/KaTeX/KaTeX/issues/3735))
([ebf6bf5](https://redirect.github.com/KaTeX/KaTeX/commit/ebf6bf5b50a98ac6c5aca1896c0a6ba985c1c91c)),
closes
[#&#8203;3734](https://redirect.github.com/KaTeX/KaTeX/issues/3734)

####
[0.16.2](https://redirect.github.com/KaTeX/KaTeX/compare/v0.16.1...v0.16.2)
(2022-08-29)

##### Bug Fixes

- **auto-render:** concatenate content of successive text nodes
([#&#8203;3422](https://redirect.github.com/KaTeX/KaTeX/issues/3422))
([4d3fdd8](https://redirect.github.com/KaTeX/KaTeX/commit/4d3fdd8647a1c320dc7bcb9c9ea2af81379f700d))
- Implement \pmb via CSS text-shadow
([#&#8203;3505](https://redirect.github.com/KaTeX/KaTeX/issues/3505))
([176552a](https://redirect.github.com/KaTeX/KaTeX/commit/176552a69183d71425b491d4cc2fa1d462a1246a))

####
[0.16.1](https://redirect.github.com/KaTeX/KaTeX/compare/v0.16.0...v0.16.1)
(2022-08-28)

##### Bug Fixes

- Use SVGs for some stacked delims
([#&#8203;3686](https://redirect.github.com/KaTeX/KaTeX/issues/3686))
([8a65a2e](https://redirect.github.com/KaTeX/KaTeX/commit/8a65a2e1fd69ffeee2fac62229f9f05ebf6afd45))

</details>

---

### Configuration

📅 **Schedule**: (UTC)

- Branch creation
  - At any time (no schedule defined)
- Automerge
  - At any time (no schedule defined)

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/).
View the [repository job
log](https://developer.mend.io/github/toeverything/AFFiNE).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0NC4xMzQuMSIsInVwZGF0ZWRJblZlciI6IjQ0LjEzNC4xIiwidGFyZ2V0QnJhbmNoIjoiY2FuYXJ5IiwibGFiZWxzIjpbImRlcGVuZGVuY2llcyJdfQ==-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-10-07 10:05:33 +08:00
DarkSky d897bb3d84 chore: bump deps (#15624) 2026-09-20 13:01:49 +08:00
cywandDarkSky 81c8622b95 feat(editor): add callout to "Turn into" menu (#15508)
## Summary

Closes #13954

The "Turn into" menu was missing the Callout option. Users had no way to
convert an existing paragraph/list/code block into a Callout directly
from the slash menu or context toolbar.

## Root Cause

`textConversionConfigs` in `rich-text/src/conversion.ts` had no entry
for `affine:callout`, so the option never appeared in the menu.

Additionally, Callout is a **hub block** — its text lives in a child
paragraph, not in its own `text` prop. This means the generic
`transformModel` path would silently fail, requiring a dedicated
conversion handler.

## Changes

- `blocksuite/affine/rich-text/src/conversion.ts` — add callout entry to
`textConversionConfigs`
- `blocksuite/affine/blocks/note/src/commands/block-type.ts` — add
`transformToCallout` command that:
  1. Creates a new `affine:callout` block at the original position
2. Moves the original text into a child `affine:paragraph` inside the
callout
  3. Deletes the original block

## Before / After

| Before | After |
|--------|-------|
| "Turn into" menu had no Callout option | Callout appears in "Turn
into" menu |
| Selecting any block → Turn into showed: Heading, Text, Quote, Divider…
| Now also shows: **Callout** |


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **New Features**
* Convert selected paragraphs, lists, and code blocks into callouts
while preserving text and nested content.
  * Added callout recognition and icon display in rich-text conversion.
  * Conversion results now distinguish between selected blocks and text.
* **Bug Fixes**
  * Prevented invalid, nested, or incompatible callout conversions.
  * The conversion menu now hides Callout when unavailable.
  * Preserved original blocks when conversion fails.
  * Improved undo and redo behavior for callout conversions.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: DarkSky <darksky2048@gmail.com>
2026-09-20 00:54:30 +08:00
DarkSky 3747879413 fix(core): linux redo shortcut key (#15623)
fix #15599

#### PR Dependency Tree


* **PR #15623** 👈

This tree was auto-generated by
[Charcoal](https://github.com/danerwilliams/charcoal)

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Bug Fixes**
* Corrected the Control+Y redo shortcut so it only activates on Windows
and Linux, preventing unintended behavior on other platforms.

* **Tests**
* Updated cross-platform keyboard tests to explicitly verify undo and
redo behavior in a Linux browser environment.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-09-19 20:41:04 +08:00
DarkSky 10c4a1e7d6 fix(editor): latex dollar preprocessor (#15622)
#### PR Dependency Tree


* **PR #15622** 👈

This tree was auto-generated by
[Charcoal](https://github.com/danerwilliams/charcoal)
2026-09-19 19:29:42 +08:00
Anand Hegde 42457ef6f7 fix(latex): keep inline math that starts with a digit (#15588) (#15596)
Fixes #15588.

## Root cause

`preprocessLatex` escapes any `$` that is followed by a digit, assuming
it is a price:

```ts
// Escape dollar signs that are likely currency indicators
preprocessedContent = preprocessedContent.replace(/\$(?=\d)/g, '\\$');
```

The step above it shields existing LaTeX from that escape — but only
`$$…$$`, `\[…\]` and `\(…\)`. **Single-dollar inline math was never
protected.**

So for `$4\vee 6=12$`:

1. the protection pass does not match it,
2. the currency pass sees `$4` and rewrites it to `\$4`,
3. the expression never parses as math, and the closing `$` is left
orphaned, which throws off the parse of everything after it.

That last part is why a single such expression breaks the rest of the
document, as the report describes. It also explains the reporter's `{ }`
workaround: `${4}` is `$` followed by `{`, not a digit, so the escape
never fires.

## The fix

Protect single-dollar inline math too, using the usual rule for telling
math from prices:

- the opening `$` is not followed by whitespace,
- the closing `$` is not preceded by whitespace,
- the closing `$` is not followed by a digit.

```ts
/(\$\$[\s\S]*?\$\$|\\\[[\s\S]*?\\\]|\\\(.*?\\\)|\$(?!\s)[^\n$]*?(?<!\s)\$(?!\d))/g
```

Currency is unaffected, which is the part worth checking:

- `costs $5 and $10 today` — the only closing candidate is the `$`
before `10`, and it is preceded by a space, so no match; both escape as
before.
- `$100$200` — the closing candidate is followed by `2`, so no match;
both escape as before.
- `it costs $5.00 total` — no closing `$` at all.

`$$…$$` stays first in the alternation, so display math is still matched
as display math.

## Verification

New
`blocksuite/affine/all/src/__tests__/adapters/latex-preprocessor.unit.spec.ts`,
11 cases: the digit-first expressions from the issue, the currency cases
above, and guards for display math, a `$` followed by whitespace,
`\(…\)` rewriting, and code spans.

Reverting **only** the regex (keeping the export so the module still
loads) fails exactly the four digit-first tests and leaves the other
seven green:

```
× leaves binary operators untouched
× leaves relation untouched
× leaves single digit untouched
× keeps every expression in a sentence mixing math and prose
  Tests  4 failed | 7 passed (11)
```

That the currency and existing-behaviour cases pass **without** the fix
is the point — they are regression guards, not props for it.

With the fix:

```
 Test Files  14 passed (14)
      Tests  234 passed (234)
```

(the whole `blocksuite/affine/all` suite, which includes the 193
existing adapter tests).

## Notes

- `preprocessLatex` is now exported so the delimiter rule can be tested
directly. It was previously module-private with only the extension
exported; `adapters/markdown/index.ts` already does `export * from
'./preprocessor.js'`, so nothing else changed.
- I kept the change to the one regex and did not reformat the rest of
the file — there is no Prettier config in the repo, and running Prettier
with its defaults rewrites quotes and trailing commas across the whole
file.
- The lookbehind `(?<!\s)` is ES2018; the file already targets modern
runtimes.


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **Bug Fixes**
- Improved Markdown LaTeX preprocessing for inline expressions preceded
by even-length backslash runs.
- Continued to distinguish escaped dollar signs from valid math
delimiters, while preserving currency values, display math, `\( \)`
expressions, whitespace, mixed content, and code spans.

- **Tests**
- Added comprehensive coverage for inline and display math, delimiter
escaping, currency values, whitespace, conversions, mixed content,
digit-leading expressions, and code-span protection.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-09-19 19:27:06 +08:00
Anand Hegde 82f8ada972 fix(latex): do not re-escape a dollar that is already escaped (#15602)
## Description

Split out of #15596 on review feedback — this is an independent,
pre-existing bug in the currency pass, so it does not belong in that PR.

The currency pass escapes any `$` followed by a digit without looking at
what precedes it:

```ts
preprocessedContent = preprocessedContent.replace(/\$(?=\d)/g, '\\$');
```

When the dollar is **already escaped**, that turns an odd backslash run
even:

```
input:  \$4        (an escaped dollar — the author wants a literal "$4")
output: \\$4       (a literal backslash, then an unescaped `$`)
```

`MarkdownPreprocessorManager.process` runs this before `_markdownToAst`,
so remark-math sees that bare `$` and can take it as an active delimiter
— the opposite of what escaping it was for.

### The fix

Escape only a dollar whose preceding backslash run is **even**, keeping
the run itself:

```ts
preprocessedContent = preprocessedContent.replace(
  /(?<!\\)((?:\\\\)*)\$(?=\d)/g,
  '$1\\$'
);
```

`(?<!\\)` anchors the run to its start and `((?:\\\\)*)` takes
backslashes in pairs, so an odd run never matches. Behaviour that was
already correct is untouched:

| input | before | after |
|---|---|---|
| `costs $5 today` | `costs \$5 today` | unchanged |
| `costs \\$4 today` (even run — literal `\` then a real `$`) | `costs
\\\$4 today` | unchanged |
| `costs \$4 today` (odd run — already escaped) | `costs \\$4 today` |
**`costs \$4 today`** |

### Relationship to #15596

Both touch this file, so whichever lands second will need a trivial
rebase:

- Both add `export` to `preprocessLatex` (the same one-word change).
- They edit **different** statements — #15596 changes the *protection*
regex above, this one changes the *currency* regex below.
- Test files are deliberately named differently
(`latex-preprocessor.unit.spec.ts` there,
`latex-currency-escape.unit.spec.ts` here) so they do not collide. Happy
to fold them into one file once both are in, if you'd prefer that.

I verified this bug is not introduced by #15596: `\$4` preprocesses to
`\\$4` identically with and without that branch.

## Checklist

- [ ] I have signed the [AFFiNE Contributor License
Agreement](https://cla-assistant.io/toeverything/AFFiNE) — required
before merge; the `license/cla` check must be green ([how it
works](https://github.com/toeverything/AFFiNE/blob/canary/docs/BUILDING.md#sign-the-cla-first))
- [x] The PR targets the `canary` branch and its title follows
[Conventional Commits](https://www.conventionalcommits.org/)
- [x] Tests are added or updated where it makes sense
- [x] `yarn lint` and `yarn typecheck` pass locally
- [x] If the PR code includes AI-generated edits, I have carefully
reviewed it to ensure that the scope of the PR is consistent with what
is claimed in the title and description, and that there are no redundant
or invalid implementations.
- [x] I agree that maintainers may close the PR without discussion if
they consider the code quality to be too low.

### Notes on the checklist

- **CLA:** not signed yet — the repository owner is signing it; the
`license/cla` check will go green once that happens.

- **Tests:** 7 cases in `latex-currency-escape.unit.spec.ts`. Reverting
only the regex fails exactly the three already-escaped cases and leaves
the four guards (plain price, bare amount, two prices, even run) green —
they are regression guards, not props. Full `blocksuite/affine/all`
suite: 230 passing.
- **Lint/format:** `oxlint --deny-warnings` and `oxfmt --check` are both
clean on the two changed files.
- **Typecheck:** clean for these files. For transparency, a full `yarn
typecheck` on my machine also reports pre-existing `@prisma/client`
errors under `packages/backend/server`; those come from my installing
with `--mode=skip-build` (so `prisma generate` never ran) and are
unrelated to this change.



<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **Bug Fixes**
- Improved LaTeX handling for currency values by escaping dollar signs
only when required.
- Preserved already-escaped dollar signs and backslash sequences
correctly.

- **Tests**
- Added coverage for plain currency amounts, already-escaped dollar
signs, and even backslash runs.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-09-19 19:26:54 +08:00
f26301a9fb fix(editor): improve code language search and prevent stale highlighting (#15593)
## Summary

- Search language IDs, display labels, and aliases case-insensitively,
preserving prefix matching and the existing result order.
- Ignore pending grammar-load results when the selected language has
changed, preventing highlighting from returning after switching to Plain
Text.

Related to #15492: display-label matching will also make “Plain Text”
searchable by its full name, while the highlighting fix prevents pending
language loads from restoring highlighting after switching to Plain
Text.

## Validation

Code-block E2E suite (7 passed), scoped TypeScript checks, lint, and
formatting checks passed. Both focused regression tests fail on
unmodified `canary` and pass with the fixes.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **New Features**
- Code block language search now matches display names, IDs, aliases,
and labels without regard to letter case.
- Search results prioritize matches at the beginning of language names
and aliases over label-only matches.

- **Bug Fixes**
- Prevented outdated syntax highlighting from appearing after a code
block language is changed or cleared while loading.
- Prevented duplicate language-loading requests during concurrent
highlighting updates.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: DarkSky <25152247+darkskygit@users.noreply.github.com>
Co-authored-by: DarkSky <darksky2048@gmail.com>
2026-09-19 18:48:05 +08:00
Jessy Latmi 19ed4226f0 fix(editor): add Plain Text option to language selector dropdown (#15492)
**Problem:** When a language was selected in a code block's language
dropdown, there was no way to reset it back to "Plain Text" (no syntax
highlighting). The dropdown only contained shiki languages, and the null
value representing Plain Text had no corresponding selectable option.

**Solution:** Added a "Plain Text" entry as the first item in the
language selector dropdown. This entry:
- Maps to language: null when selected
- Shows a checkmark when Plain Text is active
- Persists in localStorage alongside recently used languages
- Is searchable via aliases ("plain", "text", "none")

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **New Features**
  * Added Plain Text as a selectable code block language.
* Plain Text is available in newly generated and previously saved
language lists.
  * Code blocks correctly show Plain Text when no language is selected.
* Recognizes common names including “plain,” “text,” “plaintext,” “txt,”
and “none.”
* **Tests**
  * Added coverage for switching between Rust and Plain Text.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-09-19 17:28:04 +08:00
keepClamDownandDarkSky 2af30773ae feat(ios): add stable Share Extension imports (#15547)
## Summary

The changes below are prepared locally and have not been committed or
pushed.

- Save original URLs, user titles, selected text, images and PDFs
through a versioned, file-backed Share Inbox. Stable document/attempt
IDs, serialized imports and committed receipts make retries preserve
user edits and recover native completion.
- Keep rich previews transient. Share previews request transcript
excerpts, clip optional display fields and bound response/image
downloads. Saving does not wait for preview requests or persist provider
metadata, transcript snapshots or dedicated preview blobs.
- Restore the minimal App Group workspace-mode snapshot and
`official`/`deferred` route. Official routes remain fixed for the
pending share; deferred self-hosted previews use the selected server
without a provider fallback.
- Let bookmark and YouTube details read the current workspace's Link
Preview API by URL. Full transcripts, chapters and timestamps load on
expansion without document writes. Reuse editor styles and the existing
portal for canvas details; isolate endpoint/base/transcript caches and
keep transcript results out of persistent cache.

## Validation

- Focused frontend suites: 128 tests passed; the 43 preview/details
cases also passed after the final portal change.
- `ShareInboxSafetyTests`: 57 tests passed on iOS 26.5 simulator.
- `yarn typecheck` and full `yarn lint` passed.
- iOS web bundle, Capacitor asset copy, and signed simulator App build
with embedded ShareExtension passed.
- Browser component checks: desktop, narrow viewport, light/dark themes,
full transcript scrolling, canvas portal positioning and Escape
dismissal.
- Simulator Safari share: rich preview, cancellation, native-to-app
handoff, workspace selection and successful save. The pending manifest
contained original content and routing only, and was removed after
import.

Physical-device and network-capture matrices remain manual. The
simulator YouTube iframe displayed player error 153; this is separate
from the successful preview/import checks and video playback is not
claimed as verified.


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **New Features**
* iOS sharing now supports PDF files alongside images, with previews and
attachment validation.
* Share imports offer improved workspace selection, offline handling,
retry recovery, and clearer error messages.
* Link previews can display expandable metadata and transcript details
for bookmarks and YouTube embeds.
* Share inbox entries now identify unsupported versions and provide
safer attachment resolution.

* **Bug Fixes**
* Improved cancellation, cleanup, and stale-request handling during
sharing and importing.
* Enhanced link-preview validation and protection against oversized or
invalid responses.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: DarkSky <darksky2048@gmail.com>
2026-09-15 14:55:04 +08:00
DarkSky 51fdf602ba feat(core): adapt new lifecycle (#15575)
fix #15574


#### PR Dependency Tree


* **PR #15575** 👈

This tree was auto-generated by
[Charcoal](https://github.com/danerwilliams/charcoal)

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

## New Features
* Added source-aware blob handling for current documents and page
history.
* Added document lifecycle support for trashing, restoring, and
permanently deleting documents.
* Copilot attachments now upload directly to session attachment
endpoints.

## Bug Fixes
* Document actions now complete before confirmations, notifications, and
navigation proceed.
* Improved cancellation, upload fallback, size-limit handling, and cloud
synchronization reliability.
* Invite-link expiration now remains reliable for long durations.
* Improved synchronization for document permissions and reserved
documents.

## Changes
* Blob management now displays attachment icons instead of image
previews.
* Cloud synchronization now uses a unified batch protocol.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-09-09 23:00:06 +08:00
Marvin b5556f12d8 fix(editor): preserve expanded headings in readonly mode (#15549)
## Description

Closes #13579.

On readonly shared pages, selecting text under a heading persisted as
collapsed caused reactive selection handling to restore the persisted
collapsed value over the viewer-local expanded state. This closed the
heading again and prevented selecting or copying its revealed content.

This change:
- separates persisted collapsed-state synchronization from selection
cleanup;
- makes the readonly-local collapsed state reactive for both BlockSuite
effects and Lit rendering;
- preserves selection and copying while a readonly heading is locally
expanded;
- still clears hidden text selection when the heading is collapsed
again;
- adds a Playwright regression covering collapse → readonly → expand →
drag-select → copy → re-collapse.

## Checklist

- [x] I have signed the [AFFiNE Contributor License
Agreement](https://cla-assistant.io/toeverything/AFFiNE) — required
before merge; the `license/cla` check must be green ([how it
works](https://github.com/toeverything/AFFiNE/blob/canary/docs/BUILDING.md#sign-the-cla-first))
- [x] The PR targets the `canary` branch and its title follows
[Conventional Commits](https://www.conventionalcommits.org/)
- [x] Tests are added or updated where it makes sense
- [x] `yarn lint` and `yarn typecheck` pass locally

## Testing

- Focused Chromium regression: 1 passed
- Adjacent readonly paragraph scenarios: 3 passed
- Targeted `oxfmt --check`: passed
- Targeted `oxlint --deny-warnings`: passed
- `git diff --check`: passed

`yarn typecheck` could not be confirmed in this checkout because
required generated workspace declaration outputs are missing.


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **Bug Fixes**
  * Improved collapsed heading behavior in read-only mode.
* Preserved local heading expansion and text selection when copying
content and collapsing the heading.
* Ensured local expansion state resets correctly when switching out of
and back into read-only mode.

* **Tests**
* Added coverage for read-only heading expansion, keyboard copying,
clipboard access, mode switching, and text selection.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-09-08 23:46:35 +08:00
Lee Jaeha / Adam b4331cbe1e fix(editor): compare right child against the correct node in priority queue (#15568)
## Description

`PriorityQueue.bubbleDown` compares `swap` against `null`, but `swap` is
initialized to `-1` (`priority-queue.ts:19`), and the loop's own exit
check uses `swap === -1` (`:43`). So `swap === null` is always false and
`swap !== null` always true: the right child is only ever compared with
the left child, never with the element being sunk. A node can sink below
a child larger than itself, breaking the heap invariant.

Randomized check on the current code: 394 of 20,000 random heaps dequeue
out of order. Smallest reproducer is 7 elements — `[1, 2, 3, 7, 6, 5,
4]` dequeues as `[1, 2, 3, 5, 4, 6, 7]`.

The queue backs `AStarRunner` (`a-star.ts:4`, its only consumer), which
routes orthogonal connectors via `ConnectorPathGenerator.updatePath` —
edgeless connector re-routing, mindmap rendering, and auto-complete. The
A* heuristic is admissible, so a path is still produced; the effect is
that nodes are expanded in the wrong order, so the shortest /
fewest-bends guarantee is lost rather than the connector breaking.

### Why this needed a config change too

The package's `vitest.config.ts` was dropped in the #10702 package reorg
and never recreated at `blocksuite/affine/blocks/surface/`, so `vitest`
collects none of its six test files:

```
$ yarn vitest run blocksuite/affine/blocks/surface/src/__tests__/priority-queue.unit.spec.ts
No test files found, exiting with code 1
```

They have not run since 2025-03-08, which is why this survived.
Restoring the config re-enables all six files (40 tests, all passing) so
the regression test added here actually guards the fix.

Verified by reverting the one-line fix with the config in place:

```
FAIL  should not sink a node past children that are all larger than it
  expected [1,2,3,5,4,6,7] to deeply equal [1,2,3,4,5,6,7]
FAIL  should dequeue in ascending order regardless of insertion order
Tests  2 failed | 38 passed (40)
```

## Checklist

- [x] I have signed the [AFFiNE Contributor License
Agreement](https://cla-assistant.io/toeverything/AFFiNE) — required
before merge; the `license/cla` check must be green ([how it
works](https://github.com/toeverything/AFFiNE/blob/canary/docs/BUILDING.md#sign-the-cla-first))
- [x] The PR targets the `canary` branch and its title follows
[Conventional Commits](https://www.conventionalcommits.org/)
- [x] Tests are added or updated where it makes sense
- [x] `yarn lint` and `yarn typecheck` pass locally
- [x] If the PR code includes AI-generated edits, I have carefully
reviewed it to ensure that the scope of the PR is consistent with what
is claimed in the title and description, and that there are no redundant
or invalid implementations.
- [x] I agree that maintainers may close the PR without discussion if
they consider the code quality to be too low.


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **Bug Fixes**
- Corrected priority queue ordering behavior to ensure items are
dequeued in ascending order across insertion sequences.

- **Tests**
- Added coverage for priority queue behavior when comparing nodes with
two larger child values.
- Added automated test configuration and coverage reporting for the
surface components.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-09-07 17:35:36 +08:00