Adds drag and drop reordering of documents in selected collections, saving the position in a docOrder field. Front ends can then query with sort by docOrder through REST, the Local API or GraphQL. It is configured through the plugins array with a collections map, an optional access function and an option to initialize docOrder on existing documents. The plugin is deprecated in favor of Payload's built-in orderable feature and targets Payload 3.28.1 and later.
Docs-reorder plugin for PayloadCMS 3.0
Installation
npm i @veiag/payload-docs-reorder4
Stars
0
Forks
0
Open Issues
1 years ago
Last Updated
0
Weekly Downloads
v1.0.2
npm Version
60.7 KB
Unpacked Size
1
Dependencies
Trends appear after 7 days of data. Daily snapshots have not started yet.
Trends appear after 7 days of data. Daily snapshots have not started yet.
Each point is npm's rolling 7-day download count.
Health Score
Composite score based on GitHub activity, stars, npm downloads, publish recency, dependency count, and package size.
Badge for your README
[](https://payloaddirectory.dev/plugins/952123617-root)<a href="https://payloaddirectory.dev/plugins/952123617-root"><img src="https://payloaddirectory.dev/badge/952123617-root.svg" alt="Payload Directory"></a>README
[!CAUTION] This plugin is deprecated, due to a new feature added to Payload -
orderable
This plugin has all of the features (and most of the code) of the original plugin by r1tsuu, but with some improvements and made compatible with latest Payload version. (3.28.1)
npm i @veiag/payload-docs-reorder
Adds an option to re-order collection documents with drag n drop (almost like array/blocks items). Then on your front end you can query documents with applied sort by docOrder field.
https://github.com/user-attachments/assets/a47ab7a1-a58c-4626-aad3-9ca33788dbd8
In your payload.config.ts:
/// ....
import { docsReorder } from '@veiag/payload-docs-reorder';
export default buildConfig({
// ...
plugins: [
docsReorder({
collections: {
posts: true, //Slug of the collection
},
// Needed to initialize values of docOrder field in collection documents.
// Only needed once per collection.
// (Run payload once (NOT in dev mode) with this option enabled , and more if you add new collection)
initializeDocOrder: true,
access: ({ req, data }) => {
// Optional, configure access for `saveChanges` endpoint, default: Boolean(req.user)
return req.user?.collection === 'admins';
},
}),
],
});
REST:
fetch('http://localhost:3000/api/examples?sort=docOrder').then((res) => res.json());
Local API:
payload.find({ collection: 'examples', sort: 'docOrder' });
GraphQL:
query {
Examples(sort: "docOrder") {
docs {
title
}
}
The plugin uses the onInit function to initialize the docOrder field. However, it is not recommended to use this in development mode. It will trigger the afterChange hook, which in my case attempts to call revalidateTag and results in an error when building the admin panel: "Route /admin/[[...segments]] used 'revalidatePath' during render which is unsupported."
Running next start in production mode will not trigger the error, because pages are prerendered and the revalidateTag function is not called.
If you have any issues, please open an issue on this repository.
payload theme
shadcn-style redesign of the Payload admin panel driven by one accent color, with dashboard, command palette and dark…
69909/wk26v3
payload nested docs page tree
Drag-and-drop page tree with status badges for Payload nested docs collections in the admin list view
690/wk35v3
payload plugin info tooltip
Show field help as an info icon tooltip next to the label instead of a description under the field
670/wk6v3 v4
payload lineage
Admin pages showing a lineage graph and ERD data model of your collections, globals and blocks
66400/wk0v3
theme management
Theme presets, live preview and WCAG contrast audit managed from the Payload admin, with SSR theme injection for Next.js
650/wk9v3
payload nav studio
Replace the Payload admin sidebar with a drag-and-drop navigation that each user can customize
640/wk13v3