npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

modern-rich-editor

v1.0.0

Published

A modern, feature-rich WYSIWYG text editor for web applications

Downloads

5

Readme

Rich Editor

A modern, feature-rich WYSIWYG text editor for web applications with enhanced UI and beautiful modal dialogs.

✨ Features

  • Rich Text Formatting: Bold, italic, underline, strikethrough
  • Font Controls: Font family and size selection
  • Color Controls: Text and background color pickers
  • Text Alignment: Left, center, right, and justify alignment
  • Lists: Bullet and numbered lists
  • Indentation: Increase and decrease text indentation
  • Media Insertion: Links, images, and tables with beautiful modal dialogs
  • Special Functions: Clear formatting, HTML view toggle
  • Undo/Redo: Full undo and redo functionality
  • Auto-save: Configurable auto-save with callbacks
  • Theme Support: Light and dark themes
  • Responsive Design: Works on all screen sizes
  • Keyboard Shortcuts: Common shortcuts like Ctrl+B, Ctrl+I, etc.

🚀 Quick Start

Installation

npm install modern-rich-editor
# or
yarn add modern-rich-editor

Basic Usage

import { RichEditor } from 'modern-rich-editor';

const editor = new RichEditor({
    container: '#editor',
    placeholder: 'Start typing...',
    theme: 'light',
    height: '400px'
});

HTML Usage

<!DOCTYPE html>
<html>
<head>
    <title>Rich Editor Demo</title>
</head>
<body>
    <div id="editor"></div>
    
    <script type="module">
        import { RichEditor } from './dist/index.esm.js';
        
        const editor = new RichEditor({
            container: '#editor',
            placeholder: 'Start typing your content...',
            theme: 'light',
            height: '300px',
            autoSave: true,
            onContentChange: (content) => {
                console.log('Content changed:', content);
            }
        });
    </script>
</body>
</html>

📖 API Reference

Options

| Option | Type | Default | Description | |--------|------|---------|-------------| | container | string \| HTMLElement | Required | CSS selector or DOM element | | placeholder | string | 'Start typing...' | Placeholder text | | theme | 'light' \| 'dark' | 'light' | Editor theme | | height | string | '400px' | Editor height | | width | string | '100%' | Editor width | | toolbar | boolean | true | Show toolbar | | statusBar | boolean | true | Show status bar | | autoSave | boolean | false | Enable auto-save | | autoSaveInterval | number | 5000 | Auto-save interval (ms) | | onContentChange | function | - | Content change callback | | onSave | function | - | Save callback |

Methods

| Method | Description | |--------|-------------| | getContent() | Get plain text content | | setContent(content) | Set plain text content | | getHTML() | Get HTML content | | setHTML(html) | Set HTML content | | focus() | Focus the editor | | blur() | Blur the editor | | enable() | Enable the editor | | disable() | Disable the editor | | isEnabled() | Check if editor is enabled | | undo() | Undo last action | | redo() | Redo last action | | clear() | Clear all content | | save() | Trigger save | | destroy() | Destroy the editor |

🎨 Enhanced Features

Beautiful Modal Dialogs

  • Link Insertion: Professional link insertion modal with URL and text fields
  • Image Insertion: Enhanced image modal with live preview and alt text
  • Table Creation: Custom table creation with row and column selection

Enhanced Toolbar Icons

  • Better Visual Symbols: Improved alignment icons (⫷ ⫸ ⫹ ⫺)
  • Indentation Controls: Dedicated buttons for increase/decrease indent (← →)
  • Professional Styling: Clean, modern interface with proper spacing

Live Image Preview

  • Real-time Preview: See images before inserting them
  • URL Validation: Only valid URLs show previews
  • Error Handling: Broken images show helpful error messages

🛠️ Development

Setup

# Install dependencies
npm install

# Build the package
npm run build

# Development mode with watch
npm run dev

Project Structure

rich-editor/
├── src/
│   ├── RichEditor.ts      # Main editor class
│   └── index.ts           # Entry point
├── dist/                  # Built files
├── demo.html              # Demo page
├── usage-example.html     # Usage example
├── test-image.svg         # Test image
├── package.json           # Package configuration
├── rollup.config.js       # Build configuration
├── tsconfig.json          # TypeScript configuration
└── README.md              # This file

🌐 Live Demo

Run the demo locally:

# Start the server
python3 -m http.server 3003

# Open in browser
open http://localhost:3003/demo.html

📦 Publishing

# Build the package
npm run build

# Publish to npm
npm publish

🤝 Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests if applicable
  5. Submit a pull request

📄 License

MIT License - see LICENSE file for details.

🆘 Support

If you encounter any issues or have questions, please open an issue on GitHub.


Rich Editor - A modern, feature-rich WYSIWYG text editor for web applications.