Skip to content

Display any URL in a View Pane, along with helpful buttons to copy the URL, display a mobile size, reload the iframe or open in a new tab

License

Notifications You must be signed in to change notification settings

thebiggianthead/sanity-plugin-iframe-pane

 
 

Repository files navigation

sanity-plugin-iframe-pane

NOTE This is for the Studio v2 version of the plugin

There is a Studio v3 specific version in the studio-v3 branch

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

sanity install 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, // default `undefined`
    },
  })
  .title("Preview");

License

MIT © Simeon Griggs See LICENSE

About

Display any URL in a View Pane, along with helpful buttons to copy the URL, display a mobile size, reload the iframe or open in a new tab

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 100.0%