SanityNPMGithub
Get a peek at our latest innovations at Sanity Product Day on Dec 8th →

Iframe Pane

v3 Ready

By Simeon Griggs

Display any URL in a View Pane, along with helpful buttons to Copy the URL or open in a new tab.

sanity-plugin-iframe-pane

This is a Sanity Studio v2 plugin. There is a Studio v3 specific version

Display any URL in a View Pane, along with helpful buttons to Copy the URL or open in a new tab.

Accepts either a string or an async function to resolve a URL based on the current document.

Iframe View Pane

Installation

yarn add sanity-plugin-iframe-pane@studio-v2

Next, add "iframe-pane" to sanity.json plugins array:

"plugins": [
  "iframe-pane"
]

This is designed to be used as a Component inside of a View.

// ./src/deskStructure.js
import Iframe from "sanity-plugin-iframe-pane";

// ...all other list items

S.view
  .component(Iframe)
  .options({
    // Required: Accepts an async function
    url: (doc) => resolveProductionUrl(doc),
    // OR a string
    url: `https://sanity.io`,
    // Optional: Set the default size
    defaultSize: `mobile`, // default `desktop`
    // Optional: Add a reload button, or reload on new document revisions
    reload: {
      button: true, // default `undefined`
      revision: true, // boolean | number. default `undefined`. If a number is provided, add a delay (in ms) before the automatic reload on document revision
    },
    // Optional: Pass attributes to the underlying `iframe` element:
    // See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe
    attributes: {
      allow: 'fullscreen' // string, optional
      referrerPolicy: 'strict-origin-when-cross-origin' // string, optional
      sandbox: 'allow-same-origin' // string, optional
    }
  })
  .title("Preview");

License

MIT © Simeon Griggs See LICENSE

Studio Version

This plugin is available for Studio v3 and Studio v2.What are studio versions and which do I choose?

Contributor

Other plugins by author

Orderable Document List
- has 27 likes

Official(made by Sanity team)

Drag-and-drop Document Ordering without leaving the Editing surface

Simeon Griggs
Go to Orderable Document List

Hotspot array

Official(made by Sanity team)
v3 Ready

Associate arrays with hotspots on any image

Go to Hotspot array