Skip to content
Table constructor for Editor.js πŸ‘»
Branch: master
Clone or download
gohabereg Feature/renaming (#32)
* Rename all occurences

* 1.2.0

* Last changes

* Update packages

* Rename repo

* Update .npmignore

* Update README.md
Latest commit a2647e6 Mar 2, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
dist Feature/renaming (#32) Mar 2, 2019
src Feature/renaming (#32) Mar 2, 2019
.eslintrc Table plugin Nov 18, 2018
.gitignore Table plugin Nov 18, 2018
.npmignore
README.md Feature/renaming (#32) Mar 2, 2019
package.json
postcss.config.js Table plugin Nov 18, 2018
test.html done Nov 27, 2018
webpack.config.js
yarn.lock Feature/renaming (#32) Mar 2, 2019

README.md

Table tool

Table Block for the Editor.js.

Installation

Install via NPM or Yarn

Get the package

npm i --save-dev @editorjs/table

or

yarn add @editorjs/table --dev

Include module in your application

const Table = require('@editorjs/table');

Upload to your project's source dir

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

Usage

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

var editor = EditorJS({
  ...
  
  tools: {
    ...
    table: {
      class: Table,
    }
  }
  
  ...
});

Or init Table Tool with additional settings

var editor = EditorJS({
  ...
  
  tools: {
    ...
    table: {
      class: Table,
      inlineToolbar: true,
      config: {
        rows: 2,
        cols: 3,
      },
    },
  },
  
  ...
});

Config Params

Field Type Description
rows number initial number of rows. by default 2
cols number initial number of columns. by default 2

Output data

This Tool returns data with following format

Field Type Description
content string[][] two-dimensional array with table contents
{
    "type" : "table",
    "data" : {
        "content" : [ ["Kine", "1 pcs", "100$"], ["Pigs", "3 pcs", "200$"], ["Chickens", "12 pcs", "150$"] ]
    }
}
You can’t perform that action at this time.