gitoria

notes

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commite5abf7b7e5abf7b7notes header: the selector alone top right plus Log out as before the theme missions; the user icon is gonemree5abf7b7/reports/010-mdeditor.md

5.8 KB

  1. # Report 010 — notes on the Hybriel MdEditor block (worker W2) — branch w10-mdeditor-theme, NOT pushed, NOT deployed
  2. ## What changed
  3. - `components/md-editor/` (md-editor.hl, README.md) + `components/SOURCE` = components.hybriel **1442e58**, byte-verbatim, by the new
  4. `tools/sync-components.sh` (modelled on tickets'; `--check` = "verbatim: 2 files").
  5. - `components/notes.hl`: `noteText { id = "notetext" on input(e) { emit typed(e) } MdEditor { name = "text" value = shownText rows = 16 files = "off" placeholder = "" } }`.
  6. `typed` ignores events whose `e.target.name != 'text'` (the block's link / file inputs also fire `input`). Everything else (autosave tick,
  7. offline queue, conflict copies) untouched. `value = shownText` stays bound: no focus loss, the winner of a conflict shows in the editor.
  8. - Removed: `<script src="/md-editor.js">` (main.hl), the `/md-editor.js` route and `offlineFiles = ["/md-editor.js"]` (project.hl),
  9. `shared/md-editor.js` (2529 lines), `md-editor::part(button)` and the `mdEditor { --md-* }` rule (styles.hl; the block reads the `--color-*`
  10. tokens notes already declares). README / CONCEPT updated.
  11. - styles.hl: `.empty` → `p.empty` (the class collision of tickets 021; all 3 uses are `<p class="empty">`); `noteEditor` got
  12. `gridTemplateColumns: minmax(0, 1fr)` and `noteText { display: block; min-width: 0 }` — found by the gate: without them the 690 px wide table
  13. widened the grid and the editor was 690 px on a 390 px phone (tickets 021 fix 4 only covers the toolbar).
  14. - No theme move; look otherwise the block's own (18 rem min-height → rows = 16 ≈ 24 em; files off, so no File button).
  15. ## Parity (each checked in tests/browser.mjs, real keys)
  16. tables (typed header + delimiter → table, Tab, Enter, bold/code cells, `\|`, alignment, wide table scrolls in its box at 390, a cell edit changes only
  17. that cell, byte-for-byte Markdown, reopened from server and offline), heading `# `, bold (Ctrl+B in the E2E), lists, autosave (sidebar subject,
  18. server save, conflicts, delete, offline queue). Not re-implemented: `MdEditor.markdown` test API of the old script — two table checks now read
  19. the Markdown lines instead. Not tested by hand: links (Ctrl+K), code block keys (the block's own gate covers them; notes only stores the text).
  20. ## Proof
  21. - `tests/browser.mjs`: old (efa9217) **64/0** → new **66/0**. +2 checks: "no md-editor.js on the page / `/md-editor.js` 404 / no `md-editor` custom
  22. element" and "phone 390: editor fits, every toolbar button ≥ 44 px, text ≥ 16 px, no File button". The new tests on the OLD code: 16 passed, **3 failed**
  23. (both "no md-editor.js" checks + crash at the editor: no block surface), run with NOTES_GATE_SOFT=1. Test-side changes: shadow-DOM helpers → light
  24. DOM (`#notetext input[name=text]`, `md-editor article`); `editorReady` waits for the surface's children (the block builds them from a 100 ms
  25. animation after the page is live); table cell html may carry the block's zero-width space. One earlier run failed once (delete, "one note less") and
  26. once with the caret at the start (a click before the surface was built) — the second was the missing wait, fixed; the first did not reproduce (load).
  27. - `tests/realdata-offline.mjs` on the newest backup (notes.worldapi.org-20261020-2229.tgz, 28 notes): **12/0**, 390 px: no overflow, taps ≥ 44. Changes to
  28. the test: block selectors; the toolbar's three scrolled-off buttons are not "wide" (the phone toolbar is one row that scrolls inside its own box, by design).
  29. - `tests/e2e-roundtrip.mjs` (new), copy of the same backup, real headless Chrome, all 28 notes: **OPEN** reads all 28 back byte-identical; edit next
  30. to the table (click first paragraph, End, `x`, Backspace) on the one table note in the backup: editor and server text **byte-identical**; the other 27
  31. also identical after the edit (0 canonicalised) — **5 passed / 0 failed**. (Only 1 note of the 28 has a table; the check would fail on any difference, I did not mutate it.)
  32. - E2E in lisbeth's Chrome: tests/e2e-chrome.mjs, own tunnel `-L 8757:127.0.0.1:9223` and `-R 8758/8759`, ONE existing about:blank tab (put back to
  33. about:blank), no clipboard, copy of the backup, real mouse + key events, at 390 and 1280: list, New note, `# heading`, bold, table, list, wait for the
  34. server save, **reload (same text)**, **offline** (Network.emulateNetworkConditions on page and worker): the note and list open offline, typing works,
  35. back online the edit reaches the server, no sideways scroll. **new 24/0, old (live code) 24/0.**
  36. - **Finding (block):** in a background tab the block never builds its surface (its mount is a CSS animation; Chrome does not run it): the first run
  37. hung on an empty editor until `Page.bringToFront`. Not a bug for users with the tab in front; worth a line in components README.
  38. - **Observation, not isolated:** typing a table right after a list (list, Enter Enter, `| Item | Qty |`, Enter, `|:---|---:|`, Enter) stayed plain
  39. paragraphs once, in the E2E; table first then list works. No minimal repro made (out of this mission's budget); Atlas may pass it to components.
  40. ## Shots (20 PNG, not viewable by me — I cannot look at PNGs; the numbers above count)
  41. /media/STORAGE/claude-scratch/atlas/W2/shots/{old,new}-{390,1280}-{1-list,2-typed,3-reloaded,4-offline,5-end}.png (20 files).
  42. ## What changes in layouts docs/usage.md (Atlas)
  43. notes moves from "own copy md-editor.js (fork, listed in tools/usage.sh FORKS)" to a user of the MdEditor block: add `components/md-editor/` + SOURCE
  44. of notes to the usage table (tools/sync-components.sh, 1442e58) and drop notes' md-editor.js from the retire list / FORKS; notes' theme step stays open;
  45. notes keeps `p.empty`, files="off".
  46. ## Cleanup
  47. Servers, tunnel and Chromes killed by PID; `ss`: nothing of mine on 8732–8759 (the two `hybriel` processes in `pgrep` belong to arachne). Data copies deleted.
  48. Scratch: old/ (live code archive), wt/ (branch), logs *.log, pids/.

Branches

Latest commits

  • e5abf7b7notes header: the selector alone top right plus Log out as before the theme missions; the user icon is gonemre
  • a2e343aeident selector back in the header (creator 2026-10-24): selector top right signed in and out on phone and desktop, no second Log in button, new gate checks (WIP: gates not re-run after the last edits)mre
  • b96c7f70theme: sync from layouts 4994037 (list rows stack, td word-keep, heading code, edited tap target)mre
  • 6140e6a0sessions last 99 years (creator 2026-10-23: logins never expire; only sign out ends them)mre
  • cb7e6469deploy: security gate (tests/security.mjs)mre
  • 774bf34bnotes security: CSRF guard on /api/notes, new session at login, Secure cookie, uploadMax 0, login rate limit, nosniff, face payload check; tests/security.mjs; SN reportmre
  • ef18a68fsync components.hybriel 214c318: MdEditor on a phone, two even toolbar rows of 44 px targets, label 15 px, table head 16 px (E2)mre
  • c37488b1MN report: alignment updatemre
  • 4fb35a0enotes mobile: Delete note and the delete row exactly on the editor's edges; gate asserts 1 pxmre
  • 91736270MN report and logmre
  • 15667425notes: delete confirmation buttons at most 12rem wide on the desktopmre
  • 8f7a6a95gate: MN phone checks (list header gutter, back gap, delete question)mre
  • 90c73ed3notes mobile: back link gapmre
  • 72bd4f83notes mobile: list header on the gutter, delete confirmation as a question + two equal buttons, Delete note under the editor edgemre
  • ba1e73f8notes: a sent edit is done once the server's version is not older, so a second writer's text shows in the first tab; gate: two writers both waysmre
  • c69ef9ebsync components.hybriel 134b4e3: MdEditor builds an editor put into the page at once, redraws a surface put in anew (F5, hybriel#211)mre
  • 2eb783f5sync components 9a: shared Icon (icons/icons.hl), md-editor toolbar icons + single focus ring (components f4-icons ba96735)mre
  • 4dd46dadsync-components: copy icons/icons.hl + README (F4); testsmre
  • c92e4a0ftests/e2e-outside.mjs: real-Chrome E2E, a note pushed from another device while open, then typingmre
  • 0516b4ccmd-editor.hl: verbatim copy of components f3-mdvalue (an older text handed back is kept)mre