Repository navigation
Add drag and drop reordering for included posts - #187
Open
ryanwelcher wants to merge 1 commit into
Open
ryanwelcher wants to merge 1 commit into
ryanwelcher wants to merge 1 commit into
Conversation
Included posts are now listed below the search field as a sortable list. Rows can be dragged, or moved with up/down buttons (focus stays on the button and the move is announced). Each row has a remove button. When there are two or more posts and Order By is not "Included Posts", the help text says to set it. Exclude posts is unchanged. Built with @wordpress/components only, so it works back to WP 6.7. The icons are local copies built from @wordpress/primitives because the @wordpress/icons package bundles React 19 under @wordpress/scripts 24. Adds e2e tests for adding, moving, removing, dragging, the help text, and the frontend order. Fixes #63
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.
What
Lets you set the order of manually included posts. Fixes #63 (from this support forum topic).
In AQL: Post → Include posts, the token field is now used for search only. Picked posts appear in a list below it, and each row has:
speak())With two or more included posts, the help text says to set Order By to Included Posts if it isn't already. Nothing switches automatically. Search results no longer suggest posts that are already in the list.
Exclude posts is unchanged.
Why
post__inordering already worked on the server, butFormTokenFieldcan only add and remove tokens, so there was no way to change the order in the editor.Notes
@wordpress/componentsonly (ItemGroup,Item,HStack,Truncate,Button), so it works back to WP 6.7.@wordpress/uiwas ruled out: it needs thewp-themescript and awp-private-apisopt-in that only exist in WP 7.0+, so the editor script would not load on 6.7 to 6.9.src/components/icons.js, built from@wordpress/primitives. The@wordpress/iconsnpm package pulls in React 19, which gets bundled under@wordpress/scripts24 and crashes the editor.include_postskeeps its{id, title}shape.Testing
New e2e spec
tests/e2e/tests/include-posts-order.spec.ts(6 tests, all passing locally):Manual check in the editor: add three posts, reorder with drag and with the buttons, set Order By to Included Posts, and check the preview and frontend.