Convert Figma logo to code with AI

jaredreich logopell

📝 the simplest and smallest WYSIWYG text editor for web, with no dependencies

11,942
550
11,942
68

Top Related Projects

43,060

Quill is a modern WYSIWYG editor built for compatibility and extensibility

Powerful rich text editor framework with a modular architecture, modern integrations, and features like collaborative editing.

14,837

The world's #1 JavaScript library for rich text editing. Available for React, Vue and Angular

Medium.com WYSIWYG editor clone. Uses contenteditable API to implement a rich text solution.

Super simple WYSIWYG editor

The next generation Javascript WYSIWYG HTML Editor.

Quick Overview

Pell is a simple and lightweight WYSIWYG text editor library for the web, written in JavaScript. It provides a minimalist and customizable interface for adding rich text editing capabilities to web applications.

Pros

  • Lightweight: Pell is a small library, weighing in at around 3KB gzipped, making it suitable for use in performance-sensitive applications.
  • Customizable: The library provides a flexible API that allows developers to easily customize the editor's appearance and behavior to fit their specific needs.
  • Cross-browser Compatibility: Pell is designed to work across a wide range of modern web browsers, ensuring a consistent user experience.
  • No Dependencies: Pell does not require any external dependencies, making it easy to integrate into existing projects.

Cons

  • Limited Features: Compared to more feature-rich text editors, Pell may lack some advanced functionality, such as support for tables, images, or complex formatting options.
  • Lack of Documentation: The project's documentation could be more comprehensive, which may make it challenging for new users to get started.
  • Potential Performance Issues: While Pell is generally lightweight, large or complex content may still cause performance issues, especially on older or less powerful devices.
  • Lack of Active Maintenance: The project appears to have a relatively low level of active maintenance, with the last commit being over a year old at the time of writing.

Code Examples

Here are a few examples of how to use Pell in your web application:

  1. Basic Usage:
const editor = pell.init({
  element: document.getElementById('editor'),
  onChange: html => {
    console.log(html)
  }
})

This code initializes a new Pell editor instance, attaching it to the HTML element with the ID editor. The onChange callback function is called whenever the editor's content is modified, logging the current HTML content to the console.

  1. Customizing the Toolbar:
pell.init({
  element: document.getElementById('editor'),
  actions: [
    'bold',
    'italic',
    'underline',
    'strikethrough',
    'heading1',
    'heading2',
    'paragraph',
    'quote'
  ],
  defaultParagraphSeparator: 'p',
  styleWithCSS: false,
  onChange: html => {
    console.log(html)
  }
})

This example demonstrates how to customize the toolbar actions available in the Pell editor. The actions option allows you to specify which formatting options should be displayed to the user.

  1. Applying Custom Styles:
pell.init({
  element: document.getElementById('editor'),
  styles: {
    '.pell-content': {
      fontFamily: 'Arial, sans-serif',
      fontSize: '16px',
      color: '#333'
    }
  },
  onChange: html => {
    console.log(html)
  }
})

In this example, the styles option is used to apply custom CSS styles to the Pell editor's content. This allows you to control the font, size, and color of the text within the editor.

Getting Started

To get started with Pell, follow these steps:

  1. Include the Pell library in your HTML file:
<script src="https://unpkg.com/pell"></script>
  1. Create a container element for the editor:
<div id="editor"></div>
  1. Initialize the Pell editor in your JavaScript code:
const editor = pell.init({
  element: document.getElementById('editor'),
  onChange: html => {
    console.log(html)
  }
})
  1. (Optional) Customize the editor's appearance and behavior by passing additional options to the pell.init() function, as shown in the code examples above.

That's it! You now have a basic Pell editor integrated into your web application. From here, you can further customize the editor to fit your specific needs.

Competitor Comparisons

43,060

Quill is a modern WYSIWYG editor built for compatibility and extensibility

Pros of Quill

  • More feature-rich and customizable editor with extensive API
  • Better support for complex formatting and embedded content
  • Larger community and more frequent updates

Cons of Quill

  • Larger file size and potentially heavier performance impact
  • Steeper learning curve for implementation and customization
  • May be overkill for simple text editing needs

Code Comparison

Pell:

const editor = pell.init({
  element: document.getElementById('editor'),
  onChange: html => {
    console.log(html)
  }
})

Quill:

const quill = new Quill('#editor', {
  theme: 'snow',
  modules: {
    toolbar: [['bold', 'italic'], ['link', 'image']]
  }
})
quill.on('text-change', function() {
  console.log(quill.getContents())
})

Summary

Pell is a lightweight, simple WYSIWYG editor with a small footprint and easy setup. It's ideal for basic text editing needs and projects where minimalism is key. Quill, on the other hand, offers a more robust editing experience with extensive customization options and support for complex content. It's better suited for projects requiring advanced formatting and embedded content capabilities. The choice between the two depends on the specific requirements of your project, balancing simplicity against feature richness.

Powerful rich text editor framework with a modular architecture, modern integrations, and features like collaborative editing.

Pros of CKEditor 5

  • More feature-rich with advanced editing capabilities
  • Highly customizable with a modular architecture
  • Strong community support and regular updates

Cons of CKEditor 5

  • Larger file size and potentially heavier on resources
  • Steeper learning curve for implementation and customization
  • May be overkill for simple text editing needs

Code Comparison

Pell:

import pell from 'pell'

pell.init({
  element: document.getElementById('editor'),
  onChange: html => console.log(html)
})

CKEditor 5:

import ClassicEditor from '@ckeditor/ckeditor5-build-classic'

ClassicEditor
  .create(document.querySelector('#editor'))
  .then(editor => {
    console.log('Editor was initialized', editor)
  })
  .catch(error => {
    console.error(error)
  })

Summary

Pell is a lightweight, simple WYSIWYG editor with a small footprint and easy setup. It's ideal for basic text editing needs and projects where minimalism is key. CKEditor 5, on the other hand, offers a more comprehensive editing experience with advanced features and customization options. It's better suited for complex content creation tasks but requires more resources and setup time. The choice between the two depends on the specific requirements of your project and the level of editing functionality needed.

14,837

The world's #1 JavaScript library for rich text editing. Available for React, Vue and Angular

Pros of TinyMCE

  • More feature-rich with advanced formatting options and plugins
  • Highly customizable with extensive API and configuration options
  • Better support for complex content editing scenarios

Cons of TinyMCE

  • Larger file size and potentially slower load times
  • Steeper learning curve for implementation and customization
  • May be overkill for simple text editing needs

Code Comparison

Pell initialization:

const editor = pell.init({
  element: document.getElementById('editor'),
  onChange: html => {
    // Handle content changes
  }
});

TinyMCE initialization:

tinymce.init({
  selector: '#editor',
  plugins: 'link image table',
  toolbar: 'undo redo | formatselect | bold italic',
  setup: function(editor) {
    editor.on('change', function() {
      // Handle content changes
    });
  }
});

Pell offers a simpler setup with fewer options, while TinyMCE provides more extensive configuration for advanced use cases. Pell's lightweight nature makes it easier to integrate for basic editing needs, whereas TinyMCE's robust feature set caters to complex content management requirements.

Medium.com WYSIWYG editor clone. Uses contenteditable API to implement a rich text solution.

Pros of medium-editor

  • More feature-rich with extensive customization options
  • Larger community and ecosystem with numerous extensions
  • Better support for complex formatting and content types

Cons of medium-editor

  • Larger file size and potentially heavier performance impact
  • Steeper learning curve due to more complex API and configuration
  • May be overkill for simple text editing needs

Code comparison

medium-editor:

var editor = new MediumEditor('.editable', {
    toolbar: {
        buttons: ['bold', 'italic', 'underline', 'anchor', 'h2', 'h3', 'quote']
    },
    placeholder: {
        text: 'Type your text'
    }
});

pell:

const editor = pell.init({
    element: document.getElementById('editor'),
    onChange: html => {
        // do something with html content
    },
    actions: ['bold', 'italic', 'underline', 'heading1', 'heading2', 'quote']
});

medium-editor offers more built-in options and customization, while pell provides a simpler, more lightweight approach. medium-editor is better suited for complex editing needs, whereas pell is ideal for basic text editing with minimal setup.

Super simple WYSIWYG editor

Pros of Summernote

  • More feature-rich with advanced formatting options and plugins
  • Better support for image handling and manipulation
  • Extensive documentation and active community support

Cons of Summernote

  • Larger file size and heavier dependency on jQuery
  • More complex setup and configuration process
  • Potentially slower performance due to additional features

Code Comparison

Pell (simple initialization):

const editor = pell.init({
  element: document.getElementById('editor'),
  onChange: html => console.log(html)
})

Summernote (basic initialization):

$('#summernote').summernote({
  placeholder: 'Hello Bootstrap 4',
  tabsize: 2,
  height: 100
});

Both Pell and Summernote are WYSIWYG editors, but they cater to different needs. Pell focuses on simplicity and lightweight implementation, while Summernote offers a more comprehensive set of features at the cost of increased complexity and file size. Pell is ideal for projects requiring basic text editing functionality with minimal overhead, whereas Summernote is better suited for applications needing advanced formatting options and extensive customization capabilities.

The next generation Javascript WYSIWYG HTML Editor.

Pros of WYSIWYG Editor

  • More feature-rich with advanced editing capabilities
  • Extensive documentation and support
  • Cross-browser compatibility and mobile-friendly

Cons of WYSIWYG Editor

  • Larger file size and potentially slower load times
  • Steeper learning curve for implementation
  • Commercial license required for full features

Code Comparison

Pell initialization:

const editor = pell.init({
  element: document.getElementById('editor'),
  onChange: html => {
    // Handle content changes
  }
});

WYSIWYG Editor initialization:

new FroalaEditor('#editor', {
  events: {
    'contentChanged': function () {
      // Handle content changes
    }
  }
});

Key Differences

  • Pell is a lightweight, dependency-free editor focusing on simplicity
  • WYSIWYG Editor offers more advanced features but requires a commercial license
  • Pell has a smaller footprint, while WYSIWYG Editor provides more extensive customization options
  • WYSIWYG Editor has better cross-browser support and mobile compatibility

Use Cases

  • Pell: Ideal for simple editing needs in lightweight applications
  • WYSIWYG Editor: Suitable for complex content management systems and enterprise-level projects

Community and Support

  • Pell: Open-source with community support
  • WYSIWYG Editor: Commercial product with dedicated support and regular updates

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

v2 working branch and v2 project board


Logo

npm cdnjs

pell is the simplest and smallest WYSIWYG text editor for web, with no dependencies

Demo

Comparisons

librarysize (min+gzip)size (min)jquerybootstrapreactlink
pell1.38kB3.54kBhttps://github.com/jaredreich/pell
squire16kB49kBhttps://github.com/neilj/Squire
medium-editor27kB105kBhttps://github.com/yabwe/medium-editor
quill43kB205kBhttps://github.com/quilljs/quill
trix47kB204kBhttps://github.com/basecamp/trix
ckeditor163kB551kBhttps://ckeditor.com
trumbowyg8kB23kBxhttps://github.com/Alex-D/Trumbowyg
summernote26kB93kBxxhttps://github.com/summernote/summernote
draft46kB147kBxhttps://github.com/facebook/draft-js
froala52kB186kBxhttps://github.com/froala/wysiwyg-editor
tinymce157kB491kBxhttps://github.com/tinymce/tinymce

Features

  • Pure JavaScript, no dependencies, written in ES6
  • Easily customizable with the sass file (pell.scss) or overwrite the CSS

Included actions:

  • Bold
  • Italic
  • Underline
  • Strike-through
  • Heading 1
  • Heading 2
  • Paragraph
  • Quote
  • Ordered List
  • Unordered List
  • Code
  • Horizontal Rule
  • Link
  • Image

Other available actions (listed at https://developer.mozilla.org/en-US/docs/Web/API/Document/execCommand):

  • Justify Center
  • Justify Full
  • Justify Left
  • Justify Right
  • Subscript
  • Superscript
  • Font Name
  • Font Size
  • Indent
  • Outdent
  • Clear Formatting
  • Undo
  • Redo

Or create any custom action!

Browser Support

  • IE 9+ (theoretically, but good luck)
  • Chrome 5+
  • Firefox 4+
  • Safari 5+
  • Opera 11.6+

Installation

npm:

npm install --save pell

HTML:

<head>
  ...
  <link rel="stylesheet" type="text/css" href="https://unpkg.com/pell/dist/pell.min.css">
  <style>
    /* override styles here */
    .pell-content {
      background-color: pink;
    }
  </style>
</head>
<body>
  ...
  <!-- Bottom of body -->
  <script src="https://unpkg.com/pell"></script>
</body>

Usage

API

// ES6
import pell from 'pell'
// or
import { exec, init } from 'pell'
// Browser
pell
// or
window.pell
// Initialize pell on an HTMLElement
pell.init({
  // <HTMLElement>, required
  element: document.getElementById('some-id'),

  // <Function>, required
  // Use the output html, triggered by element's `oninput` event
  onChange: html => console.log(html),

  // <string>, optional, default = 'div'
  // Instructs the editor which element to inject via the return key
  defaultParagraphSeparator: 'div',

  // <boolean>, optional, default = false
  // Outputs <span style="font-weight: bold;"></span> instead of <b></b>
  styleWithCSS: false,

  // <Array[string | Object]>, string if overwriting, object if customizing/creating
  // action.name<string> (only required if overwriting)
  // action.icon<string> (optional if overwriting, required if custom action)
  // action.title<string> (optional)
  // action.result<Function> (required)
  // Specify the actions you specifically want (in order)
  actions: [
    'bold',
    {
      name: 'custom',
      icon: 'C',
      title: 'Custom Action',
      result: () => console.log('Do something!')
    },
    'underline'
  ],

  // classes<Array[string]> (optional)
  // Choose your custom class names
  classes: {
    actionbar: 'pell-actionbar',
    button: 'pell-button',
    content: 'pell-content',
    selected: 'pell-button-selected'
  }
})

// Execute a document command, see reference:
// https://developer.mozilla.org/en/docs/Web/API/Document/execCommand
// this is just `document.execCommand(command, false, value)`
pell.exec(command<string>, value<string>)

List of overwriteable action names

  • bold
  • italic
  • underline
  • strikethrough
  • heading1
  • heading2
  • paragraph
  • quote
  • olist
  • ulist
  • code
  • line
  • link
  • image

Examples

General

<div id="editor" class="pell"></div>
<div>
  HTML output:
  <div id="html-output" style="white-space:pre-wrap;"></div>
</div>
import { exec, init } from 'pell'

const editor = init({
  element: document.getElementById('editor'),
  onChange: html => {
    document.getElementById('html-output').textContent = html
  },
  defaultParagraphSeparator: 'p',
  styleWithCSS: true,
  actions: [
    'bold',
    'underline',
    {
      name: 'italic',
      result: () => exec('italic')
    },
    {
      name: 'backColor',
      icon: '<div style="background-color:pink;">A</div>',
      title: 'Highlight Color',
      result: () => exec('backColor', 'pink')
    },
    {
      name: 'image',
      result: () => {
        const url = window.prompt('Enter the image URL')
        if (url) exec('insertImage', url)
      }
    },
    {
      name: 'link',
      result: () => {
        const url = window.prompt('Enter the link URL')
        if (url) exec('createLink', url)
      }
    }
  ],
  classes: {
    actionbar: 'pell-actionbar-custom-name',
    button: 'pell-button-custom-name',
    content: 'pell-content-custom-name',
    selected: 'pell-button-selected-custom-name'
  }
})

// editor.content<HTMLElement>
// To change the editor's content:
editor.content.innerHTML = '<b><u><i>Initial content!</i></u></b>'

Example (Markdown)

<div id="editor" class="pell"></div>
<div>
  Markdown output:
  <div id="markdown-output" style="white-space:pre-wrap;"></div>
</div>
import { init } from 'pell'
import Turndown from 'turndown'

const { turndown } = new Turndown({ headingStyle: 'atx' })

init({
  element: document.getElementById('editor'),
  actions: ['bold', 'italic', 'heading1', 'heading2', 'olist', 'ulist'],
  onChange: html => {
    document.getElementById('markdown-output').innerHTML = turndown(html)
  }
})

Frameworks

Custom Styles

SCSS

$pell-content-height: 400px;
// See all overwriteable variables in src/pell.scss

// Then import pell.scss into styles:
@import '../../node_modules/pell/src/pell';

CSS

/* After pell styles are applied to DOM: */
.pell-content {
  height: 400px;
}

License

MIT

Credits

BrowserStack for cross browser testing:

BrowserStack logo

NPM DownloadsLast 30 Days