The mouse and touch: a bar on a clicked sentence, ⋯ and right-click menus, a top bar

- One <Menu>: a popover by the pointer or its button, a sheet from the foot on
  touch; arrows, Home, End, Enter and Esc, closes on a press outside, and gives
  the focus back. Its items come from actions.ts and press their keys.
- A single click on a sentence selects it (as before) and shows a bar over it:
  expand e · define d · why y · example x · challenge c · ask : | link w · ⋯,
  each with its key. A drag or a double click shows it for those words. In an
  article's text too, without link. On a phone it docks at the foot, with ×.
- ⋯ on section rows, a pane's pin and ×, the page's byline and note boxes,
  shown when pointed at or focused, never moving the text. A stale flag,
  clicked, opens the node's menu, its remedies first.
- Right-click on words, a row, a link, a note or a pane: its menu, Copy
  first; the copy key copies the app's selection too. Shift+right-click and
  text boxes keep the browser's menu.
- The top bar: undo, redo when there is something to redo, and menu (documents,
  jump, history, links, layout, settings, command line, help), sticky in the
  column too.
- Key hints in the status line, the history and documents panels and a
  suggestion's card are buttons.
- A first visit is told, once, in the status line, that a click on a sentence
  offers actions and ? lists the keys.

Browser tests: the bar on a click and on a drag, each ⋯ menu, right-click with
Copy, Shift+right-click untouched, the menu's keys, the sticky bar, Lock naming,
the phone's dock and sheet, and links, Shift-clicks, drags and peeks beside it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014yB6q4BHMwptTX3YFtkRab
This commit is contained in:
thalladaandClaude Opus 5.5 committed 2026-11-16 02:20:42 -05:00
1 parent 9b73cdb15e
commit 32efa17294
9 files changed
+1269 -55

No files matched your search

+10
View File
@@ -1655,6 +1655,12 @@ class Store {
this.setFocus({ node: f.node, grain: "word", range: next });
}
/** The sentence of a node's text at an offset (where a click or a right-click lands). */
sentenceAt(id: NodeId, at: number): Range | undefined {
const n = this.snap.nodes[id];
return n ? sentences(n.body).find((r) => at >= r[0] && at <= r[1]) : undefined;
}
noteAt(range: Range | undefined, node = this.focus.node): NodeId | undefined {
if (!range) return;
const s = this.snap;
@@ -1975,6 +1981,10 @@ class Store {
}
return u;
}
/** Whether U would redo something (the top bar offers redo only then). */
canRedo(): boolean {
return !this.preview && this.undoManager().canRedo();
}
/** u: undo the last edit made in this tab, wherever in the library it was. */
undoLast(redo = false) {
if (!this.writable()) return;