Giter Site home page Giter Site logo

anubhavjain786 / grapesjs-table Goto Github PK

View Code? Open in Web Editor NEW
18.0 3.0 7.0 1.83 MB

Table Plugin for grapesjs.

Home Page: https://github.com/Anubhavjain786/grapesjs-table

License: MIT License

JavaScript 92.93% HTML 7.07%
demo grapesjs grapesjs-editor grapesjs-table table-component plugins grapesjs-plugin table

grapesjs-table's Introduction

grapesjs-table

NPM version NPM downloads Travis build Chat Discord GitHub issues dependencies status devDependencies status

DEMO

Requirements

- GrapesJS v0.13.8 or higher

HTML

<link
  href="https://unpkg.com/grapesjs/dist/css/grapes.min.css"
  rel="stylesheet"
/>
<script src="https://unpkg.com/grapesjs"></script>
<script src="https://unpkg.com/grapesjs-table"></script>

<div id="gjs"></div>

JS

const editor = grapesjs.init({
  container: "#gjs",
  height: "100%",
  fromElement: true,
  storageManager: false,
  plugins: ["grapesjs-table"],
});

CSS

body,
html {
  margin: 0;
  height: 100%;
}

Summary

  • Plugin name: grapesjs-table
  • Components
    • table - Main table component
    • tablebody - Component which contains table body
    • tableFooter - Component which contains table footer
    • tableHead - Component which contains table header
  • Blocks
    • table

Options

Option Description Default
tableBlock Object to extend the default table block, eg. { label: 'table', attributes: { ... } }
tableProps Object to extend the default table properties, eg. { name: 'My table', droppable: false, ... } {}
bodyProps Object to extend the default table body properties {}
headProps Object to extend the default table head properties {}
footerProps Object to extend the default table footer properties {}
attrTable Table attribute identifier (main component) data-table
attrTableBody Table body attribute identifier data-tbody
attrTableFooter Table footer attribute identifier data-tfoot
attrTableHeader Table Head attribute identifier data-thead
classTable Default class to use on table table
classTableBody Default class to use on table body table-body
classTableFooter Default class to use on table body footer table-footer
classTableHeader Default class to use on table body header table-header
style Default style for table table { .... (check the source)

Download

  • CDN
    • https://unpkg.com/grapesjs-table
  • NPM
    • npm i grapesjs-table
  • GIT
    • git clone https://github.com/anubhavjain786/grapesjs-table.git

Usage

Directly in the browser

<link
  href="https://unpkg.com/grapesjs/dist/css/grapes.min.css"
  rel="stylesheet"
/>
<script src="https://unpkg.com/grapesjs"></script>
<script src="path/to/grapesjs-table.min.js"></script>

<div id="gjs"></div>

<script type="text/javascript">
  var editor = grapesjs.init({
    container: "#gjs",
    // ...
    plugins: ["grapesjs-table"],
    pluginsOpts: {
      "grapesjs-table": {
        /* options */
      },
    },
  });
</script>

Modern javascript

import grapesjs from 'grapesjs';
import plugin from 'grapesjs-table';
import 'grapesjs/dist/css/grapes.min.css';

const editor = grapesjs.init({
  container : '#gjs',
  // ...
  plugins: [plugin],
  pluginsOpts: {
    [plugin]: { /* options */ }
  }
  // or
  plugins: [
    editor => plugin(editor, { /* options */ }),
  ],
});

Development

Clone the repository

$ git clone https://github.com/anubhavjain786/grapesjs-table.git
$ cd grapesjs-table

Install dependencies

$ npm i

Start the dev server

$ npm start

Build the source

$ npm run build

License

MIT

grapesjs-table's People

Contributors

aimeos avatar anubhavjain786 avatar dependabot[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

grapesjs-table's Issues

Crash Complete Application

i tried to use this plugin in my grapesjs project but it din't work i also tried with CDN or with npm both giving same problem. the applicaiton show's nothing just a white page.

also i tried to git clone the repo and run it mannualy this gives so many error the main error i encouter is he table.js file inside the src/components you are importing ./Table.js while the name of file is ./table.js

Cannot set property defaults of [object Object] which has only a getter

I have this error below when trying to use it, on the this.editor = grapesjs.init({:

image

TypeError: Cannot set property defaults of [object Object] which has only a getter
at grapes.mjs:22084:47
at Module.create (grapes.mjs:22143:14)
at Function.extend (grapes.mjs:2910:25)
at h (grapesjs-table.min.js:2:8698)
at w (grapesjs-table.min.js:2:10150)
at t.default (grapesjs-table.min.js:2:12425)
at grapes.mjs:61282:17
at Array.forEach ()
at Object.init (grapes.mjs:61278:28)

Unable to edit table content

Thanks for your work. I was looking for a way to create table component in GrapesJS for days. Found your plug-in. I'm using this in a React application. I'm able to insert the table into the canvas, but I'm unable to edit the content. Only a blank table is appearing with the specified number of rows and columns. Please provide a solution. Am I missing something here?

tablejs.txt

Plugin [object Module] not found

Hey there,

When I follow the steps in the readme, I get this error : Plugin [object Module] not found .
Do you know what may be causing this?

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.