npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

netlify-cms-widget-external-image

v0.1.0

Published

Image widget for Netlify CMS: upload image to an external server and store just an identifier

Downloads

7

Readme

netlify-cms-widget-external-image

Image widget for Netlify CMS: upload image to an external server and store just an identifier

Usage

npm install --save-dev react@17 react-dom@17 netlify-cms-app netlify-cms-widget-external-image

import CMS from "netlify-cms-app";
import ExternalImage from "netlify-cms-widget-external-image";

CMS.registerWidget(
  "external-image",
  ExternalImage(
    async (f) => {
      // upload ...
      return "some-asset-id";
    },
    (assetId) => `https://myassetserver.com/asset/${assetId}`
  )
);
CMS.init();

It is also possible to use Netlify CMS including this widget without any bundling, using scripts from a CDN. Insert the following before the </body> tag.

<script src="https://cdn.jsdelivr.net/npm/react@17/umd/react.production.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/react-dom@17/umd/react-dom.production.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/ExternalImage.umd.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/netlify-cms-app@2/dist/netlify-cms-app.min.js"></script>
<script>
  NetlifyCmsApp.registerWidget(
    "external-image",
    NetlifyCMSWidgetExternalImage(
      async (f) => {
        // upload ...
        return "some-asset-id";
      },
      (assetId) => `https://myassetserver.com/asset/${assetId}`
    )
  );
  NetlifyCmsApp.init();
</script>

API

export type WidgetInstanceMeta

export declare type WidgetInstanceMeta = {
  field: ReadonlyMap<string, any>;
  entry: ReadonlyMap<string, any>;
};

Object containing available metadata. field contains config for the given field from CMS config.yml, entry contains data about the current item that is being edited (namely values of other fields, slug, raw...)

(export default) function createExternalImageWidget(...)

declare function createExternalImageWidget(
  uploadCallback: (file: File, meta: WidgetInstanceMeta) => Promise<string>,
  getPreviewUrl: (storedValue: string, meta: WidgetInstanceMeta) => string
): React.ComponentClass<CmsWidgetControlProps>;
export default createExternalImageWidget;

Factory function for a component class that you can provide to CMS.registerWidget.

uploadCallback is called when user chooses to upload a new image (including replacing the previous one). You should store the image (File is a subclass of Blob) and return a string that identifies the file (that will be stored in the content)

getPreviewUrl takes the value as returned by the callback and must return a URL (as a string) of a suitable preview

Both functions can make use of the available metadata (see above).