@derikomara/moon-editor
v1.2.2
Published
π Moon Editor - A beautiful and powerful Rich Text Editor for React with Microsoft Office Power Paste support (with full image support)
Maintainers
Readme
π Moon Editor
Where content creation meets elegance
A beautiful and powerful WYSIWYG editor for React with Microsoft Office Power Paste support.
Demo Β· Documentation Β· Report Bug Β· Request Feature
β¨ Highlights
π Beautiful Design - Clean, modern interface that feels natural
π Power Paste - Copy from Word/Excel with full styling preservation
π¨ Rich Formatting - Everything you need for beautiful content
πͺΆ Lightweight - Only ~10KB gzipped
π Secure - Built-in XSS protection
β‘ Fast - Optimized for performance
π― TypeScript - Full type definitions included
π Zero Dependencies - Only requires React
π¦ Quick Install
npm install @deri/moon-editorπ Quick Start
import { MoonEditor } from '@deri/moon-editor';
import '@deri/moon-editor/dist/style.css';
function App() {
const [content, setContent] = useState('');
return (
<MoonEditor
initialContent={content}
onChange={setContent}
placeholder="Start creating beautiful content..."
/>
);
}That's it! You now have a fully-featured rich text editor. π
π« Features
Text Formatting
- Styles: Bold, Italic, Underline, Strikethrough
- Fonts: 8 beautiful font families
- Sizes: 7 font sizes
- Colors: Text and background color pickers with presets
- Alignment: Left, Center, Right, Justify
Content Structure
- Headings: H1 through H6
- Lists: Ordered and unordered with nesting
- Indentation: Precise control
- Links: Easy hyperlink management
Media
- Images: Drag & drop or upload
- Videos: Embed videos easily
- Auto-resize: Responsive media handling
Advanced Features
- π Power Paste: Copy from Microsoft Office with style preservation
- β¨οΈ Shortcuts: Familiar keyboard shortcuts (Ctrl+B, I, U)
- β©οΈ History: Full undo/redo support
- π§Ή Clean: Remove formatting with one click
- ποΈ Source: View and edit HTML directly
π Power Paste Feature
The standout feature of Moon Editor is Power Paste - the ability to copy content from Microsoft Office applications and paste it with full styling preservation.
What Gets Preserved?
β
Text colors
β
Background colors
β
Font families
β
Font sizes
β
Bold, italic, underline
β
Headings (H1-H6)
β
Lists (ordered & unordered)
β
Tables
β
Links
What Gets Cleaned?
β MSO-specific properties
β Excessive spacing
β Office namespace tags
β Scripts & dangerous HTML
How to Use
- Format your content in Microsoft Word
- Copy (Ctrl+C)
- Paste in Moon Editor (Ctrl+V)
- β¨ Magic! All styling preserved!
π Props API
| Prop | Type | Default | Description |
|------|------|---------|-------------|
| initialContent | string | "" | Initial HTML content |
| onChange | (content: string) => void | - | Called when content changes |
| placeholder | string | "Start typing here..." | Placeholder text |
| className | string | "" | Additional CSS class |
| minHeight | string | "500px" | Minimum editor height |
| showToolbar | boolean | true | Show/hide toolbar |
| toolbarConfig | ToolbarConfig | {} | Customize toolbar |
π¨ Customization
Custom Toolbar
<MoonEditor
toolbarConfig={{
showFontFamily: true,
showColors: true,
showMedia: false, // Hide media upload
showSourceView: false, // Hide HTML source
}}
/>Custom Styling
.moon-editor-container {
border: 2px solid #6366f1;
border-radius: 16px;
box-shadow: 0 0 30px rgba(99, 102, 241, 0.15);
}π Examples
Blog Editor
<MoonEditor
initialContent={post.content}
onChange={(content) => savePost({ ...post, content })}
minHeight="600px"
/>Comment System
<MoonEditor
placeholder="Write your comment..."
minHeight="150px"
toolbarConfig={{
showFontFamily: false,
showMedia: false,
}}
/>Email Composer
<MoonEditor
initialContent={draft}
onChange={setDraft}
placeholder="Compose your email..."
/>π§ Development
# Clone repository
git clone https://github.com/deri/moon-editor.git
# Install dependencies
npm install
# Start dev server
npm run dev
# Build library
npm run build:libπ Documentation
π Browser Support
- Chrome/Edge (latest)
- Firefox (latest)
- Safari (latest)
- Mobile browsers
π€ Contributing
Contributions are welcome! Please read our Contributing Guide.
π License
MIT Β© Deri
π Acknowledgments
Built with:
π§ Contact
Deri - GitHub
Project Link: https://github.com/deri/moon-editor
π Made with love by Deri
If you find Moon Editor helpful, please consider giving it a β on GitHub!
