Repository navigation
feat(ui): Cooklang toolbar above the recipe editor - #540
Merged
Merged
Conversation
Collaborator
Author
LeMyst
marked this pull request as ready for review
September 25, 2026 21:13
Add a toolbar above the web editor with one-click Ingredient, Cookware, Timer, Section, Note, Comment and Metadata actions. Each inserts the markup, or wraps the selection in it, as a single undo step and gives focus back to the editor. The transactions live in static/js/src/toolbar.js and are exposed on window.CooklangEditor. The toolbar follows the ARIA toolbar pattern (one tab stop, arrow keys, Home/End) and carries data-mode="recipe" so a menu group can be added later (cooklang#538). Closes cooklang#537 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01EpBcu3KakfhQ484WdtDE9q
Add the editor-toolbar-* keys to de-DE, es-ES, eu-ES, nl-NL and sv-SE, using each locale's existing words for ingredients, cookware, timers and notes. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01EpBcu3KakfhQ484WdtDE9q
LeMyst
force-pushed
the
feat/editor-toolbar
branch
from
September 25, 2026 21:51
ac84578 to
c5791af
Compare
3 of 4 tasks
This was referenced Sep 27, 2026
Closed
LeMyst
added a commit
that referenced
this pull request
Sep 28, 2026
- error-title and error-back-home in de-DE, es-ES, eu-ES, fr-FR and nl-NL, missing since dec59f1 added the error page. - shopping-include-in-list in de-DE, es-ES, eu-ES, fr-FR, nl-NL and sv-SE, missing since #318. - The 18 editor-toolbar-* messages #540 added to every locale but it-IT, which was merged (#543) while #540 was open. Fluent falls back to en-US for a missing message, so nothing failed and the pages came out half in English. tests/locales_test.rs now fails when a locale lacks a message en-US has, naming the locale, file and ids. Closes #566. Co-authored-by: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Closes #537
What
A toolbar above the web editor (
/edit/{path}) with one-click Cooklang elements. Each button inserts the syntax, or wraps the selection in it:x@{}, cursor after@@x{}, cursor inside{}#{}#x{}~{%minutes}, cursor on the quantity~x{%minutes}== Section ==on its own line, name selected== x ==>on the current line(s)--on the current line(s)[- x -]for a selection inside a line (and unwraps it again)---\ntitle: \n---at the top, or a new line at the end of the existing frontmatterEach action is one undo step (
isolateHistory), and focus goes back to the editor afterwards. Surrounding whitespace in a selection stays outside the markup, and Section keeps blank lines around the heading.How
static/js/src/toolbar.js:wrapSelection,prefixLines,insertBlock,findFrontmatter/ensureFrontmatter, built onchangeByRange. ArecipeActionsregistry is keyed bydata-action, andinitToolbar(root, view, actions)handles clicks and the ARIA toolbar keyboard pattern (single tab stop, arrow keys, Home/End). Everything is exposed onwindow.CooklangEditor, and the bundle keeps its singlebuild-jsentry.templates/edit.html:role="toolbar"withdata-mode="recipe"and tworole="group"groups. Every button has anaria-labelthat matches its visible text, plus atitlehint.static/css/components.css:.editor-toolbarcomponent, built on the existing tokens. It wraps at phone width, and the divider between groups is dropped there.editor-toolbar-*keys in every locale (en-US, fr-FR, de-DE, es-ES, eu-ES, nl-NL, sv-SE). They reuse each locale's existing words for ingredients, cookware, timers and notes, and the default section name is localised too. de/es/eu/nl/sv are machine-assisted, so a native speaker's review is welcome.Built for #538: the menu mode can pass
{...recipeActions, ...menuActions}toinitToolbar. Keyboard navigation already coversselect/inputitems (it leaves arrow keys alone inside text fields).insertBlockandfindFrontmatterare exported for Day blocks and theservingsdefault.Differences from the issue
>instead of only adding it, for consistency with Comment.>>legacy metadata lines don't count as notes.{is a placeable in Fluent.Tests
tests/e2e/editor-toolbar.spec.ts(31 tests): every button with and without a selection, undo steps, editor refocus, ARIA role/labels/tabindex, keyboard navigation, axe scans of the toolbar in light and dark, no overflow at 375px.PUT /api/recipes/**is intercepted so autosave never touchesseed/.cargo fmt,cargo clippy(no warnings),cargo test, and the fullnpm test(179 passed, 5 skipped) all pass.Not in this PR
🤖 Generated with Claude Code
https://claude.ai/code/session_01EpBcu3KakfhQ484WdtDE9q