Repository navigation
Formatting toolbar above the text of the editor - #106
Merged
Merged
Conversation
Esc in the text makes the next Tab move the focus instead of indenting, so that the text can be left with the keyboard. With Shift+Tab, the keydown of Shift itself came first and reset this, so the text could only be left forwards. Keys which are only modifiers no longer reset it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AFJFMQhkaze5WhCnZxGD64
Heading, bulleted and numbered list, quote, horizontal rule, table and help, in the style of the other icons: 16 x 16, drawn with currentColor in the element with the id "i" which iconSvg() uses. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AFJFMQhkaze5WhCnZxGD64
A toolbar (role="toolbar") directly above the text, in the editor of new and existing pages and when restoring a version: bold, italic, a menu of headings 1 to 4, links and links to pages ([[ ]]), bulleted and numbered lists, quotes, code, horizontal rules and tables, then upload and the formatting help. There is no strikethrough, which PHP Markdown does not have. Every change goes through applyChange() and insertTyped(), like Ctrl+B, Ctrl+I and Ctrl+K, whose functions the buttons share (FORMATS): it is one step for Ctrl+Z, an input event for the draft, the warning about leaving and the preview, and the selection moves with the text. Line formats (headings, lists, quotes) set, replace or remove the marker of the touched lines; code is inline within a line and a fenced block for several lines or an empty line, with the cursor after ``` for the language; rules and tables are blocks of their own, with blank lines added as needed. The table dialog asks for 1 to 20 columns and 1 to 100 rows below the header row (default 3 x 3), inserts an aligned pipe table of PHP Markdown Extra and selects the name of the first column; selected lines separated by tabs or commas become a table instead. The buttons keep the focus (and the selection) in the text when clicked. The toolbar is one stop of Tab with a roving tabindex: arrow keys, Home and End move between the buttons, Esc goes back to the text, Alt+F10 in the text goes to the toolbar (also in the list of shortcuts and in the formatting help, which shows a table too). The upload button and the toggle of the formatting help move from the toolbar of the page into the new one: both only work with the script, like the new toolbar, which is hidden without it. The help toggle is a "?" icon at the end instead of the bold/italic/code icon group, which looked like formatting buttons. Where the preview takes the place of the text (narrow screens) the toolbar is hidden with the text; otherwise it wraps. Event handlers are added by wiki.js, the texts come from the templates (translated, German included), the colors from the variables of both schemes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AFJFMQhkaze5WhCnZxGD64
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AFJFMQhkaze5WhCnZxGD64
…ose event The test of the large table (20 columns, 100 rows) read the text right after the click on Insert. The table is inserted in the "close" event of the dialog, which the browser dispatches as a task of its own after the form is submitted, so on a slower browser (CI) the text could still be the old one. The test now waits until the table is there, like the other cases, which use assertions that retry. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AFJFMQhkaze5WhCnZxGD64
main now takes the icons from the subtree of codeling/webicons, where iconSvg() looks for them; the icons of the formatting toolbar are now part of it (codeling/webicons#1, taken with the subtree update in the page history branch), redrawn in the style of the set, so the copies in w2-icons/ go. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AFJFMQhkaze5WhCnZxGD64
…em once
After the table dialog closes, the selection and the focus of the text are
restored in its "close" event, a task of its own after the dialog is
hidden; on the slower browser of CI the test read the cursor before that
("|text" instead of "te|xt"). All checks of the selection (marked()) and
of the focus (focused()) now use expect.poll, which passes at once when the
value is already right, so none of them depends on how soon a browser runs
such a task.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AFJFMQhkaze5WhCnZxGD64
This was referenced Nov 4, 2026
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.
Stack (5 of 5, top): this PR targets #104 (keyboard shortcuts). Below that are #103 (live preview), #102 (code highlighting) and #101 (page history). It contains only the toolbar commits.
To merge all of them as one, merge from the top down, each into its base: this PR, #104, #103, #102. Then merge #101 into
main.What it does
A toolbar (
role="toolbar") directly above the text in the editor, for new pages, editing and restoring old versions. The markup ishiddenand wiki.js shows it, so pages without JavaScript are unchanged.FORMATSmap)#prefix on the selected lines, replaces another level, removes it when the same level is chosen again. The current level is checked[[ ]]>on blank lines inside it, so it stays one block---as a block of its ownTable dialog
|escaped.Behaviour
insertTyped(). That makes it one Ctrl+Z step, and the draft autosave, the leave-page warning and the live preview (Live preview in the editor (#95) #103) all see it.aria-expanded.~~.<use>), CSS for both color schemes, German translations, a toolbar line and a table example in the formatting help, README and tests/README.Tests
FormatBarTestchecks the markup.PageFrameTestis updated for the moved help button.toolbar.spec.js, 22 tests:shortcuts.spec.jshas the Alt+F10 row.editor-indent.spec.jstests Esc then Shift+Tab.xss.spec.js: itsinteract()clicks every element, which now includes the formatting buttons. The test now checks the exact text before the clicks; afterwards it checks that no dialog appeared and that the payload is still in the text.vendor/bin/phpunit: 2249 tests. The one failure,EditorUploadTest::testUploadControlsAreNotShownInTheEditorItself, also fails onmainthere, because the container has no imagick.composer analyse: clean.Notes
addEventListenerwould let the hash go in a follow-up.Generated by Claude Code