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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@dojo-ng/rich-text-embed

v0.1.0

Published

Media embed plugin for @dojo-ng/rich-text

Readme

@dojo-ng/rich-text-embed

Media embed plugin for @dojo-ng/rich-text

Part of Dojo NG, a framework-agnostic web component library. BSD-3-Clause.

An opt-in plugin for @dojo-ng/rich-text (not a custom element). It contributes an EmbedNode and an INSERT_EMBED_COMMAND, and adds a toolbar button that opens a dj-dialog for pasting a media URL. The URL is run through matchers, tried in order: YouTube (watch/youtu.be/shorts/embed URLs) and Vimeo render as privacy-enhanced iframes (youtube-nocookie.com, player.vimeo.com); a direct video file (.mp4/.webm/.m3u8/.mov) renders via dj-video and a direct audio file (.mp3/.m4a/.ogg/.wav/.flac) via dj-audio. An unsupported link shows an inline error and keeps the dialog open. Exports embedPlugin, createEmbedPlugin({ matchers? }), EmbedNode, $createEmbedNode, $isEmbedNode, INSERT_EMBED_COMMAND, defaultMatchers, and the EmbedMatcher/EmbedPayload types. Setting plugins REPLACES the default set, so spread ...defaultPlugins. NO generic-iframe matcher ships (arbitrary iframes are a consumer decision — add your own matcher via matchers). APP PREREQUISITE: dj-video needs video.js's stylesheet + engine loaded at the document level. HTML/round-trip: an embed exports as <div data-dj-embed data-src [data-title]> wrapping a fallback <a href> (the canonical watch URL for youtube/vimeo), so a consuming site can render from the data attributes or fall back to the link; embeds survive the value round-trip via the node's own importDOM. PASTE: the sanitizer removes iframe and strips the embed div's attributes, so a pasted embed degrades to a plain link — embeds enter via the dialog, the command, or value. DEFERRED: oEmbed/metadata (titles, thumbnails), autoplay options, generic iframe matcher, resize/alignment UI.

Install

npm install @dojo-ng/rich-text-embed

Usage

Compose the embed plugin with the default set. Load video.js at the document level for dj-video. Click the embed button and paste a YouTube/Vimeo URL or a direct media file URL.

<!-- App prerequisite for dj-video: load video.js's stylesheet once, in the page head. -->
<link rel="stylesheet" href="https://vjs.zencdn.net/8.10.0/video-js.css" />

<dj-rich-text id="editor" label="Article"></dj-rich-text>
<script type="module">
  import "@dojo-ng/rich-text";
  import { defaultPlugins } from "@dojo-ng/rich-text";
  import { embedPlugin } from "@dojo-ng/rich-text-embed";
  document.getElementById("editor").plugins = [...defaultPlugins, embedPlugin];
</script>

Examples

Add a custom matcher

Pass matchers to support more hosts. A matcher is { kind, match(url) } returning { kind, src, title? } or undefined; defaultMatchers are the built-ins.

import { createEmbedPlugin, defaultMatchers } from "@dojo-ng/rich-text-embed";

const loom = {
  kind: "loom",
  match: (url) => {
    const m = /loom\.com\/share\/(\w+)/.exec(url);
    return m ? { kind: "video", src: url } : undefined;
  },
};
const embed = createEmbedPlugin({ matchers: [loom, ...defaultMatchers] });