New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@coolbytes/editorjs-alerts

Package Overview
Dependencies
Maintainers
0
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@coolbytes/editorjs-alerts

Alerts block tool for Editor.js

latest
Source
npmnpm
Version
1.0.4
Version published
Maintainers
0
Created
Source

Alerts block tool for Editor.js

This block tool provides alert banners for Editor.js. The tool also provides configuration to choose from different styles (see Styles) and to enable alignment options.

Preview

Block Tool

alerts

Block Settings

settings

Styles

Pastel (Default)

pastel

Solid

solid

Outlined

outlined

Installation

Using npm

npm install @coolbytes/editorjs-alerts

Using yarn

yarn add @coolbytes/editorjs-alerts

Usage

Include it in the tools property of Editor.js config:

const editor = new EditorJS({
  tools: {
    alert: Alert
  }
});

Config Params

FieldTypeOptionalDefaultDescription
alertTypesstring[]Yes['info', 'success', 'blocked', 'warning', 'danger']All supported alert types
defaultAlertTypestringYes'info'Preferred alert type
alertStylesstring[]Yes['pastel', 'solid', 'outlined']All supported alert styles
defaultAlertStylestringYes'pastel'Preferred alert style
alignTypesstring[]Yes['left', 'center', 'right', 'justify']All supported alignment options
defaultAlignTypestringYes'left'Preferred alignment type

 

const editor = EditorJS({
  tools: {
    alert: {
      class: Alert,
      config: {
        alertTypes: ['info', 'success', 'blocked', 'warning', 'danger'],
        defaultAlertType: 'info',
        alertStyles: ['pastel', 'solid', 'outlined'],
        defaultAlertStyle: 'pastel',
        alignTypes: ['left', 'center', 'right', 'justify'],
        defaultAlignType: 'left'
      }
    }
  }
});

Output data

FieldTypeDescription
textstringAlert's text
alertstringAlert type
alertStylestringAlert style
alignstringAlignment type

 

Example:

{
  "time": 1715969561758,
  "blocks": [
    {
      "id": "_K5QcJHHuK",
      "type": "alert",
      "data": {
        "text": "This is an info alert",
        "alert": "info",
        "alertStyle": "pastel",
        "align": "left"
      }
    }
  ],
  "version": "2.29.1"
}

Keywords

editor.js

FAQs

Package last updated on 22 Jul 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts