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

editorjs-alert

v1.1.4

Published

Editor.js tool for adding colorful alerts

Downloads

29,905

Readme

Editor.js Alert Tool

npm Version of EditorJS that the plugin is compatible with

Provides Alert blocks for the Editor.js.

Features

  • 8 different alert block styes
  • Convert from other blocks into an Alert block
  • Convert an Alert block into other blocks

How does it look like?

Watch this tool in action in the following short GIF movie.

Try it out yourself on the demo page.

Installation

Install via NPM

Get the package

npm i --save editorjs-alert

Include module at your application

const Header = require('editorjs-alert');

// OR

import Alert from 'editorjs-alert';

Download to your project's source dir

Copy dist/bundle.js file to your page.

Load from CDN

You can load specific version of package from jsDelivr CDN.

<script src="https://cdn.jsdelivr.net/npm/editorjs-alert@latest"></script>

Usage

Add a new Tool Alert to the tools property of the Editor.js initial config.

var editor = EditorJS({
  // ...

  tools: {
    // ...
    alert: Alert,
  },

  // ...
});

Or initialize Alert tool with additional optional settings

var editor = EditorJS({
  //...

  tools: {
    //...
    alert: {
      class: Alert,
      inlineToolbar: true,
      shortcut: 'CMD+SHIFT+A',
      config: {
        alertTypes: ['primary', 'secondary', 'info', 'success', 'warning', 'danger', 'light', 'dark'],
        defaultType: 'primary',
        messagePlaceholder: 'Enter something',
      },
    },
  },

  //...
});

Config Params

All properties are optional.

| Field | Type | Default Value | Description | | -------------------- | -------- | -------------- | -------------------------------------------------------------------------------------------------------------------------- | | alertTypes | array | ['primary', 'secondary', 'info', 'success', 'warning', 'danger', 'light', 'dark'] | Alert types that can be used in the editor | | defaultType | string | info | default Alert type (should be either of primary, secondary, info, success, warning, danger, light or dark) | | defaultAlign | string | left | default Alert alignment (should be either of left, center or right) | | messagePlaceholder | string | Type here... | placeholder to show in Alert`s message

Output data

| Field | Type | Description | | ------- | -------- | --------------------------------------------------------------------------------------------------------- | | message | string | Alert message | | type | string | Alert type among one of primary, secondary, info, success, warning, danger, light or dark | | align | string | Align type should be one of left, center or right |

{
  "type": "alert",
  "data": {
    "type": "danger",
    "align" : "center",
    "text": "<strong>Holy smokes!</strong><br>Something seriously <em>bad</em> happened."
  }
}

Local Development

  • Run yarn install.
  • Run yarn dev to continuously watch for the changes made in ./src/index.js and updates a development bundle under ./dist folder.
  • Open ./examples/development.html in the browser to verify the tool's functionality.

Publishing to NPM

  • Run yarn build to build the production bundle, bump the version in package.json.
  • Commit and push the changes.
  • Create a release new tag for the bumped version (e.g. git tag v1.0.2).
  • Push the tag using git push --tags.
  • Publish the package to NPM using yarn publish.

License

This project is licensed under the MIT License.