quill-better-table-picker
Version:
Better table module for Quill with support for grid-style table picker
85 lines (75 loc) • 1.86 kB
Markdown
An extension of the table module for Quill, with support for toolbar table picker. For this to work I had to extend snow theme.
[](https://github.com/quilljs/quill) 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.
```
npm install quill-better-table-picker
```
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/quill-better-table-picker@1.2.8/dist/quill-better-table-picker.css" rel="stylesheet">
```
ES6
```
import QuillBetterTable from "src/quill-better-table-picker.js";
Quill.register(
{
"modules/better-table": QuillBetterTable,
},
true
);
window.onload = () => {
const quill = new Quill("#editor-wrapper", {
theme: "better-table-snow",
modules: {
"better-table": true,
toolbar: [
["clean"],
[
{
list: "ordered",
},
{
list: "bullet",
},
],
[
{
indent: "-1",
},
{
indent: "+1",
},
],
[
"bold",
"italic",
"underline",
"strike",
{
script: "super",
},
{
script: "sub",
},
],
[
"link",
{
"better-table": [],
},
],
],
},
});
};
```
[](https://rmm5t.mit-license.org/)