Giter Club home page Giter Club logo

editorjs-alert's Introduction

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.

Alert sneak peek GIF!

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: {
        defaultType: 'primary',
        messagePlaceholder: 'Enter something',
      },
    },
  },

  //...
});

Config Params

All properties are optional.

Field Type Default Value Description
defaultType string info default Alert type (should be either of primary, secondary, info, success, warning, danger, light or dark)
messagePlaceholder string Type here... placeholder to show in Alert`s message input

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
{
  "type": "alert",
  "data": {
    "type": "danger",
    "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.

License

This project is licensed under the MIT License.

editorjs-alert's People

Contributors

vishaltelangre avatar dimitrov-adrian avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.