All Projects → jaredreich → Pell

jaredreich / Pell

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

Programming Languages

javascript
184084 projects - #8 most used programming language
HTML
75241 projects
CSS
56736 projects

Projects that are alternatives of or similar to Pell

Awesome Wysiwyg
A curated list of awesome WYSIWYG editors.
Stars: ✭ 1,801 (-84.54%)
Mutual labels:  editor, rich-text-editor, contenteditable, wysiwyg, wysiwyg-editor
am-editor
A rich text collaborative editor framework that can use React and Vue custom plug-ins. 一个富文本实时协同编辑器框架,可以使用React和Vue自定义插件。
Stars: ✭ 542 (-95.35%)
Mutual labels:  contenteditable, wysiwyg, text-editor, rich-text-editor, wysiwyg-editor
ember-pell
Ember addon for simplest and smallest (1kB) WYSIWYG text editor for web, with no dependencies
Stars: ✭ 56 (-99.52%)
Mutual labels:  contenteditable, wysiwyg, text-editor, rich-text-editor, text-editing
Megadraft
Megadraft is a Rich Text editor built on top of Facebook's Draft.JS featuring a nice default base of components and extensibility
Stars: ✭ 982 (-91.57%)
Mutual labels:  editor, rich-text-editor, contenteditable, wysiwyg, wysiwyg-editor
Wysiwyg.js
wysiwyg contenteditable editor (minified+compression: 6kb)
Stars: ✭ 520 (-95.54%)
Mutual labels:  text-editor, rich-text-editor, contenteditable, wysiwyg, wysiwyg-editor
bangle.dev
Collection of higher level rich text editing tools. It powers the local only note taking app https://bangle.io
Stars: ✭ 541 (-95.36%)
Mutual labels:  wysiwyg, text-editor, rich-text-editor, wysiwyg-editor
typester
✒️ A WYSIWYG that gives you predictable and clean HTML
Stars: ✭ 29 (-99.75%)
Mutual labels:  wysiwyg, text-editor, rich-text-editor, wysiwyg-editor
Text
📑 Collaborative document editing using Markdown
Stars: ✭ 282 (-97.58%)
Mutual labels:  editor, rich-text-editor, wysiwyg, wysiwyg-editor
Re Editor
一个开箱即用的React富文本编辑器 🚀re-editor
Stars: ✭ 367 (-96.85%)
Mutual labels:  editor, rich-text-editor, wysiwyg, wysiwyg-editor
Medium Editor
Medium.com WYSIWYG editor clone. Uses contenteditable API to implement a rich text solution.
Stars: ✭ 15,421 (+32.34%)
Mutual labels:  editor, rich-text-editor, contenteditable, wysiwyg
Awesome Web Editor
🔨 Open source WEB editor summary
Stars: ✭ 306 (-97.37%)
Mutual labels:  editor, rich-text-editor, wysiwyg, wysiwyg-editor
Awesome Medium Editor
Medium.com WYSIWYG editor clone, with RTL support.
Stars: ✭ 12 (-99.9%)
Mutual labels:  editor, rich-text-editor, contenteditable, wysiwyg
Angular Editor
A simple native WYSIWYG editor component for Angular 6 -10+
Stars: ✭ 428 (-96.33%)
Mutual labels:  editor, rich-text-editor, wysiwyg, wysiwyg-editor
Canner Slate Editor
📝Rich Text / WYSIWYG Editor built for Modularity and Extensibility.
Stars: ✭ 1,071 (-90.81%)
Mutual labels:  editor, rich-text-editor, wysiwyg, wysiwyg-editor
Angular Froala Wysiwyg
Angular 4, 5, 6, 7, 8 and 9 plugin for Froala WYSIWYG HTML Rich Text Editor.
Stars: ✭ 696 (-94.03%)
Mutual labels:  text-editor, rich-text-editor, wysiwyg, wysiwyg-editor
Jodit
Jodit - Best WYSIWYG Editor for You
Stars: ✭ 947 (-91.87%)
Mutual labels:  editor, rich-text-editor, wysiwyg, wysiwyg-editor
Flutter Quill
Rich text editor for Flutter
Stars: ✭ 177 (-98.48%)
Mutual labels:  editor, rich-text-editor, wysiwyg, wysiwyg-editor
Slate Plugins
🔌 Next-gen slate plugins
Stars: ✭ 399 (-96.58%)
Mutual labels:  rich-text-editor, contenteditable, wysiwyg, wysiwyg-editor
Ckeditor5
Powerful rich text editor framework with a modular architecture, modern integrations, and features like collaborative editing.
Stars: ✭ 5,406 (-53.61%)
Mutual labels:  rich-text-editor, contenteditable, wysiwyg, wysiwyg-editor
Sceditor
A lightweight HTML and BBCode WYSIWYG editor
Stars: ✭ 503 (-95.68%)
Mutual labels:  editor, contenteditable, wysiwyg, wysiwyg-editor

v2 working branch and v2 project board


Logo

npm cdnjs

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

Live demo: https://jaredreich.com/pell

Live demo

Comparisons

library size (min+gzip) size (min) jquery bootstrap react link
pell 1.38kB 3.54kB https://github.com/jaredreich/pell
squire 16kB 49kB https://github.com/neilj/Squire
medium-editor 27kB 105kB https://github.com/yabwe/medium-editor
quill 43kB 205kB https://github.com/quilljs/quill
trix 47kB 204kB https://github.com/basecamp/trix
ckeditor 163kB 551kB https://ckeditor.com
trumbowyg 8kB 23kB x https://github.com/Alex-D/Trumbowyg
summernote 26kB 93kB x x https://github.com/summernote/summernote
draft 46kB 147kB x https://github.com/facebook/draft-js
froala 52kB 186kB x https://github.com/froala/wysiwyg-editor
tinymce 157kB 491kB x https://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

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].