NouanceLabs

payload iframe tabs plugin

by NouanceLabs
Admin customization
v2
^2.0.0
MIT

Overview

Summary generated from the README

Adds extra tabs to the edit views of collections and globals in the Payload admin, each rendering an iframe. A tab can load a fixed source URL, render custom markup, or take its URL from a watched field value. It is configured through the plugin options and targets Payload 2.x.

Features

  • Add iframe tabs to collections and globals by slug
  • Src mode loads an embeddable URL with optional iframe props
  • Code mode renders custom markup supplied as a string
  • Dynamic mode reads the iframe URL from a watched field
  • Each tab has a unique name, label and URL path

Use cases

  • Embed a Figma design or video next to a document's edit form
  • Preview an external page whose URL is stored in a document field
  • Show external dashboards or reference content inside the admin panel

From the author

A plugin that easily allows you add iframes into separate tabs in the admin panel

Installation

npm i @nouance/payload-iframe-tabs-plugin

25

Stars

1

Forks

1

Open Issues

2 years ago

Last Updated

12

Weekly Downloads

v1.0.2

npm Version

26.8 KB

Unpacked Size

0

Dependencies

GitHub stars

250 since Sep 7

Show data
GitHub stars by day (UTC)
DateStars
Dec 6, 202625
Dec 5, 202625
Dec 4, 202625
Dec 3, 202625
Dec 2, 202625
Dec 1, 202625
Nov 30, 202625
Nov 29, 202625
Nov 28, 202625
Nov 27, 202625
Nov 26, 202625
Nov 25, 202625
Nov 24, 202625
Nov 23, 202625
Nov 22, 202625
Nov 21, 202625
Nov 20, 202625
Nov 19, 202625
Nov 18, 202625
Nov 17, 202625
Nov 16, 202625
Nov 15, 202625
Nov 14, 202625
Nov 13, 202625
Nov 12, 202625
Nov 11, 202625
Nov 10, 202625
Nov 9, 202625
Nov 8, 202625
Nov 7, 202625
Nov 6, 202625
Nov 5, 202625
Nov 4, 202625
Nov 3, 202625
Nov 2, 202625
Nov 1, 202625
Oct 31, 202625
Oct 30, 202625
Oct 29, 202625
Oct 28, 202625
Oct 27, 202625
Oct 26, 202625
Oct 25, 202625
Oct 24, 202625
Oct 23, 202625
Oct 22, 202625
Oct 21, 202625
Oct 20, 202625
Oct 19, 202625
Oct 18, 202625
Oct 17, 202625
Oct 16, 202625
Oct 15, 202625
Oct 14, 202625
Oct 13, 202625
Oct 12, 202625
Oct 11, 202625
Oct 10, 202625
Oct 9, 202625
Oct 8, 202625
Oct 7, 202625
Oct 6, 202625
Oct 5, 202625
Oct 4, 202625
Oct 3, 202625
Oct 2, 202625
Oct 1, 202625
Sep 30, 202625
Sep 29, 202625
Sep 28, 202625
Sep 27, 202625
Sep 26, 202625
Sep 25, 202625
Sep 24, 202625
Sep 23, 202625
Sep 22, 202625
Sep 21, 202625
Sep 20, 202625
Sep 19, 202625
Sep 18, 202625
Sep 17, 202625
Sep 16, 202625
Sep 15, 202625
Sep 14, 202625
Sep 13, 202625
Sep 12, 202625
Sep 11, 202625
Sep 10, 202625
Sep 9, 202625
Sep 8, 202625
Sep 7, 202625
npm weekly downloads

12+7 since Sep 7

Show data
npm weekly downloads by day (UTC)
DateWeekly downloads
Dec 6, 202612
Dec 5, 202612
Dec 4, 20266
Dec 3, 20267
Dec 2, 20264
Dec 1, 20266
Nov 30, 20266
Nov 29, 20268
Nov 28, 20268
Nov 27, 20268
Nov 26, 20267
Nov 25, 20266
Nov 24, 20265
Nov 23, 20265
Nov 22, 20264
Nov 21, 20268
Nov 20, 20267
Nov 19, 20267
Nov 18, 20269
Nov 17, 20268
Nov 16, 20268
Nov 15, 20267
Nov 14, 20263
Nov 13, 20263
Nov 12, 20263
Nov 11, 20263
Nov 10, 20265
Nov 9, 20265
Nov 8, 20268
Nov 7, 20268
Nov 6, 20268
Nov 5, 20268
Nov 4, 20266
Nov 3, 20264
Nov 2, 20264
Nov 1, 20260
Oct 31, 20263
Oct 30, 20263
Oct 29, 20263
Oct 28, 20263
Oct 27, 20264
Oct 26, 20265
Oct 25, 20265
Oct 24, 20263
Oct 23, 20263
Oct 22, 20267
Oct 21, 20267
Oct 20, 20267
Oct 19, 20267
Oct 18, 20268
Oct 17, 20267
Oct 16, 20267
Oct 15, 20263
Oct 14, 20266
Oct 13, 20265
Oct 12, 20264
Oct 11, 20264
Oct 10, 20264
Oct 9, 20264
Oct 8, 20264
Oct 7, 20261
Oct 6, 20261
Oct 5, 20261
Oct 4, 20260
Oct 3, 20261
Oct 2, 20261
Oct 1, 20261
Sep 30, 20261
Sep 29, 20261
Sep 28, 20261
Sep 27, 20261
Sep 26, 20263
Sep 25, 20264
Sep 24, 20264
Sep 23, 20264
Sep 22, 20265
Sep 21, 20268
Sep 20, 20268
Sep 19, 20265
Sep 18, 20264
Sep 17, 20264
Sep 16, 20265
Sep 15, 20265
Sep 14, 20262
Sep 13, 20262
Sep 12, 20263
Sep 11, 20263
Sep 10, 20264
Sep 9, 20264
Sep 8, 20265
Sep 7, 20265

Each point is npm's rolling 7-day download count.

Health Score

42/100Fair

Composite score based on GitHub activity, stars, npm downloads, publish recency, dependency count, and package size.

Badge for your README

Payload Directory health badge
Markdown
[![Payload Directory](https://payloaddirectory.dev/badge/737641997-root.svg)](https://payloaddirectory.dev/plugins/737641997-root)
HTML
<a href="https://payloaddirectory.dev/plugins/737641997-root"><img src="https://payloaddirectory.dev/badge/737641997-root.svg" alt="Payload Directory"></a>
Updated Jan 1, 2024Created Dec 31, 2023Published Jan 1, 2024

README

Payload Iframe Tabs Plugin

A plugin that easily allows you add iframes into separate tabs in the admin panel.

iframepluginshowcase (2)

Installation

  yarn add @nouance/payload-iframe-tabs-plugin
  # OR
  npm i @nouance/payload-iframe-tabs-plugin

Features

Supported tabs

Currently usage is the same for globals and collections as well.

Basic usage:

import iframeTabsPlugin from '@nouance/payload-iframe-tabs-plugin'

// ...

iframeTabsPlugin({
  enabled: true,
  collections: [
    {
      slug: 'examples',
      tabs: [
        {
          name: 'FirstYoutube',
          label: 'Michael Scott',
          path: '/michael-scott',
          src: 'https://www.youtube.com/embed/B9MNITrHu9E',
        },
      ],
    },
  ],
  globals: [
    {
      slug: 'Homepage',
      tabs: [
        {
          name: 'Spongebob',
          label: 'Spongebob',
          path: '/spongebob',
          src: 'https://www.youtube.com/embed/hzond0fF4MM',
          iframeProps: {
            height: 1080,
            width: 1920,
            frameBorder: '0',
            style: { aspectRatio: '19/10', maxWidth: '100%', height: 'auto' },
          },
        },
      ],
    },
  ],
}),

Base config

This config is required for all tabs.

  • name | required | A machine name used for the tab, it must be unique and preferably written in PascalCase

  • label | required

  • path | required | A unique path that dictates what URL this tab will be available in

Src

In src mode, you only need to provide the right link for the iframe to render its content. You can then pass an additional iframeProps to style and configure your iframe element.

  • src | required | Full URL to embeddable content

  • iframeProps | optional | HTML props for the Iframe element

globals: [
  {
    slug: 'Homepage',
    tabs: [
      {
        name: 'Spongebob',
        label: 'Spongebob',
        path: '/spongebob',
        src: 'https://www.youtube.com/embed/hzond0fF4MM',
        iframeProps: {
          height: 1080,
          width: 1920,
          frameBorder: '0',
          style: { aspectRatio: '19/10', maxWidth: '100%', height: 'auto' },
        },
      },
    ],
  },
],

Code

By providing code instead we will dangerously render any code you provide here.
Use with caution.

  • code | required | Full markup in string format to dangerously render
{
  name: 'FigmaDesign',
  label: 'Figma Design',
  path: '/design',
  code: `<iframe style="border: 1px solid rgba(0, 0, 0, 0.1); width: 100%; height: auto; aspect-ratio: 19/10;" width="800" height="450" src="https://www.figma.com/embed?embed_host=share&url=----------" allowfullscreen></iframe>`,
},

Dynamic

Dynamic mode is similar to src mode except that we can fetch your URL from a field value instead.

  • watchField | required | Field path to watch for updates

  • iframeProps | optional | HTML props for the Iframe element

{
  name: 'Dynamic',
  label: 'Dynamic',
  path: '/dynamic',
  watchField: 'source',
  iframeProps: {
    height: 1080,
    width: 1920,
    frameBorder: '0',
    style: { aspectRatio: '19/10', maxWidth: '100%', height: 'auto' },
  },
},

Contributing

For development purposes, there is a full working example of how this plugin might be used in the dev directory of this repo.

git clone [email protected]:NouanceLabs/payload-iframe-tabs-plugin.git \
  cd payload-iframe-tabs-plugin && yarn \
  cd dev && yarn \
  cp .env.example .env \
  vim .env \ # add your payload details
  yarn dev

Similar plugins