Overview
Pell is a tiny (1KB gzipped) WYSIWYG text editor that
offers a clean and simple API with no dependencies.
This page demonstrates various usage examples, including how to customize actions and configure the
editor's behavior.
Basic Usage
The simplest use of Pell, with the default action set.
function waitForEditorAndInit() {
const editor = document.getElementById('editor');
if (window.pell && editor) { // Check simplified
window.pell.init({
element: editor,
defaultParagraphSeparator: 'p',
styleWithCSS: true,
actions: [
'heading1',
'heading2',
'bold',
'italic',
'quote',
'code',
'link',
'ulist',
'olist',
'underline',
'strikethrough'
]
});
} else {
// Retry on the next frame
requestAnimationFrame(waitForEditorAndInit);
}
}
document.addEventListener('DOMContentLoaded', waitForEditorAndInit);
function waitForEditorAndInit() { const editor = document.getElementById('editor'); if
(window.pell && editor) { // Check simplified window.pell.init({ element: editor,
defaultParagraphSeparator: 'p', styleWithCSS: true, actions: [ 'heading1',
'heading2', 'bold', 'italic', 'quote', 'code',
'link', 'ulist', 'olist', 'underline', 'strikethrough' ]
}); } else { // Retry on the next frame requestAnimationFrame(waitForEditorAndInit); } }
document.addEventListener('DOMContentLoaded', waitForEditorAndInit);