An intuitive and minimal WYSIWYG react editor.
npm install lidia-react-editorLidiaEditor component full featured demo provides a rich text editor (minimal WYSIWYG) with various configurable functionalities. A React component that utilizes Tiptap suite.
LidiaEditor component offers a robust set of features designed to enhance text editing and customization within React applications.
default, white, dark, preview.
LidiaEditor, install it via npm:
bash
npm install lidia-react-editor
`
`jsx
import React, { useState } from 'react';
import { LidiaEditor } from 'lidia-react-editor';
// To visualize all available styles import the theme CSS file
import "lidia-react-editor/dist/theme.css";
const MyComponent = () => {
const [html, setHtml] = useState('Example text
');
return (
className="myEditor"
html={html}
setHtml={setHtml}
/>
);
}
export default MyComponent;
`
Props
| Prop | Type | Required | Default | Description |
|---------------|-----------------------------|----------|---------------|--------------------------------------------------------------------------------------------------|
| className | string | No | | Optional CSS class for customizing the component's style. |
| html | string | Yes | - | HTML content to be displayed and edited in the editor. |
| setHtml | function | No | - | Function to update the edited HTML content. |
| onlyPreview | boolean | No | false | Indicates if the editor should be in preview-only mode (no editing). |
| editorStyle | "default" \| "white" \| "dark" \| "preview" | No | "preview" | Visual style of the editor. Options: "default", "white", "dark", "preview". |
Examples
#### Example 1: Preview-only mode
In this example, the editor is displayed in preview-only mode, disabling content editing.
`jsx
html={html}
onlyPreview={true}
editorStyle="preview"
/>
`
#### Example 2: Editor Styles
* default: The default style provides a standard appearance for the editor.
* white: The white style gives the editor a clean and minimalistic look with a light background.
* dark: The dark style themes the editor with a dark background and light text for better readability in low-light environments.
* preview: The preview style optimizes the editor for displaying content without editing capabilities, ideal for read-only use cases.
`jsx
html={html}
onlyPreview={true}
editorStyle="dark"
/>
`
Notes
* Ensure all necessary dependencies are installed based on the configured extensions in the editor.
* Adjust CSS classes and editor styles as per your application's design requirements.
How to Contribute
Thank you for your interest in contributing to the LidiaEditor project! Contributions are valuable and help improve the component for all users. Here’s how you can Contribute
$3
If you encounter any bugs or issues while using LidiaEditor, please open an issue on GitHub. Be sure to include detailed information about the problem, steps to reproduce it, and any relevant screenshots or error messages.
$3
Have an idea for a new feature or enhancement? You can submit a feature request on GitHub. Describe the feature thoroughly, including its use case and any expected behavior.
$3
Contributions through pull requests are welcome and encouraged. To contribute code:
1. Fork the repository on GitHub.
2. Create a new branch from the main branch for your changes.
3. Make your modifications, ensuring code quality and adhering to the project’s coding conventions.
4. Test your changes thoroughly to ensure they work as expected.
5. Commit your changes with clear and descriptive commit messages.
6. Push your branch to your fork and submit a pull request to the main` branch of the main repository.