Table Block for the Editor.js.
Get the package
npm i --save-dev editorjs-tableor
yarn add editorjs-table --devInclude module in your application
constTable=require('editorjs-table');- Download folder
distfrom repository - Add
dist/bundle.jsfile to your page.
Add a new Tool to the tools property of the Editor.js initial config.
vareditor=EditorJS({
...
tools: {
...
table: {class: Table,}}
...
});Or init Table Tool with additional settings
vareditor=EditorJS({
...
tools: {
...
table: {class: Table,inlineToolbar: true,config: {rows: 2,cols: 3,},},},
...
});| Field | Type | Description |
|---|---|---|
| rows | number | initial number of rows. by default 2 |
| cols | number | initial number of columns. by default 2 |
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$"] ]
}
}