Sanity Library Reference Docs
    Preparing search index...
    interface VisualEditingProps {
        basePath?: string;
        components?: OverlayComponentResolver<
            OverlayComponent<Record<string, unknown>, any>,
        >;
        history?: undefined;
        keepStegaOnCopy?: boolean;
        onPerspectiveChange?: (perspective: ClientPerspective) => void;
        onSuspiciousStega?: (reports: SuspiciousStegaReport[]) => void;
        plugins?: OverlayPluginDefinition[];
        refresh?: (payload: HistoryRefresh) => false | Promise<void>;
        trailingSlash?: boolean;
        zIndex?: string | number;
    }

    Hierarchy

    Index

    Properties

    basePath?: string

    If next.config.ts is configured with a basePath we try to configure it automatically, you can disable this by setting basePath to ''.

    basePath="/my-custom-base-path"
    @alpha experimental and may change without notice
    process.env.__NEXT_ROUTER_BASEPATH || ''
    
    components?: OverlayComponentResolver<
        OverlayComponent<Record<string, unknown>, any>,
    >

    This API is unstable and could change at any time.

    history?: undefined

    The histoy adapter is already implemented

    keepStegaOnCopy?: boolean

    While Visual Editing is enabled, stega-encoded metadata (invisible characters) is automatically stripped from clipboard data when content is copied from the page, so copied text can be pasted into other tools without the hidden characters tagging along. Set this option to true to opt out and keep stega in copied content.

    onPerspectiveChange?: (perspective: ClientPerspective) => void

    This event can be used to make sure server side data fetching uses the same client perspective as the Sanity Studio that is driving the visual editing.

    onSuspiciousStega?: (reports: SuspiciousStegaReport[]) => void

    Reports stega payloads found in places where they always cause bugs or bloat, such as class, href, src, id and other attributes, inside <head> (e.g. <title>), <script> or <style> contents, form values, or the page URL. Providing the callback opts in to the detection logic — when it isn't provided no scanning runs. Reports are deduped and batched, and include the decoded edit info when available so the source field can be tracked down and cleaned with stegaClean from @sanity/client/stega.

    This API is unstable and could change at any time.

    refresh?: (payload: HistoryRefresh) => false | Promise<void>

    The refresh API allows smarter refresh logic than the default location.reload() behavior.

    trailingSlash?: boolean

    If next.config.ts is configured with a trailingSlash we try to detect it automatically, it can be controlled manually by passing a boolean.

    trailingSlash={true}
    @alpha experimental and may change without notice
    Boolean(process.env.__NEXT_TRAILING_SLASH)
    
    zIndex?: string | number

    The CSS z-index on the root node that renders overlays, tweak it accordingly to what layout you have.