The solution is different for Next.js App Router vs Pages Router.
If it is server component, every canvas component has context
property, that has searchParams
, which you can then pass into isIncontextEditingEnabled
. For example:
You can verify the state by checking the Preview State of your Next.js project, because Uniform Canvas is rendering the site via the preview mode.
Please note that preview may be 'true' even outside Uniform Canvas, if you pass the preview NextJS cookies. For example, in Vercel. If you want to execute the code only in Uniform, use the example below:
Another example for use inside a component:
Or to check the precise editorial state: