Commit Graph
1628 Commits
Author SHA1 Message Date
DarkSky 934ad7dc10 feat(editor): create docs in edgeless link picker and edit multiline card descriptions
Add Page and Edgeless creation rows to the edgeless link picker to match Web 0.27.5.

Show CreatePage and CreateEdgeless below matched docs when edgeless allows writes.
Default empty queries to "Untitled" and commit creation with one structural undo step.

Update the bookmark/card alias editor description field to match multiline `<textarea maxlength="500">`.
Support Shift+Enter newlines, Enter save, Up/Down line moves, wheel scroll, and UTF-16 safety.
Keep initial open scrolled to the top, and add Shift+Click extension, cross-line drag selection, and caret reveal on focus.
2026-12-05 14:23:51 +09:00
DarkSky ee904768d7 fix(editor): keep reference positions across map updates 2026-12-05 13:02:15 +09:00
DarkSky e2e6653da7 fix(database): preserve table paste after SVG and MathML 2026-12-05 12:03:26 +09:00
DarkSky 75e8e4bdd2 fix(desktop,editor): polish shortcuts and controls 2026-12-05 10:42:23 +09:00
DarkSky cbb91937eb feat(editor): use the 0.27.5 grid in the keyboard tool panels
The More, Turn into and Highlight panels now use the BlockSuite 0.27.5
grid: 4 columns, 12 px gaps, 64 px buttons with 32 px icons and 18 px
labels. The scroll limit and the painter read the same layout values.

Document Group&Frame lists the frames in document order, then the
groups. The toolbar keeps this list for each document and revision, so
a panel scroll does not read the block tree again.

The panel painting moves from render.rs to a new panels.rs file.
2026-12-05 10:09:05 +09:00
DarkSky 9ee3726c03 fix(desktop,editor): align document headers and canvas tools
Place document actions next to the title. Anchor the More menu to its button.
Close canvas tool panels and commit inline edits when the Link picker opens.
Return keyboard input to the canvas when another tool closes the Link picker.
Show four mind map style previews in both toolbars.
2026-12-05 09:41:42 +09:00
DarkSky 7b7d002327 feat(editor): add media card actions and table cell controls 2026-12-05 09:15:06 +09:00
DarkSky 169df763f2 feat(editor): copy Edgeless selections as images
Render the selected scene to PNG for the native clipboard. Split external multi-select text on commas and keep structured table labels intact.
2026-12-05 09:12:12 +09:00
DarkSky 3fe764490f fix(playground): accept IME input in the Edgeless link picker
Use a UTF-16 buffer for the link picker query. Update the results as
the input method changes the query. Let Escape cancel composition
and let Enter commit the query before it inserts a card.

Close the Shape and Mindmap menus when the link picker opens.
2026-12-05 08:19:01 +09:00
DarkSky b9122a6822 fix(editor): fade eraser targets in paint order
Use world bounds to skip stroke segments and outlines beyond the pointer step.
Paint eraser targets at 0.3 opacity in scene order.
Check four more snapshot prefixes in Wasm data.
2026-12-05 07:49:55 +09:00
DarkSky c828d67d4e fix(editor,playground): outline frame swatches and carry table copy cells in text/html
- Unify Edgeless color dot rendering via paint_color_dot (dark-mode 1px border ring, transparent diagonal slash, and default transparent Frame without prop:background).
- Encode Database table copies in real clipboard text/html (data-affine-database-table) via shared write_text_and_html and Web native paste event without side-table state, preserving comma-containing option labels across tabs while splitting external plain-text copies.
2026-12-05 07:23:50 +09:00
DarkSky 2a18b2377e feat(editor,desktop): resolve cross-doc surface refs and hydrate synced docs
- Preview cross-document SurfaceRef frames, groups (including pure-note and nested groups), and mindmaps, and route Open / CenterPeek to the owner document.
- Hydrate cold-opened and remotely added nested EmbedSyncedDoc targets via per-revision edge caching in DesktopDirectory without steady-state rescans.
- Preserve object and string Y.Text embeds with formatting marks lossless across Linked Doc migration.
2026-12-05 07:19:26 +09:00
DarkSky 350fec7b01 feat(desktop): add interactive workspace settings, properties tab, backup export, and template badge 2026-12-05 07:04:56 +09:00
DarkSky 720873989d fix(desktop,playground): constrain select pickers and table axis menus
Constrain database backlink select pickers inside viewport and
page-information bounds, place table column axis menus below the axis
pill or flip above without covering it in Page and Edgeless modes, and
add regression tests for tag pickers and separated database footer
controls.
2026-12-05 05:41:16 +09:00
DarkSky 9a628d707f feat(editor): add canvas eraser, mind map and link tools, and key shortcuts
Add the Eraser (E), Mind map, and Link (@) tools to the Edgeless creation toolbar. The toolbar
shows 13 tools in one row when they fit. Otherwise it uses the fewest rows (two or three) that
keep each button at full size. Below that width, it uses three rows of smaller buttons.

- Eraser: a drag erases the unlocked items that the pointer path crosses, in one undo step.
  Escape cancels the drag. Targets fade while the drag continues, and items above a target
  stay opaque.
- Mind map: select one of four styles, then click the canvas to put a root and three children
  there in one undo step.
- Link: select a document to insert a 364 x 390 vertical linked-doc card at the viewport center.
  The picker shows above the canvas controls. In a short canvas, its list scrolls, and the
  arrow keys keep the selected row in view.
- K and - turn the note slicer on or off for one selected unlocked note.
- Arrow keys move the selection 1 px, and Shift with an arrow key moves it 10 px, in one undo
  step. In a mind map, arrow keys select the parent, child, or sibling node, and the camera
  pans to show a node outside the view. A printable key on one selected mind map node, with or
  without Shift, starts to edit its label with that character.
- [ and ] send the selection backward or bring it forward by one layer, also on a mind map
  node. Other states pass the key through.
2026-12-05 05:33:33 +09:00
DarkSky 358a6ecf23 fix(editor): align headers, references, and web appearance 2026-12-05 04:59:02 +09:00
DarkSky 053180699a fix(editor): restore page block shortcuts, horizontal format bar, and narrow More creation items
Restore page drag-handle clicks to select whole blocks with the standard
horizontal FormatToolbar, remove the custom vertical block menu and deprecated
Toggle List creation entry, dedent blocks on Mod+Backspace instead of deleting
them, add Mod+Shift+L/E/R text alignment and Mod+Alt/Shift+Up/Down block move
shortcuts using the document-order start block across forward and reverse
selections, and include Create Table and Create Linked Doc in the narrow
FormatToolbar More menu.
2026-12-05 04:01:00 +09:00
DarkSky df91604a2e feat(editor,desktop): edit table text and reorder inspector items
Format text selections in table cells. Keep selections inside paired characters.
Reorder frames and headings in the inspector. Edit frame titles in place.
2026-12-05 03:07:12 +09:00
DarkSky cacab32acd fix(database): preserve clipboard cells and select labels
Write empty text to the Web clipboard. Quote empty cells in single-column TSV rows.

Match pasted select options by their labels. Add missing options and write cells in one undo step.
2026-12-05 02:19:08 +09:00
DarkSky 4ed954fb1d feat(database): add title editing, view menus, and table commands 2026-12-05 01:20:23 +09:00
DarkSky 438c5cff16 feat(editor,hosts): add create-linked-doc conversion with subdoc persistence
Page FormatToolbar `Create Linked Doc` opens the `Create linked doc` title
dialog. The dialog shows the first block as the title when that block is a
heading. `Confirm` moves the whole blocks that the selection touches, with
their subtrees and all their properties, into a new linked page. Code
text, table and database cells, marks, and inline references stay intact.
It puts an `affine:embed-linked-doc` card in their place. A blank title
gives `Untitled`. `Cancel`, `Escape`, or a press outside the dialog write
nothing.

The Edgeless `More` menu adds `Turn into linked doc` for one unlocked
note. This puts an `affine:embed-synced-doc` card with the frame, index,
and connectors of the note in its place. The menu also adds `Create linked
doc` for other unlocked selections. This moves the items, selected notes
included, into a new Edgeless document in their paint order. Then it puts
a 364 x 390 `vertical` card at their center. Both actions use the same
title dialog. Each conversion is one undo step in the source document. The
open-document group of the menu comes before the clipboard group. A menu
that does not fit scrolls its rows with the wheel and does not cover the
toolbar or the creation toolbar. `PageDocSession::export_block_tree`
exports a block subtree with every property for these copies and for
Edgeless copy and clone.

`WorkspaceDocDirectory::seed_created_doc` gives the complete Yjs V1 state
of a new document to the host, so that the content persists. The desktop
host replaces the initial blocks of the store with the seed blocks through
`PageDocSession::replace_blocks_update_v1`. It queues the change for the
connected session. The desktop directory keeps the snapshot of each loaded
document, and of a seeded document that the store does not have yet, so
synced cards show the content after a refresh or a reopen. The client
directory queues the seed with the pending updates of the workspace
database (`enqueue_pending_update`). The mobile host keeps the seed as the
cached CRDT state. The mobile bridge adds a document that the shell
created to the workspace root before it merges the content. New mobile
document IDs come from the intent, or from a random value, for each
workspace. They never reuse the ID of a document in the trash.
2026-12-05 01:01:17 +09:00
DarkSky d74d7f2c3d fix(playground): resolve table drag targets from the current layout
Use the current table layout to draw the drop indicator and move the row or column on release.
Find the dragged row or column by ID on each lookup.
Cache the axis edges and preview geometry until the drag ends.
Borrow the layout key and cell IDs on cache hits.

Check the active mode before opening iframe URL and attachment name prompts.
2026-12-05 00:06:59 +09:00
DarkSky 391ab796b1 refactor(editor): store the document menu in each overlay 2026-12-04 20:56:23 +09:00
DarkSky 853d67153b feat(editor,desktop): add surface-ref toolbar, peek target selection, and auxclick pairing
A click on a Page surface reference now selects the block, also on read-only
pages. The selected block shows a toolbar with the target title, an Open in
edgeless split button with its Open menu, Copy, Caption, and a More menu with
Copy original link and Delete. Each open path selects the frame or group in
Edgeless. A reference whose target is gone keeps Copy, Caption, and Delete.

Touch hosts show the docked toolbar for the selected block. On a desktop
pointer, a 500 ms hover shows the toolbar. The toolbar, its menus, and the
bridge to them keep it open. Typing hides it.

Center peek now keeps the blockIds and elementIds of the link. The peek editor
selects these blocks or canvas elements when it mounts the target.

A middle-button press on a reference or a linked-doc card now opens a new tab
only when the release is on the same reference. A release outside cancels it.

The Open menu fits a short editor viewport and scrolls its rows.
2026-12-04 19:53:21 +09:00
DarkSky 575b2fdddf feat(editor): add canvas document opening, table conversion, and URL autolinks 2026-12-04 19:13:57 +09:00
DarkSky 9cc00b0577 feat(playground): complete mobile keyboard tools and inline input 2026-12-04 18:59:02 +09:00
DarkSky 1b4ccaee59 perf(desktop): keep frame thumbnail layouts and paint canvas blocks
The frame panel keeps one canvas state for each document. An edit lays
out only the blocks that it changes. The panel starts a new canvas when
the document, theme, scale factor, layout direction, fonts, store
metadata or editor media revisions change.

The store metadata revision is the revision that the document directory
reads. A text edit in the pane editor does not change it, so the panel
keeps the canvas for that edit.

Thumbnails get page titles, decoded images, PDF previews and the
document directory from the pane editor through a read-only preview
entry. The preview does not use the editor selection, preedit, camera
or local folds.

Frame thumbnails paint image, bookmark, attachment and embed blocks
with the same painter as the canvas.

The Presentation button uses the white token as its background. The
inspector tabs use the web order: Properties, Journal, Outline, Frame.
2026-12-04 18:27:27 +09:00
DarkSky 91d9e00dd9 feat(editor): drag table rows and columns by their axis pills
Port the BlockSuite rowDrag and columnDrag gestures to the Simple Table
axis pills, in Page mode and in an edited Edgeless note.

- A click on a pill opens the axis menu as before. Like the BlockSuite
  pill click, the press and the release must be on the same pill, and
  the pointer must not move more than 10 px along the axis.
- A longer drag closes the menu and hides the pills and add bars. It
  tints the dragged row or column and shows a preview of its cells that
  follows the pointer. A 5 px indicator marks the target gap. The gap
  rule is the same as getTargetIndexByDraggingOffset.
- The release writes one fractional order key through the new
  PageDocSession::move_table_axis_to, in one undo step. Cell text,
  colors and column widths stay with the row or column.
- A release at the start gap writes nothing. Escape stops the drag and
  writes nothing.
- move_table_axis now uses move_table_axis_to.
2026-12-04 17:17:01 +09:00
DarkSky 5f544c7871 feat(editor,desktop): add Open dropdown menu and desktop open modifiers for references and embeds
- Add Open dropdown trigger and menu panel (Open this doc, Open in new tab, Open in split view, Open in center peek) to `@reference` popup and `EmbedLinkedDoc` / Page `EmbedSyncedDoc` toolbars.
- Disable `Open this doc` on self-references without cross-mode switching, clamp menus in narrow/short viewports, close dropdowns on Escape/outside click, and hide desktop-only items on compact/mobile/unregistered hosts.
- Add `OpenDocRequest` / `ReferenceOpenMode` routing in `PlaygroundView` and `DesktopShellView`, handling active pane, browser/app new tab, split view (`>= 640px`), center peek focus/promotion, and block reveal params.
- Align `@reference` direct click handling in Page and Edgeless Active Note with `Shift+Click` (peek), `Cmd/Ctrl+Click` and middle-click (new tab), and `Alt+Click` (split view when `>= 640px`).
- Add overlay and desktop UI tests covering dropdown dispatch, self-reference gating, compact fallback, peek promotion, and pointer modifiers.
2026-12-04 16:39:48 +09:00
DarkSky 28f3d31c25 fix(editor): discard incomplete table text end tags
Discard the unfinished end tag when input ends after the tag name boundary.
Check table rows and clipboard paste against Chromium.
2026-12-04 16:36:40 +09:00
DarkSky 61edc1d5b8 fix(editor): decode pasted entities and avoid rotated shapes 2026-12-04 16:05:13 +09:00
DarkSky 509c205b0a fix(editor): match Chromium table paste
Move table HTML handling into its own module.
Keep text after incomplete end tags and normalize line feeds before table paste.
Compare the parsed rows with 83 Chromium cases.
2026-12-04 15:31:24 +09:00
DarkSky 47cb3c92c0 fix(editor): align clipboard entities and slash canvas placement
Decode every WHATWG HTML named character reference in pasted HTML. The
table is one sorted string of `\0<name>;<value>` records, and a lookup
bisects it by byte position. `&lang;` and `&rang;` now give U+27E8 and
U+27E9. Two-code-point references such as `&NotEqualTilde;` decode.
The 106 legacy names also decode without `;` when the next byte is not
`=` or an ASCII letter or digit, so `?a=1&copy=2` stays as typed.
Numeric references in U+0080..=U+009F use the Windows-1252 values.
Zero, surrogate and out-of-range references give U+FFFD.

The `/callout` command keeps its block, as `calloutSlashMenuConfig` does.
Thus an empty paragraph, bulleted item or checked to-do stays before the
new callout. One undo removes the callout and restores the typed command.

The `Frame` and `Mind Map` commands place their new target with the
`findSpace` search of `0.27.5`. A frame starts at `[0,0,1600,900]` with
20 px padding. A mind map starts at `[0,0,200,200]` with 150 px padding.
The target moves right only past the canvas content that it intersects.
A new frame is named `Frame <n>`, where n is the frame count plus one.
The mind map nodes use the `0.27.5` sizes, positions and labels.
2026-12-04 14:52:40 +09:00
DarkSky 538785ef88 feat(editor): add frame and group slash items and tooltip parity
Add `Frame: <title>` and `Group: <title>` rows to the `Edgeless
Element` slash group. Each row inserts an `affine:surface-ref` block
that points to the frame or the group, in one undo step. Like the
`Frame` and `Mind Map` commands, the new reference becomes the only
selected block. The command removes an empty paragraph or list item
that it runs on, and a numbered run after the reference starts again
at 1.

Show the local date as the subtitle of the `Date` rows, and use the
BlockSuite date, mind map, and move icons.

Replace the slash preview card with the BlockSuite item tooltip: the
item's figure above a caption, 6 px past the row, only on rows that
have a tooltip. The figures are data tables of rectangles, circles,
lines, path outlines, and text runs from the BlockSuite tooltip
figures, 68, 89, or 106 px tall. Embedded screenshots show as plain
areas.

Paint the note shadows and borders in frame thumbnails, so a white
note shows on a white background.

Read Web Desktop `/desktop/?workspace=&doc=` links like workspace links
when they are pasted on the canvas, and keep their `mode`, `blockIds`,
and `elementIds` parameters on the linked document card.

Add tests for numbered list renumbering across drag reorders and for
one undo of each reorder.
2026-12-04 13:24:10 +09:00
DarkSky ed6406b0e0 perf(edgeless): cache selected note order badge layouts
Reuse selected note order badge layouts across canvas frames.
Include the text system and font generation in the cache key.
2026-12-04 13:08:36 +09:00
DarkSky 03b253250d feat(editor): select and edit ranges of table cells 2026-12-04 12:20:08 +09:00
DarkSky 9b75a4adc8 perf(editor): reuse table cell layouts 2026-12-04 10:21:41 +09:00
DarkSky 0223894d82 perf(client): score search fields before building hits
Search now scores documents without allocations and builds highlights
only for the documents it returns.

- `PreparedQuery` lowercases each field into a reusable `QueryScratch`
  buffer. ASCII text uses ASCII lowercase and skips UTF-16 tables.
  Other text uses `str::to_lowercase()`, and maps lowercase bytes to
  source UTF-16 ranges only when the field contains the query.

- `score_with_scratch` returns the field score without highlight spans.
  `match_utf16_with_scratch` returns the same result as `match_utf16`.

- With a limit, `WeightedSearchEngine::search_refs` keeps the best
  documents in a bounded heap. Then it builds hits for those documents
  only. Ties resolve as in a stable full sort.

- With no limit, search matches each document once and sorts the hits.

On 4,096 documents with 2,048-byte bodies and a limit of 20, a query
that matches every document allocates 0.04 MB instead of 188 MB.
2026-12-04 09:43:21 +09:00
DarkSky d18b6bbc2c feat(desktop): add right-sidebar frame panel and live thumbnails
Align the Edgeless right-sidebar Frame slide panel with AFFiNE 0.27.5:

- Add the Frame inspector tab with All frames count, Presentation stage
  trigger, empty-state guidance, ordered slide cards, live canvas
  selection sync, and click-to-center navigation.
- Render live frame thumbnails directly from `PreparedEdgelessScene` in
  unified scene paint order across notes, surface elements, and text,
  and fit the active slide on the first fullscreen presentation frame.
2026-12-04 09:30:33 +09:00
DarkSky 564b31e49e feat(desktop): open copied block and element links across web and desktop
Align copied block and canvas element link navigation and table Markdown
export with AFFiNE 0.27.5:

- Parse and route Web `/desktop/?workspace=…&doc=…` links carrying
  `blockIds` or `elementIds` on cold start and live navigation, selecting
  all linked Page blocks in document order or centering and selecting
  linked Edgeless elements across frames.
- Export inline `@reference` page chips inside table cells as `[Title](url)`
  links during `Copy as Markdown`.
2026-12-04 09:24:31 +09:00
DarkSky b817bd251d refactor(frontend): tighten harness gate, ratchet prefixes, and move icon
Check (package, kind, name) tuples for harness Cargo targets in check-invariants.sh. Duplicate target names of another kind now fail the check.

Add desktop.app_tabs.tab., desktop.split.resize., and desktop.explorer.group. to ZERO_IN_PRODUCTION. Update the snapshot prefix test count to 68.

Extract PresentationIcon into ui_tokens::icons::PRESENTATION. Replace the inline SVG in edgeless/present.rs with that static icon definition.
2026-12-04 06:09:28 +09:00
DarkSky d0f4d0b0ec feat(editor): align block menu copy actions, conversions, and short-viewport scroll
Add Copy as Markdown and Copy link to block to the drag-handle menu and
format toolbar More menu. Export inline page references as Markdown
links, parse ordered multi-block Page URLs, align Turn into options, and
scroll the drag-handle menu inside short viewports.
2026-12-04 05:53:46 +09:00
DarkSky 063afdfdca fix(edgeless): show text outside its stored frame
Keep the stored width for line wrapping.
Use the laid-out text bounds to decide if text is visible.
2026-12-04 04:32:24 +09:00
DarkSky 1a7ad80429 refactor(edgeless): use ui-tokens icons in presentation toolbar
Add StartPointArrowIcon, EndPointArrowIcon, LayerIcon, StopAiIcon, and ExpandCloseIcon to the icon token generator. Replace all five inline SVG constants in the presentation toolbar with static IconDef paints.

Remove the hand-written fullscreen exit stroke path and adopt the official ExpandCloseIcon vector shape. Add static source and rasterized alpha-mask regression tests for the presentation toolbar icons.
2026-12-04 03:54:49 +09:00
DarkSky c61a276d07 fix(frontend): Preserve host font configuration
Use default Serif fonts only with the default Desktop font set.
Bundle the Playground Serif fonts on native desktop targets.
2026-12-04 02:24:27 +09:00
DarkSky e6c8bded7c perf(edgeless): reuse surface geometry
Reuse paths and labels when surface elements move. Check both endpoints
before a connector reuses its route. Rebuild the items affected by edits.
2026-12-04 01:19:09 +09:00
DarkSky 10c0b03d39 test(room-sync): Wait for the relay to queue seed claims
Use a reply on the same WebSocket to order both waiters before the
original winner disconnects.
2026-12-04 00:28:52 +09:00
DarkSky c7f075a79c feat(playground): add editor fonts and presentation fullscreen 2026-12-03 21:45:06 +09:00
DarkSky db6580abe7 feat(edgeless): add frame presentation 2026-12-03 18:35:08 +09:00
DarkSky 3a75ecff4c feat(desktop): add the outline header and share menu icons
Add a Table of Contents header with a button that opens the sidebar.
Use the BlockSuite icons in the document menu and the outline header.
Keep the last outline tick when the rail has room for it.
Clear the active outline entry when its block stops being a heading.
2026-12-03 17:43:38 +09:00