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 🙏

© 2024 – Pkg Stats / Ryan Hefner

froala-oembed

v1.2.1

Published

Plugin for embedding external content, accessible through oEmbed, into the Froala WYSIWYG Editor.

Downloads

11

Readme

froala-oembed npm license

A simple plugin for Froala WYSIWYG Editor that allows users to insert and customise a wide variety of external Web content.

Prerequisites

This plugin requires Froala Editor >= 2.0.0 - it was developed under 2.7.5.

Froala Editor 3 is also supported, but you must provide your own jQuery - Froala 3 does not depend on jQuery and this plugin does. We developed under jQuery 3.5.0.

Installing

Add froala-oembed to your package.json:

npm install --save froala-oembed
# or
yarn add froala-oembed

Then load the files froala-oembed.js and froala-oembed.css on your page:

<!-- anywhere on the page -->
<link rel="stylesheet" src="/node_modules/froala-oembed/froala-oembed.css" />

<!-- after loading froala core -->
<script src="/node_modules/froala-oembed/froala-oembed.js"></script>

In your Froala configuration, add the oembed plugin to the list of enabled plugins. Then you can add insertOembed to any of the toolbars, or oembed to the Quick Insert buttons, or both:

const froalaConfig = {
  pluginsEnabled: ['image', 'video', 'oembed', ...],
  toolbarButtons: ['insertOembed', '|', 'insertVideo', ...],
  quickInsertButtons: ['oembed', 'video', ...],
  ...
};

Configuration

froala-oembed supports a variety of configuration options, several of which work just like core plugins' options. Here are the recognised options:

oembedEditButtons

Type: [String] Default: ['oembedReplace', 'oembedRemove']

The buttons that appear in the edit-oEmbed popup when an existing oEmbed widget is selected. Adding different buttons to this list is unlikely to work well, but you may remove unwanted buttons without any trouble.

oembedEmbedFactory

Type: String -> Promise ($Element|String) Default: src => Promise.resolve($('<iframe>').attr({src}))

Perhaps the most important option, the embed factory is a function that froala-oembed will use to display oEmbedded content. The URL of the content will be passed in, and a promise for that content's embeddable form should be returned. Either a string of HTML or a jQuery element may be returned, whichever is easier for the factory to produce.

As you can see, the default implementation is simply to generate an <iframe> with no special behaviour. This works for some sites, but many sites refuse to be displayed in an <iframe> and so won't work. Therefore, we recommend you override the factory with one of your own that's a lot smarter - for example, here at Coassemble we use an embed factory that calls Iframely and fetches HTML from its API.

oembedInsertButtons

Type: [String] Default: ['oembedBack']

The buttons that appear in the insert-oEmbed popup when the oEmbed button is clicked in a toolbar. These buttons function like tabs, toggling between the different possible ways to insert an audio clip. Again, adding new buttons is unlikely to work well, but you may remove unwanted ones.

oembedMove

Type: Boolean Default: true

Allows changing the position of oEmbed widgets in the content by dragging them.

oembedSplitHTML

Type: Boolean Default: false

Allows a new oEmbed widget to split apart existing HTML when it is inserted. Not recommended.

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Authors

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT License - see the LICENSE.md file for details.