
Security News
Django Joins curl in Pushing Back on AI Slop Security Reports
Django has updated its security policies to reject AI-generated vulnerability reports that include fabricated or unverifiable content.
textcrafter
Advanced tools
TextCrafter: A modern, customizable rich text editor for React. Supports rich formatting, media embedding and real-time collaboration. Ideal for content creators.
TextCrafter is a powerful, flexible, and fully customizable rich text editor built specifically for modern React applications. It supports a comprehensive set of formatting tools and HTML elements, including text styles, tables, lists, links, and images. Designed with compatibility and ease of integration in mind, TextCrafter works seamlessly with both React and Next.js (App Router and Page Router), and supports projects written in JavaScript or TypeScript. Whether you're building a blog platform, CMS, or document editor, TextCrafter provides a robust editing experience with fast installation via npm or Yarn.
To install TextCrafter, choose your preferred package manager:
npm install textcrafter
yarn add textcrafter
Import the Editor Styles
Import the editor's default stylesheet into your main app component to apply necessary styles.
import "textcrafter/dist/styles.min.css";
Implement the Editor Component
Import and use the Editor
component within your React component.
import React, { useState } from "react";
import { Editor } from "textcrafter";
const MyEditor = () => {
const [editorContent, setEditorContent] = useState(
"<p>Start editing...</p>"
);
const handleEditorChange = (content: string) => {
setEditorContent(content);
};
return (
<div>
<Editor value={editorContent} onChange={handleEditorChange} />
</div>
);
};
export default MyEditor;
External Server Functionality for Image
import { useState } from "react";
import "./App.css";
import { Editor } from "textcrafter";
import "textcrafter/dist/styles.min.css";
function App() {
const [editorContent, setEditorContent] = useState("<p>Start editing...</p>");
const handleEditorChange = (content: string) => {
setEditorContent(content);
};
const handleImageUpload = async (file: File): Promise<string> => {
// We just need the image URL
// You can handle image with formdata or base64
// Upload image to server and return Image URL
const formData = new FormData();
formData.append("image", file);
// handle the image upload
const response = await fetch("/api/upload-image", {
method: "POST",
headers: {
Authorization: "Bearer token",
},
body: formData,
});
const data = await response.json();
return data.imageUrl; // return the image url
};
const handleImageDelete = async (imgSrc: string) => {
// Write your own delete functionality
const response = await fetch(
`/image-delete?src=${encodeURIComponent(imgSrc)}`,
{ method: "DELETE" }
);
await response.json();
};
return (
<div>
<Editor
isServer
value={editorContent}
toolbarClassName="custom-toolbar" //customize toolbar
editorClassName="custom-editor" //customize editor
handleImageUpload={handleImageUpload}
handleImageDelete={handleImageDelete}
onChange={handleEditorChange}
/>
</div>
);
}
export default App;
Import Styles
Import the editor styles in your root layout to apply them globally.
import "textcrafter/dist/styles.min.css";
Add the Editor Component in Page Components
Use the Editor
component in your page-level components.
import React, { useState } from "react";
import { Editor } from "textcrafter";
const PageComponent = () => {
const [editorContent, setEditorContent] = useState("<p>Edit here...</p>");
const handleEditorChange = (content: string) => {
setEditorContent(content);
};
return (
<div>
<Editor value={editorContent} onChange={handleEditorChange} />
</div>
);
};
export default PageComponent;
Import Styles in the _app Component
Include the editor styles in the _app.js
or _app.tsx
file.
import "textcrafter/dist/styles.min.css";
Add the Editor Component in Page Components
import React, { useState } from "react";
import { Editor } from "textcrafter";
const HomePage = () => {
const [editorContent, setEditorContent] = useState("<p>Edit here...</p>");
const handleEditorChange = (content: string) => {
setEditorContent(content);
};
return (
<div>
<Editor value={editorContent} onChange={handleEditorChange} />
</div>
);
};
export default HomePage;
TextCrafter offers extensive configuration options to customize the editor to fit your project’s requirements:
You can easily modify TextCrafter’s appearance by updating the provided CSS or adding custom styles. The toolbar and editor areas are designed for straightforward customization, allowing you to style them to fit your application’s theme.
To customize the editor and toolbar, pass your className through props:
toolbarClassName = "custom-toolbar";
editorClassName = "custom-editor";
/* You can customize as your requirement*/
.custom-toolbar {
background-color: #f3f3f3;
border: 1px solid #ddd;
border-radius: 5px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); /* Custom shadow */
}
.custom-editor {
padding: 10px;
background-color: white;
border: 1px solid #ddd;
border-radius: 5px;
}
Contributions are highly welcome! To contribute:
TextCrafter is licensed under the MIT License. See LICENSE for more details.
TextCrafter combines rich functionality with ease of use, providing a smooth editing experience in any React or Next.js application. Happy coding!
FAQs
TextCrafter: A modern, customizable rich text editor for React. Supports rich formatting, media embedding and real-time collaboration. Ideal for content creators.
The npm package textcrafter receives a total of 32 weekly downloads. As such, textcrafter popularity was classified as not popular.
We found that textcrafter 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
Django has updated its security policies to reject AI-generated vulnerability reports that include fabricated or unverifiable content.
Security News
ECMAScript 2025 introduces Iterator Helpers, Set methods, JSON modules, and more in its latest spec update approved by Ecma in June 2025.
Security News
A new Node.js homepage button linking to paid support for EOL versions has sparked a heated discussion among contributors and the wider community.