# @editorjs/warning

> Warning Tool for Editor.js

Latest version **1.4.1** (published 2024-11-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install @editorjs/warning
pnpm add @editorjs/warning
yarn add @editorjs/warning
bun add @editorjs/warning
```

## Health

**Score 35/100 (D)** — status: maintenance-mode.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.4.1 |
| Published | 2024-11-21 |
| First published | 2019-03-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 2 |
| Unpacked size | 16.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 41 |
| Author | CodeX Team |
| Maintainers | codex-team |
| Keywords | codex editor, warning, editorjs, editor.js, editor |

## Links

- npm: https://www.npmjs.com/package/@editorjs/warning
- Repository: https://github.com/editor-js/warning
- npm.io page: https://npm.io/package/@editorjs/warning

## Dependencies (2)

- [@codexteam/icons](https://npm.io/package/@codexteam/icons.md) ^0.3.2
- [@editorjs/editorjs](https://npm.io/package/@editorjs/editorjs.md) ^2.30.7

## Alternatives

- [ext-list](https://npm.io/package/ext-list.md) — 6.3M weekly downloads
- [@lexical/selection](https://npm.io/package/@lexical/selection.md) — 3.8M weekly downloads
- [@lexical/text](https://npm.io/package/@lexical/text.md) — 3.6M weekly downloads
- [@lexical/clipboard](https://npm.io/package/@lexical/clipboard.md) — 3.0M weekly downloads
- [@tiptap/extension-mention](https://npm.io/package/@tiptap/extension-mention.md) — 3.0M weekly downloads

## Recent versions

- 1.4.1 (latest) — 2024-11-21
- 1.4.0 — 2023-11-14
- 1.3.0 — 2022-11-29
- 1.2.0 — 2020-09-29
- 1.1.1 — 2019-06-12
- 1.1.0 — 2019-03-18

## README

![](https://badgen.net/badge/CodeX%20Editor/v2.0/blue)

# Warning Tool

Provides Warning Block for the [CodeX Editor](https://ifmo.su/editor). Block has title and message. It can be used, for example, for editorials notifications or appeals.

![](assets/2d7b7bc1-ac46-4020-89c9-390d1a7297e2.jpg)

## Installation

Get the package

```shell
yarn add @editorjs/warning
```

Include module at your application

```javascript
import Warning from '@editorjs/warning';
```

Optionally, you can load this tool from CDN [JsDelivr CDN](https://cdn.jsdelivr.net/npm/@editorjs/warning@latest)

## Usage

Add a new Tool to the `tools` property of the CodeX Editor initial config.

```javascript
var editor = CodexEditor({
  ...
  
  tools: {
    ...
    warning: Warning,
  },
  
  ...
});
```

Or init Warning Tool with additional settings

```javascript
var editor = CodexEditor({
  ...
  
  tools: {
    ...
    warning: {
      class: Warning,
      inlineToolbar: true,
      shortcut: 'CMD+SHIFT+W',
      config: {
        titlePlaceholder: 'Title',
        messagePlaceholder: 'Message',
      },
    },
  },
  
  ...
});
```

## Config Params

| Field              | Type     | Description                       |
| ------------------ | -------- | ----------------------------------|
| titlePlaceholder   | `string` | Warning Tool's title placeholder  |
| messagePlaceholder | `string` | Warning Tool's message placeholder|

## Output data

| Field     | Type     | Description      |
| --------- | -------- | -----------------|
| title     | `string` | warning's title  |
| message   | `string` | warning's message|

```json
{
    "type" : "warning",
    "data" : {
        "title" : "Note:",
        "message" : "Avoid using this method just for lulz. It can be very dangerous opposite your daily fun stuff."
    }
}
```

---
_Source: https://npm.io/package/@editorjs/warning · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
