How to handle pasting of HTML content into PortableText editor? #4987
Unanswered
lbittner-pdftron
asked this question in
Sanity Studio Support
Replies: 1 comment 1 reply
-
I should mention that I have tried some stuff with the I would prefer to handle this on the type/field level rather than the editor level. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hey there!
We are utilizing the PortableText input provided by Sanity, but are having some issues when it comes to handling pasted HTML content.
We are migrating an old static site to Sanity which involves a lot of copy pasting text from a website into the portable text editor. When an HTML link () is pasted into the editor, Sanity automatically creates a "link" mark with a "href" field. The issue is that we are using the internalLink / externalLink pattern documented here, so our "link" type doesn't have an 'href' field. This is causing the following error when an HTML link is pasted into the editor:
What I would like to have happen is to take the 'href' field it assigns and automatically set that value as the "externalLink" value instead. Is it possible to transform data in this way?
Beta Was this translation helpful? Give feedback.
All reactions