1.0.0 • Published 6 years ago

@ikbenbas/editorjs-button v1.0.0

Weekly downloads
6
License
MIT
Repository
gitlab
Last release
6 years ago

Button

Button for the Editor.js.

Features

Allows to add a button link to a given url.

Installation

Install via NPM

Get the package

npm i @ikbenbas/editorjs-button

Include module at your application

const Button = require('@ikbenbas/editorjs-button');

Download to your project's source dir

  1. Download folder dist from repository
  2. Add dist/bundle.js file to your page.

Usage

Add the Button to the tools property of the Editor.js initial config.

This Button can have to following configuration:

FieldTypeDescription
labelstringDefault text label
targetstringDefault target: One of the following options: _self, _blank, _parent or _top
classesarrayExtra classes added to the button in the editor for a better wysiwyg result
var editor = EditorJS({
  ...

  tools: {
    ...
    button: {
      class: Button,
      config: {
        label: "Click",
        target: "_blank",
        classes: ["button", "is-primary"]
      }
    }
  }
  ...
});

Output data

This Tool returns data with following format:

FieldTypeDescription
urlstringLink url
labelstringText label on the button
targetstringOne of the following options: _self, _blank, _parent or _top
centeredbooleantrue or false; Button aligned centered or not
stretchedbooleantrue or false; Button full width or not
largebooleantrue or false; Button size large or not
{
    "type": "button",
    "data": {
        "url": "http://www.example.com",
        "label": "Click me!",
        "target": "_self",
        "centered": true,
        "stretched": false,
        "large": true
    }
}

Side note: I created this plugin as a small project while learning TypeScript. I'm still working on it, and still learning. So don't judge me too harshly ;)

1.0.0

6 years ago

0.1.11

6 years ago

0.1.10

6 years ago

0.1.9

6 years ago

0.1.8

6 years ago

0.1.7

6 years ago

0.1.6

6 years ago

0.1.5

6 years ago

0.1.4

6 years ago