{"_id":"@dojo-ng/rich-text-embed","name":"@dojo-ng/rich-text-embed","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@dojo-ng/rich-text-embed","version":"0.1.0","license":"BSD-3-Clause","description":"Media embed plugin for @dojo-ng/rich-text","type":"module","main":"./dist/index.js","module":"./dist/index.js","types":"./dist/index.d.ts","scripts":{"build":"tsc -p tsconfig.json","clean":"rm -rf dist"},"dependencies":{"@dojo-ng/rich-text":"^0.1.0","@dojo-ng/dialog":"^0.1.0","@dojo-ng/text-input":"^0.1.0","@dojo-ng/button":"^0.1.0","@dojo-ng/video":"^0.1.0","@dojo-ng/audio":"^0.1.0","@dojo-ng/i18n":"^0.1.0","lexical":"^0.21.0","@lexical/utils":"^0.21.0","lit":"^3.3.0"},"_id":"@dojo-ng/rich-text-embed@0.1.0","_nodeVersion":"22.23.1","_npmVersion":"10.9.8","dist":{"integrity":"sha512-jAnVCPMcjhqUA0/+HQ52PxQfvdn3IJwtzHO757LWaM/7+2E5BurCA+enrToS9J20nPyjlKaOyiwPP4lJA4VZCg==","shasum":"96dcbaa993208061942ebf27acb749c7fd486ae6","tarball":"https://registry.npmjs.org/@dojo-ng/rich-text-embed/-/rich-text-embed-0.1.0.tgz","fileCount":10,"unpackedSize":26646,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIGtTLQwhjUrkDevPw2fm+EpyvSdujoFN6HpE/8U8YzWCAiAOikzmUiSNA+YvKcTSpywNkgMAtSJhRL/ZQ/OFkj+H+A=="}]},"_npmUser":{"name":"bitranch","email":"bill@bitranch.com"},"directories":{},"maintainers":[{"name":"saysomething","email":"joshs@holmescorp.com"},{"name":"bitranch","email":"bill@bitranch.com"},{"name":"jepe","email":"jeffreyp@holmescorp.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/rich-text-embed_0.1.0_1788374434718_0.8298366755996311"},"_hasShrinkwrap":false}},"time":{"created":"2026-09-02T18:40:34.455Z","0.1.0":"2026-09-02T18:40:34.882Z","modified":"2026-09-02T18:40:35.188Z"},"maintainers":[{"name":"saysomething","email":"joshs@holmescorp.com"},{"name":"bitranch","email":"bill@bitranch.com"},{"name":"jepe","email":"jeffreyp@holmescorp.com"}],"description":"Media embed plugin for @dojo-ng/rich-text","license":"BSD-3-Clause","readme":"# @dojo-ng/rich-text-embed\n\nMedia embed plugin for @dojo-ng/rich-text\n\nPart of [Dojo NG](../../README.md), a framework-agnostic web component library. BSD-3-Clause.\n\n> 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.\n\n## Install\n\n```bash\nnpm install @dojo-ng/rich-text-embed\n```\n\n## Usage\n\nCompose 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.\n\n```html\n<!-- App prerequisite for dj-video: load video.js's stylesheet once, in the page head. -->\n<link rel=\"stylesheet\" href=\"https://vjs.zencdn.net/8.10.0/video-js.css\" />\n\n<dj-rich-text id=\"editor\" label=\"Article\"></dj-rich-text>\n<script type=\"module\">\n  import \"@dojo-ng/rich-text\";\n  import { defaultPlugins } from \"@dojo-ng/rich-text\";\n  import { embedPlugin } from \"@dojo-ng/rich-text-embed\";\n  document.getElementById(\"editor\").plugins = [...defaultPlugins, embedPlugin];\n</script>\n```\n\n## Examples\n\n### Add a custom matcher\n\nPass `matchers` to support more hosts. A matcher is `{ kind, match(url) }` returning `{ kind, src, title? }` or undefined; `defaultMatchers` are the built-ins.\n\n```html\nimport { createEmbedPlugin, defaultMatchers } from \"@dojo-ng/rich-text-embed\";\n\nconst loom = {\n  kind: \"loom\",\n  match: (url) => {\n    const m = /loom\\.com\\/share\\/(\\w+)/.exec(url);\n    return m ? { kind: \"video\", src: url } : undefined;\n  },\n};\nconst embed = createEmbedPlugin({ matchers: [loom, ...defaultMatchers] });\n```\n","readmeFilename":"README.md","_rev":"1-f2588a7ac941def7be748a61ed5eaa75"}