Socket
Socket
Sign inDemoInstall

sanity-plugin-sync-content

Package Overview
Dependencies
4
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    sanity-plugin-sync-content

A Sanity plugin for copy and pasting referenced blocks in array type of fields in Sanity Studio. Based on [sanity-plugin-copy-paste](https://github.com/superside-oss/sanity-copy-paste), but was configured to fit the use cases of our projects needs.


Version published
Maintainers
1
Created

Changelog

Source

1.0.1 (2024-01-22)

Bug Fixes

  • input: add flex wrap to fix style inconsistencies in mobile devices (20bf398)

Readme

Source

Sanity Plugin Sync Content

A Sanity plugin for copy and pasting referenced blocks in array type of fields in Sanity Studio. Based on sanity-plugin-copy-paste, but was configured to fit the use cases of our projects needs.

This is a Sanity Studio v3 plugin.

Installation

npm install sanity-plugin-sync-content

Usage

Add it as a plugin in sanity.config.ts (or .js):

import {defineConfig} from 'sanity'
import {syncContentPlugin} from 'sanity-plugin-sync-content'

export default defineConfig({
  //...
  plugins: [
    // ...other plugins
    syncContentPlugin()
  ],
})

Just add directly the defineField for copyPaste directly into any of your referenced block array like so:

import {defineConfig} from 'sanity'
import {copyPaste} from 'sanity-plugin-sync-content'

export default defineType({
  name: "my-section",
  title: "My Example Section",
  type: "object",
  fields: [
    copyPaste,
    // ...your-other-fields
  ]
})

Overriding copyPaste field configuration

You can override some of the configuration for the copyPaste field like so:

export default defineType({
  name: "my-section",
  title: "My Example Section",
  type: "object",
  fields: [
    {
      ...copyPaste,
      title: "The New Copy Paste Title",
      hidden: () => {
        // Some logic

        return true;
      },
      // ...other configurations
    },
    // ...your-other-fields
  ]
})

License

MIT © Evelan

Develop & test

This plugin uses @sanity/plugin-kit with default configuration for build & watch scripts.

See Testing a plugin in Sanity Studio on how to run this plugin with hotreload in the studio.

Keywords

FAQs

Last updated on 22 Jan 2024

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc