Giter Site home page Giter Site logo

madetech / slate-edit-table Goto Github PK

View Code? Open in Web Editor NEW

This project forked from gitbookio/slate-edit-table

0.0 2.0 0.0 1.69 MB

Slate plugin for table edition

Home Page: https://gitbookio.github.io/slate-edit-table/

License: Apache License 2.0

HTML 0.78% CSS 1.28% JavaScript 97.94%

slate-edit-table's Introduction

slate-edit-table

NPM version Linux Build Status

A Slate plugin to handle table edition.

Install

npm install slate-edit-table

Features

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

Simple Usage

import EditTable from 'slate-edit-table'

const plugins = [
  EditTable()
]

Arguments

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

Utilities and Transform

slate-edit-table exports utilities and transforms:

utils.isSelectionInTable

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

Return true if selection is inside a table.

transforms.insertTable

plugin.transforms.insertTable(transform: Transform, columns: Number?, rows: Number?) => Transform

Insert a new empty table.

transforms.insertRow

plugin.transforms.insertRow(transform: Transform, at: Number?) => Transform

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

transforms.insertColumn

plugin.transforms.insertColumn(transform: Transform, at: Number?) => Transform

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

transforms.removeTable

plugin.transforms.removeTable(transform: Transform) => Transform

Remove current table.

transforms.removeRow

plugin.transforms.removeRow(transform: Transform, at: Number?) => Transform

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

transforms.removeColumn

plugin.transforms.removeColumn(transform: Transform, at: Number?) => Transform

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

transforms.moveSelection

plugin.transforms.moveSelection(transform: Transform, column: Number, row: Number) => Transform

Move the selection to a specific position in the table.

transforms.moveSelectionBy

plugin.transforms.moveSelectionBy(transform: Transform, column: Number, row: Number) => Transform

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

transforms.setColumnAlign

plugin.transforms.setColumnAlign(transform: Transform, align: String, at: Number) => Transform

Sets column alignment for a given column (at), in the current table. align defaults to center, at is optional and defaults to current cursor position.

slate-edit-table's People

Contributors

soreine avatar samypesse avatar mklabs avatar aunswjx avatar ingro avatar

Watchers

Chris Blackburn avatar  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.