Open FancyJeff opened 1 month ago
These special characters are added by Sanity when using visual editing mode. They allow Sanity to work out where it needs to go withing Sanity studio when clicking on the content. You can read more about it here.
If you need to remove these characters from the string you can import stegaClean
from @sanity/client/stega
.
I think there is a problem here though. It looks like the stega encoding is enabled all the time when using this module and having visual editing configured. But as far as I understand, stega and anything visual editing-related are only supposed to be enabled when preview mode is enabled? Tried to find more clear answers in the Sanity docs and they ever only mention stega in relation to preview mode. Sorry for pinging @danielroe
Thanks @jesperbjerke, I think that assumption is correct. I've added a fix in #1023.
Version
module: 1.8.3 nuxt: 3.11.2
Nuxt configuration
export default defineNuxtConfig({ devtools: { enabled: true }, modules: ["@nuxtjs/sanity"],
sanity: { projectId: process.env.NUXT_SANITY_PROJECT_ID, dataset: process.env.NUXT_SANITY_DATASET, useCdn: true, //
false
if you want to ensure fresh data apiVersion: process.env.NUXT_SANITY_API_VERSION || '2024-03-15', visualEditing: { studioUrl: process.env.NUXT_SANITY_STUDIO_URL || 'http://localhost:3333', token: process.env.NUXT_SANITY_API_READ_TOKEN, stega: true, }, }, })Reproduction
Make a query to a text or string field in sanity.
Link: [ ] https://stackblitz.com/edit/nuxt-sanity [x] GitHub repository https://github.com/FancyJeff/test-sanity-nuxt
What is expected?
Getting a basic string
What is actually happening?
A huge number of special characters is being appended to the end of the string
Additional information
This does not occur on package version 1.8.3, I tested it as early as 1.10.0 and it still was occurring.
I have created an empty package with no other packages and used the latest versions of everything and its still occurring.
Checklist
What is actually happening?
Screen shot of the chrome dev tools![Screenshot 2024-05-27 123818](https://github.com/nuxt-modules/sanity/assets/30362360/625d8084-71e4-4dda-96c5-1702dbbd40c3)