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

@coolbytes/editorjs-table

Package Overview
Dependencies
Maintainers
0
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@coolbytes/editorjs-table

Table block tool for Editor.js

latest
Source
npmnpm
Version
1.0.1
Version published
Maintainers
0
Created
Source

Table block tool for Editor.js

This is a clone of this Editor.js block tool. It fixes the default withHeadings issue.

Preview

table

Installation

Using npm

npm install @coolbytes/editorjs-table

Using yarn

yarn add @coolbytes/editorjs-table

Usage

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

const editor = new EditorJS({
  tools: {
    table: Table
  }
});

Or init the Table tool with additional settings

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

Config Params

FieldTypeDescription
rowsnumberinitial number of rows. 2 by default
colsnumberinitial number of columns. 2 by default
withHeadingsbooleantoggle table headings. false by default

Output data

This Tool returns data in the following format

FieldTypeDescription
withHeadingsbooleanUses the first line as headings
contentstring[][]two-dimensional array with table contents

 

Example:

{
  "time": 1721500689337,
  "blocks": [
    {
      "id": "XXVTfnMlcE",
      "type": "table",
      "data": {
        "withHeadings": true,
        "content": [
          [ "Kine", "Pigs", "Chicken" ],
          [ "1 pcs", "3 pcs", "12 pcs" ],
          [ "100$", "200$", "150$" ]
        ]
      }
    }
  ],
  "version": "2.30.2"
}

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