Pasting external text no longer works in Studio v3 Rich Editor
In Sanity Studio v3 you are unable to past test from external sources into the rich text editor. However, you can cut and paste text from within the editor itself as expected. Attempting to paste outside text results in the following error message:
Layout.js:50 TypeError: undefined is not a function
at Array.find (<anonymous>)
at blockContentFeatures (schema.ts:31:35)
at createRuleOptions (usePortableTextEditorValue.ts:25:20)
at new HtmlDeserializer (withoutPatching.ts:50:57)
at htmlToBlocks (array.ts:21:24)
at editor2.insertTextOrHTMLData (ActivateOnFocus.js:190:26)
at editor2.insertData (ActivateOnFocus.js:228:16)
at MemberFieldError.js:289:19
at isEventHandled (index.ts:1585:37)
at index.ts:1446:18
To Reproduce
Steps to reproduce the behavior:
- Create any field that is a block element
{
name: "content",
title: "Content",
type: "array",
of: [{ type: "block" }],
},
- Open a new document of the type in Sanity Studio and activate the rich text editor.
- Attempt to past in text from any source (e.g. copy a URL from your browser)
Expected behavior
A clear and concise description of what you expected to happen.
Screenshots
Which versions of Sanity are you using?
Run sanity versions in the terminal and copy-paste the result here.
What operating system are you using?
Which versions of Node.js / npm are you running?
@sanity/cli (global) 3.0.0-dev-preview.15 (latest: 2.30.6)
@sanity/image-url 1.0.1 (up to date)
@sanity/webhook 2.0.0 (up to date)
sanity 3.0.0-dev-preview.15 (latest: 2.29.3)
@theycallmeswift - thanks for the report. I'm trying to reproduce this, but unable to. Could you please give me the result of:
yarn why @sanity/block-tools && yarn why sanity
(or if you use NPM npm ls @sanity/block-tools && npm ls sanity)
Thanks
@skogsmaskin no problem. Here's the output:
[email protected] /Users/theycallmeswift/dev/theycallmeswift.dev
└─┬ [email protected]
├── @sanity/[email protected]
└─┬ @sanity/[email protected]
└── @sanity/[email protected] deduped
[email protected] /Users/theycallmeswift/dev/theycallmeswift.dev
├─┬ [email protected]
│ └── [email protected] deduped
└── [email protected]
@skogsmaskin I was also having trouble reproducing, but I think I have a working broken example (gist linked below). The gist contains a package.json, sanity.config.ts, and a working and non-working package-lock.json. Make sure you provide a valid project key in the sanity config, but otherwise you should be able to reproduce with just these 3-4 files.
https://gist.github.com/theycallmeswift/e198b738174199224e4dc04014b4b85d
Update:
Here's a fun find: If I don't use the package-lock.json files at all, when I install via npm the editor is broken as described, but when I use yarn it works as expected. My guess is that there's some down tree dependency that's not appropriately locked and yarn/npm handle resolving them differently.
Hello, we're currently experiencing this in this repo.
To reproduce:
- Clone the repo (
git clone [email protected]:bike-grid-now/bike-grid-monorepo). - Install deps (
pnpm install) - Run Sanity Studio in
packages/sanity.
Update: this happens on this line:
blockContent is defined and has a fields property that is an array. The code calls Array.find, passing it a function from @sanity/types. Webpack tries to look up this function (__WEBPACK_IMPORTED_MODULE_0__sanity_types__["isBlockChildrenObjectField"]), but it's undefined. The other imports on the object exist:
This is happening in @sanity/block-tools/src/util/blockContentTypeFeatures.ts. I have no clue why the function's getting extracted like that when the source code looks completely different.
I'm getting the same error in v2.33.2 when pasting text:
Dependencies:

Reverting to 2.28.2 resolves the issue.
I'm getting the same error in v2.33.2 when pasting text:
![]()
Dependencies:
Reverting to 2.28.2 resolves the issue.
the same for me... I thought this was a v3 problem only
Had the same issue. For me going back from v2.33.2 to v2.31.1 solved it.
Deleting node_modules and switching to yarn fixed this for me in 3.0.0-dev-preview.21.
Is there any intention to have this working with pnpm for the 2.x branch, or is yarn still the "official" tool to use?
Same issue here on 2.35.2 using pnpm
I came here while researching my issue. I can't paste text into a portable text editor either – and I am also using pnpm.
I see this error:

I am using "sanity": "3.7.1".
Is there a way to make it work besides switching to npm/yarn?
EDIT: Reverting back to "sanity": "3.6.0" solved the issue for me.
I just created a new project, following https://www.sanity.io/docs/create-a-sanity-project with these properties:
? Project name: sanity-tutorial
Your content will be stored in a dataset that can be public or private, depending on
whether you want to query your content with or without authentication.
The default dataset configuration has a public dataset named "production".
? Use the default dataset configuration? Yes
✔ Creating dataset
? Project output path: /Users/andrei.dragu/Workspace/tutorials/sanity-tutorial
? Select project template Blog (schema)
? Do you want to use TypeScript? Yes
✔ Bootstrapping files from template
✔ Resolving latest module versions
✔ Creating default project files
? Package manager to use for installing dependencies? npm
node version: 18.2.1
and
npm ls @sanity/block-tools && npm ls sanity
[email protected] /Users/andrei.dragu/Workspace/tutorials/sanity-tutorial
└─┬ [email protected]
├── @sanity/[email protected]
└─┬ @sanity/[email protected]
└── @sanity/[email protected] deduped
[email protected] /Users/andrei.dragu/Workspace/tutorials/sanity-tutorial
└── [email protected]
and afther npm run dev I get this error when I try to paste any text in a block element
toast error
Uncaught error
Cannot apply deep operations on primitive values. Received patch with type "set" and path "{"_key":"1a3435cf8a13"} that targeted the value "undefined"
console error
Error: Cannot apply deep operations on primitive values. Received patch with type "set" and path "{"_key":"1a3435cf8a13"} that targeted the value "undefined"
at _primitiveApply (primitive.ts:34:11)
at _applyPatch (applyPatch.ts:23:10)
at applyPatch5 (applyPatch.ts:27:15)
at Array.reduce (<anonymous>)
at applyAll2 (applyPatch.ts:10:18)
at ArrayOfObjectsField.tsx:102:24
at PortableTextInput.tsx:259:20
at Synchronizer.tsx:74:7
at invokeFunc (debounce.js:95:19)
at trailingEdge (debounce.js:144:14)
I came here while researching my issue. I can't paste text into a portable text editor either – and I am also using pnpm.
I see this error:
I am using
"sanity": "3.7.1".Is there a way to make it work besides switching to npm/yarn?
EDIT: Reverting back to
"sanity": "3.6.0"solved the issue for me.
I am receiving the same error on paste of text in some cases.
Reverting to 3.6.0 fixes it on my end as well.
Faced the same issue when pasting text with line breaks to fields of type Portable Text. Downgrading to sanity 3.7.0 from 3.7.1 fixed it for me
This is now fixed with release of v3.8.0
Thank your for reporting this issue. Sorry for the inconvenience, we have now added a test to avoid this particular problem happening again.
While v3 is surely the way, for anyone who needs it, I was able to work around this on v2 by using latest versions and pointing back to form-builder 2.31.1 on overrides:
In the package.json (in the root one if you have workspaces)
{
...
"dependencies": {
...
},
"pnpm": {
"overrides": {
"@sanity/form-builder": "2.31.1"
}
},
...
Is this no longer supported anymore?
I'm trying to paste text into a body in Sanity Studio, and it doesn't work, getting this:
DataTransfer with kind="string" is currently not supported
Using sanity v3.44.0
Is this no longer supported anymore?
I'm trying to paste text into a body in Sanity Studio, and it doesn't work, getting this:
DataTransfer with kind="string" is currently not supportedUsing
sanity v3.44.0
I'm experiencing the same issue right now
Is this no longer supported anymore?
I'm trying to paste text into a body in Sanity Studio, and it doesn't work, getting this:
DataTransfer with kind="string" is currently not supportedUsing
sanity v3.44.0
Same error here on sanity v3.45.0, trying to paste in plain text.
Same error for me, v3.45.0. Issue should be reopened?
There's a new issue already opened that's tracking this: https://github.com/sanity-io/sanity/issues/6715