
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
@sanity/orderable-document-list
Advanced tools
Drag-and-drop Document Ordering without leaving the Editing surface
Drag-and-drop Document Ordering without leaving the Editing surface.
This plugin aims to be OS-like in that you can select and move multiple documents by holding shift
and clicking a second item, and toggling on/off selections by holding command/control
.
A Sanity Studio with Desk Structure configured.
sanity install @sanity/orderable-document-list
The config parameter requires type
and also accepts title
and icon
.
// ./src/desk-structure/index.js (or similar)
import S from '@sanity/desk-tool/structure-builder'
import {orderableDocumentListDeskItem} from '@sanity/orderable-document-list'
export default () =>
S.list()
.title('Content')
.items([
// Minimum required configuration
orderableDocumentListDeskItem({type: 'category'}),
// Optional configuration
orderableDocumentListDeskItem({
type: 'project',
title: 'Projects',
icon: Paint
}),
// ... all other desk items
orderRank
field to your schema(s).You must pass in the type
of the schema, to create an initialValue
value.
Additionally, pass in overrides for the field, such as making it visible by passing hidden: false
.
You cannot override the name
, type
or initialValue
attributes.
Example:
// ./src/schema/category.js (or similar)
import {
orderRankField,
orderRankOrdering,
} from '@sanity/orderable-document-list';
export default {
name: 'category',
title: 'Category',
type: 'document',
// Optional: The plugin also exports a set of 'orderings' for use in other Document Lists
orderings: [orderRankOrdering],
fields: [
// Minimum required configuration
orderRankField({ type: 'category' }),
// OR you can override _some_ of the field settings
orderRankField({ type: 'category', hidden: false }),
// ...all other fields
On first load, your Document list will not have any Order. You can select "Reset Order" from the menu in the top right of the list. You can also re-run this at any time.
The orderRankField
will query the last Document to set an initialValue
to come after it. New Documents always start at the end of the Ordered list.
Now when writing a GROQ Query for Documents, use the orderRank
field value to return ordered results:
*[_type == "category"]|order(orderRank)
To get this first version out the door there are few configuration settings and a lot of opinions. Such as:
name
of the orderRank
field is constanttype
filter
configuration on the Document ListFeedback and PRs welcome :)
Uses kvandakes's TypeScript implementation of Jira's Lexorank to create a "lexographical" Document order.
Put simply it updates the position of an individual – or many – Documents in an ordered list without updating any others. It's fast.
MIT © Simeon Griggs See LICENSE
FAQs
Drag-and-drop Document Ordering without leaving the Editing surface
The npm package @sanity/orderable-document-list receives a total of 8,708 weekly downloads. As such, @sanity/orderable-document-list popularity was classified as popular.
We found that @sanity/orderable-document-list demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 71 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.