Repository navigation
Add a minimized option to repeaters - #114
Merged
Merged
Conversation
Repeaters with many rows get long in the sidebar (inline0#95). With "minimized": true the rows that exist when the field mounts start collapsed. Rows added in the editor start expanded so they can be filled in, and a row the user expands stays expanded, stored like the collapsed rows of other repeaters but under its own key. The option is in the block and extend schemas, the types and the field reference. A test block and an e2e test cover collapsed existing rows, an expanded new row and an expanded row after a reload.
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 #95.
Repeaters with many rows get long in the sidebar. This adds a
minimizedoption:{ "id": "items", "type": "repeater", "minimized": true, "textMinimized": { "id": "title" }, "attributes": [{ "id": "title", "type": "text", "label": "Title" }] }textMinimizedlabel.localStoragelike the collapsed rows of other repeaters, but under its own key (blockstudioRepeaterExpanded), because for these repeaters the stored rows are the expanded ones. Repeaters without the option behave as before.Changes:
repeater.tsx, theminimizedproperty in the four repeater definitions ofblock.jsonandextend.json(checksums updated), the types (by hand, like the other recent options, sincenpm run typesfails withs.codePointAt is not a functionin quicktype on Node 20 and 26), the field reference vianpm run docs:generate, the LLM index, and a test block with an e2e test (tests/e2e/types/repeater/minimized.ts).I ran the new e2e test and the existing repeater tests (
repeater.ts,default-rows.ts,nested.ts, 49 tests) against a local WordPress Playground site set up like wp-env (test theme,/e2e/setup, bundle rebuilt locally): all green. With the committed bundle the new test fails at "existing rows start collapsed", as it should.npm run checkpasses. Bundles are not rebuilt in this PR.If you prefer a different name, or a "collapse all" control instead of an option, I am happy to change it.