Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot read properties of undefined (reading '_type') #3

Open
andreagiachettobold opened this issue Jun 5, 2023 · 2 comments
Open

Comments

@andreagiachettobold
Copy link

Hello!

Thank you for your time and work into this plugin.
I tried that, but I cannot make it work.

I added the code as you displayed on the readme file, but I get this message:

CopyPasteInput.tsx:75 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading '_type') at onPaste (CopyPasteInput.tsx:75:62) at onClick (CopyPasteInput.tsx:309:30)

Those are my dependencies on the package.json file

"dependencies": { "@sanity/document-internationalization": "^1.1.1", "@sanity/ui": "^1.3.3", "@sanity/vision": "^3.10.1", "@superside-oss/sanity-plugin-copy-paste": "^1.0.2", "get-video-id": "^3.6.5", "react": "^18.2.0", "react-dom": "^18.2.0", "react-icons": "^4.8.0", "react-is": "^18.2.0", "sanity": "^3.10.1", "sanity-plugin-media": "^2.0.5", "styled-components": "^5.3.10" }, "devDependencies": { "@sanity/eslint-config-studio": "^2.0.1", "eslint": "^8.40.0", "prettier": "^2.8.8", "typescript": "^5.0.4" },

@dnzg
Copy link
Collaborator

dnzg commented Jun 6, 2023

@andreagiachettobold could you share the schema where you inserted defineField(copyPaste)?

@andreagiachettobold
Copy link
Author

andreagiachettobold commented Jun 6, 2023

Sure!
I followed the readme file, here's my snippet:

`import {copyPaste} from '@superside-oss/sanity-plugin-copy-paste'

export const page = defineType({
name: 'page',
title: 'Page',
type: 'document',
icon,
i18n: true,
groups: [
{title: 'Content', name: 'content', default: true},
{title: 'Page Settings', name: 'pageSettings'},
{title: 'SEO', name: 'seo'},
],
fields: [
defineField(copyPaste),
defineField({
title: 'Page Title',
name: 'title',
type: 'string',
group: 'content',
validation: (Rule) => Rule.required(),
}),
...`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants