GithubHelp home page GithubHelp logo

yevs / slate-deep-table Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jasonphillips/slate-deep-table

0.0 1.0 0.0 852 KB

Plugin for the Slate editor, allowing for creation of tables with nested content

License: Apache License 2.0

HTML 0.46% CSS 1.16% JavaScript 98.38%

slate-deep-table's Introduction

slate-deep-table

npm version Linux Build Status

A Slate plugin to handle tables with nested block content. Forked from the excellent slate-edit-table implementation, but retooled to work with deep content.

Demo: https://jasonphillips.github.io/slate-deep-table/

Install

npm install slate-deep-table

Features

  • Pressing Up and Down, move the cursor to next/previous row
  • Pressing Tab, move the select to next cell
  • Pressing Shift+Tab, move the select to previous cell

Simple Usage

import EditTable from 'slate-deep-table'

const plugins = [
  EditTable({ /* options here */ })
]

// then use as plugins prop on your slate Editor

Options

  • [typeTable: String] — type for table
  • [typeRow: String] — type for the rows.
  • [typeCell: String] — type for the cells.
  • [typeContent: String] — type for the default blocks within cells.

Utilities and Change

slate-deep-table exports utilities and changes:

utils.isSelectionInTable

plugin.utils.isSelectionInTable(state: State) => Boolean

Return true if selection is inside a table.

changes.insertTable

plugin.changes.insertTable(change: Change, columns: Number?, rows: Number?) => Change

Insert a new empty table.

changes.insertRow

plugin.changes.insertRow(change: Change, at: Number?) => Change

Insert a new row after the current one or at the specific index (at).

changes.insertColumn

plugin.changes.insertColumn(change: Change, at: Number?) => Change

Insert a new column after the current one or at the specific index (at).

changes.removeTable

plugin.changes.removeTable(change: Change) => Change

Remove current table.

changes.removeRow

plugin.changes.removeRow(change: Change, at: Number?) => Change

Remove current row or the one at a specific index (at).

changes.removeColumn

plugin.changes.removeColumn(change: Change, at: Number?) => Change

Remove current column or the one at a specific index (at).

changes.moveSelection

plugin.changes.moveSelection(change: Change, column: Number, row: Number) => Change

Move the selection to a specific position in the table.

changes.moveSelectionBy

plugin.changes.moveSelectionBy(change: Change, column: Number, row: Number) => Change

Move the selection by the given amount of columns and rows.

changes.toggleHeaders

plugin.changes.toggleHeaders(change: Change) => Change

Toggles whether the table will render the first row as a header row (within a thead) or as a regular row.

slate-deep-table's People

Contributors

aunswjx avatar ingro avatar jasonphillips avatar mklabs avatar samypesse avatar soreine avatar yevs avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.