npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@sankartw/quill-better-table

v1.0.3

Published

Module for better table in Quill, more useful features are supported.

Downloads

8

Readme

quill-better-table

A module for better table in Quill, more useful features are supported. There is a list of features below. Thanks quilljs for its awesome extensibility. Hope that quill-better-table could help you.

Online Demo

quill-better-table Codepen Demo

Updated

Features

Clicking on tables in quill editor will initialize the tools for table, all features are based on it.

Requirements

quilljs v2.0.0-dev.3

Since I use webpack externals to bundle, you must expose Quill to window object, like load quill.js by script tag globally. Or you may need to fork this repo and build what you need.

Installation

npm install quill-better-table

Usage

Load quill and style dependencies

<script src="https://cdnjs.cloudflare.com/ajax/libs/quill/2.0.0-dev.3/quill.min.js" type="text/javascript"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/quill/2.0.0-dev.3/quill.snow.min.css" rel="stylesheet">
<link href="https://unpkg.com/[email protected]/dist/quill-better-table.css" rel="stylesheet">

ES6

import QuillBetterTable from 'quill-better-table'

Quill.register({
  'modules/better-table': QuillBetterTable
}, true)

window.onload = () => {
  const quill = new Quill('#editor-wrapper', {
    theme: 'snow',
    modules: {
      table: false,  // disable table module
      'better-table': {
        operationMenu: {
          items: {
            unmergeCells: {
              text: 'Another unmerge cells name'
            }
          }
        }
      },
      keyboard: {
        bindings: QuillBetterTable.keyboardBindings
      }
    }
  })

  document.body.querySelector('#insert-table')
    .onclick = () => {
      let tableModule = quill.getModule('better-table')
      tableModule.insertTable(3, 3)
    }
}

Module methods

first, you can get quill-better-table module by quill.getModule

let module = quill.getModule('better-table')

module.getTable(range = quill.getSelection())

get an array with TableContainer, TableRow, TableCell, offset through the given range.

module.getTable()  // current selection
module.getTable(range)
// [TableContainer, TableRow, TableCell, 0]

module.insertTable(rows: Number, columns: Number)

insert table at current position

module.insertTable(3, 3)

Module Options

quill-better-table only provide operation options now.

const quill = new Quill('#editor', {
  theme: 'snow',
  modules: {
    table: false,  // disable table module
    'better-table': {
      operationMenu: {
        items: {
          unmergeCells: {
            text: 'Another unmerge cells name'
          }
        },
        color: {
          colors: ['#fff', 'red', 'rgb(0, 0, 0)'],  // colors in operationMenu
          text: 'Background Colors'  // subtitle
        } 
      }
    },
    keyboard: {
      bindings: QuillBetterTable.keyboardBindings
    }
  }
})

operationMenu

OperationMenu configures the operation list in right-click menu.

operationMenu.items

operationMenu show all operations as default. false will remove the operation.

{
  operationKey: {
    text: 'foo'
  },

  operationKey: false
}

operationKey is the name of operation, there is a list below:

You may need to modify the menu text, operationKey.text will do that.

operationMenu.color

Background colors is optional, the default is hidden. If you need this feature, use this configure.

{
  colors: ['#fff', 'red', 'rgb(0, 0, 0)'],  // colors you need in operationMenu, ['white', 'red', 'yellow', 'blue'] as default
  text: 'Background Colors'  // subtitle, 'Background Colors' as default
} 

Community

Send me an email([email protected]) or Contribute on Issues, I glad to hear your suggestion.

License

MIT License