Coder Social home page Coder Social logo

topo-io / tiptap-extensions Goto Github PK

View Code? Open in Web Editor NEW
62.0 0.0 11.0 2.94 MB

Column extension for tiptap v2

Home Page: https://codesandbox.io/p/github/GoCapsule/tiptap-extensions/main

TypeScript 92.51% CSS 2.66% JavaScript 4.83%
columns extension plugin rich-text-editor tiptap

tiptap-extensions's Introduction

Extensions for Tiptap

Column extension

Features

The extension introduce 2 new commands:

  • setColumns(n) to add n new columns on an existing node
  • unsetColumns() to remove columns

Here is a quick preview of the features: Column extension for Tiptap - Watch Video

You can try it here: https://codesandbox.io/p/github/GoCapsule/tiptap-extensions/main

Install

Install the package

npm install @gocapsule/column-extension

Add the extension to your editor

import { Node, Editor } from "@tiptap/core";
import StarterKit from '@tiptap/starter-kit';
import { ColumnExtension } from "@gocapsule/column-extension";
// don't forget to add style to see the columns
import "@gocapsule/column-extension/src/index.css";

new Editor({
  element: document.querySelector('.element'),
  extensions: [
    // override Document to allow columns
    StarterKit.configure({ document: false }),
    ColumnExtension,
  ],
  content: '<p>Hello World!</p>',
});

You then need this following stylesheet @gocapsule/column-extension/src/index.css OR add the CSS of the next section.

Customization

You can customize the style of the columns with css.

The DOM created by the extension looks like this:

DOM

The CSS is this one:

.ProseMirror .column-block {
  width: 100%;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 24px;
  padding: 8px 0;
}

.ProseMirror .column {
  overflow: auto;
  border: 1px gray dashed;
  border-radius: 8px;
  padding: 8px;
  margin: -8px;
}

Contributing

You can start an example of the editor and the extension(s) with the command:

yarn start

Don't hesitate to open a pull request if you want new features.

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.