
Security News
Feross on TBPN: How North Korea Hijacked Axios
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.
@crashbytes/contentful-richtext-editor
Advanced tools
A Tiptap-based rich text editor compatible with Contentful's rich text format
A modern, Tiptap v3-based rich text editor that's fully compatible with Contentful's rich text format. Provides the same editing experience as Contentful's native editor while maintaining perfect compatibility with Contentful's document structure.
See our Security Policy for vulnerability reporting.
showBorder propnpm install @crashbytes/contentful-richtext-editor
Peer Dependencies:
import React, { useState } from 'react';
import { ContentfulRichTextEditor } from '@crashbytes/contentful-richtext-editor';
import '@crashbytes/contentful-richtext-editor/dist/index.css';
import { Document } from '@contentful/rich-text-types';
function App() {
const [content, setContent] = useState<Document>();
const handleChange = (document: Document) => {
setContent(document);
console.log('Contentful document:', document);
};
return (
<div>
<h1>My Rich Text Editor</h1>
<ContentfulRichTextEditor
placeholder="Start writing your content..."
onChange={handleChange}
initialValue={content}
showBorder={true} // Optional: control border visibility
/>
</div>
);
}
export default App;
Control the editor's border appearance with the showBorder prop:
// Default - with border (backward compatible)
<ContentfulRichTextEditor />
// Borderless editor for custom layouts
<ContentfulRichTextEditor
showBorder={false}
className="my-custom-editor"
/>
// Themed borderless editor
<ContentfulRichTextEditor
showBorder={false}
theme="minimal"
/>
/* Custom styling for borderless editor */
.my-custom-editor {
box-shadow: 0 2px 8px rgba(0,0,0,0.1);
border-radius: 8px;
}
.my-custom-editor .contentful-toolbar {
background: linear-gradient(45deg, #667eea, #764ba2);
}
import { ContentfulRichTextEditor } from '@crashbytes/contentful-richtext-editor';
import '@crashbytes/contentful-richtext-editor/dist/index.css';
function ContentfulEditor() {
const handleEmbedEntry = async () => {
// Your logic to select a Contentful entry
const entry = await openEntrySelector();
return entry;
};
const handleEmbedAsset = async () => {
// Your logic to select a Contentful asset
const asset = await openAssetSelector();
return asset;
};
return (
<ContentfulRichTextEditor
placeholder="Write your travel tip..."
onChange={(doc) => saveToContentful(doc)}
onEmbedEntry={handleEmbedEntry}
onEmbedAsset={handleEmbedAsset}
theme="contentful"
showBorder={true}
/>
);
}
<ContentfulRichTextEditor
placeholder="Simple editor..."
disabledFeatures={['table', 'embed', 'quote']}
theme="minimal"
readonly={false}
showBorder={false}
onChange={handleChange}
/>
| Prop | Type | Default | Description |
|---|---|---|---|
showBorder | boolean | true | Control editor border visibility |
initialValue | Document | undefined | Initial Contentful rich text document |
onChange | (document: Document) => void | undefined | Callback when content changes |
onEmbedEntry | () => Promise<any> | void | undefined | Callback for embedding Contentful entries |
onEmbedAsset | () => Promise<any> | void | undefined | Callback for embedding Contentful assets |
onEmbedInlineEntry | () => Promise<any> | void | undefined | Callback for embedding inline entries |
placeholder | string | 'Start writing...' | Placeholder text |
readonly | boolean | false | Whether editor is read-only |
className | string | '' | Additional CSS classes |
theme | 'default' | 'minimal' | 'contentful' | 'contentful' | Visual theme |
disabledFeatures | Array<string> | [] | Features to disable |
availableHeadings | Array<1 | 2 | 3 | 4 | 5 | 6> | [1,2,3,4,5,6] | Available heading levels |
availableMarks | Array<'bold' | 'italic' | 'underline'> | ['bold','italic','underline'] | Available text formatting |
You can disable specific features by passing them in the disabledFeatures array:
'bold' - Bold text formatting'italic' - Italic text formatting'underline' - Underline text formatting'link' - Hyperlinks'lists' - Ordered and unordered lists'headings' - All heading levels'quote' - Blockquotes'table' - Tables'embed' - Embedded contentimport {
contentfulToTiptap,
tiptapToContentful,
validateContentfulDocument,
createEmptyDocument,
extractPlainText,
countWords,
findEmbeddedContent
} from '@crashbytes/contentful-richtext-editor';
// Convert between formats
const tiptapJson = contentfulToTiptap(contentfulDocument);
const contentfulDoc = tiptapToContentful(tiptapJson);
// Validation and utilities
const isValid = validateContentfulDocument(someDocument);
const emptyDoc = createEmptyDocument();
const plainText = extractPlainText(document);
const wordCount = countWords(document);
const embedded = findEmbeddedContent(document);
The editor comes with default styles that match Contentful's design. Import the CSS:
import '@crashbytes/contentful-richtext-editor/dist/index.css';
You can override the default styles by targeting the CSS classes:
.contentful-editor {
border: 2px solid #your-color;
}
.contentful-toolbar {
background: #your-background;
}
.contentful-editor-content {
font-family: 'Your Font', sans-serif;
}
/* Borderless editor styling */
.contentful-editor--borderless {
border: none;
box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
Contentful (default) Matches Contentful's native editor appearance.
Minimal
Clean, minimal design with reduced visual elements.
Default Standard rich text editor appearance with serif fonts.
// pages/editor.tsx or app/editor/page.tsx
import dynamic from 'next/dynamic';
const ContentfulEditor = dynamic(
() => import('@crashbytes/contentful-richtext-editor').then(mod => mod.ContentfulRichTextEditor),
{ ssr: false }
);
export default function EditorPage() {
return (
<div>
<ContentfulEditor
placeholder="Write something amazing..."
onChange={(doc) => console.log(doc)}
showBorder={false}
/>
</div>
);
}
This package is written in TypeScript and includes full type definitions. All Contentful rich text types are re-exported for convenience:
import type {
Document,
Block,
Inline,
Text,
ContentfulRichTextEditorProps
} from '@crashbytes/contentful-richtext-editor';
Good News: The public API is unchanged! Upgrade with no code changes:
npm install @crashbytes/contentful-richtext-editor@latest
Your existing code continues to work:
// This still works exactly the same
<ContentfulRichTextEditor
placeholder="Start writing..."
onChange={handleChange}
initialValue={content}
/>
What Changed: Internal upgrade to Tiptap v3 provides:
See CHANGELOG.md for complete details.
No breaking changes! Simply update and optionally use the new showBorder prop.
We take security seriously. This package:
Found a vulnerability? Please report it via our Security Policy.
Contributions are welcome! Please feel free to submit a Pull Request.
git checkout -b feature/amazing-feature)git commit -m 'Add some amazing feature')git push origin feature/amazing-feature)All PRs automatically run:
MIT © CrashBytes
showBorder propMade with ❤️ for the Contentful community
FAQs
A Tiptap-based rich text editor compatible with Contentful's rich text format
The npm package @crashbytes/contentful-richtext-editor receives a total of 3 weekly downloads. As such, @crashbytes/contentful-richtext-editor popularity was classified as not popular.
We found that @crashbytes/contentful-richtext-editor demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.

Security News
OpenSSF has issued a high-severity advisory warning open source developers of an active Slack-based campaign using impersonation to deliver malware.

Research
/Security News
Malicious packages published to npm, PyPI, Go Modules, crates.io, and Packagist impersonate developer tooling to fetch staged malware, steal credentials and wallets, and enable remote access.