customise-text-editor 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +70 -0
- package/dist/customise-text-editor.css +2 -0
- package/dist/customise-text-editor.es.js +14811 -0
- package/dist/customise-text-editor.umd.js +147 -0
- package/package.json +88 -0
package/README.md
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# Customise Text Editor 🚀
|
|
2
|
+
|
|
3
|
+
A highly customizable, production-ready Rich Text Editor for React, powered by Tiptap and Lucide Icons. Designed for developers who need full control over their editor's look, feel, and features without the bloat.
|
|
4
|
+
|
|
5
|
+
## 💎 Features
|
|
6
|
+
|
|
7
|
+
- **3 Layout Modes**: `top-bar`, `bottom-bar`, and selection-triggered `bubble-only`.
|
|
8
|
+
- **Dynamic Theming**: Full control over colors, borders, and radius via a single theme object.
|
|
9
|
+
- **Rich Toolbar**: Bold, Italic, Underline, Lists, Links, Blockquotes, Code, and more.
|
|
10
|
+
- **Built-in Color Pickers**: Real-time color selection for both text and highlights.
|
|
11
|
+
- **Ultra-Lightweight**: Highly optimized modular architecture (every component < 60 lines).
|
|
12
|
+
- **Responsive**: Horizontally scrollable toolbar with hidden scrollbars for mobile.
|
|
13
|
+
- **Type-Safe**: Full TypeScript support out of the box.
|
|
14
|
+
|
|
15
|
+
## 🚀 Installation
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm install customise-text-editor
|
|
19
|
+
# or
|
|
20
|
+
yarn add customise-text-editor
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## 💻 Usage
|
|
24
|
+
|
|
25
|
+
```tsx
|
|
26
|
+
import { CustomEditor } from 'customise-text-editor';
|
|
27
|
+
|
|
28
|
+
function MyEditor() {
|
|
29
|
+
return (
|
|
30
|
+
<CustomEditor
|
|
31
|
+
config={{
|
|
32
|
+
theme: {
|
|
33
|
+
primaryColor: '#3b82f6',
|
|
34
|
+
backgroundColor: '#ffffff',
|
|
35
|
+
textColor: '#1e293b',
|
|
36
|
+
borderRadius: '12px'
|
|
37
|
+
},
|
|
38
|
+
layout: 'top-bar',
|
|
39
|
+
placeholder: 'Start typing...',
|
|
40
|
+
features: ['bold', 'italic', 'underline', 'link', 'highlight', 'undo', 'redo']
|
|
41
|
+
}}
|
|
42
|
+
/>
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## 🎨 Theme Configuration
|
|
48
|
+
|
|
49
|
+
| Property | Description | Default |
|
|
50
|
+
| :--- | :--- | :--- |
|
|
51
|
+
| `primaryColor` | Brand color for active states & borders | `#3b82f6` |
|
|
52
|
+
| `backgroundColor` | Editor and toolbar background | `#ffffff` |
|
|
53
|
+
| `textColor` | Main text color | `#0f172a` |
|
|
54
|
+
| `borderColor` | Border color for the container | `#e2e8f0` |
|
|
55
|
+
| `borderRadius` | Main corner radius | `0.75rem` |
|
|
56
|
+
|
|
57
|
+
## 🛠️ Props
|
|
58
|
+
|
|
59
|
+
The `CustomEditor` component accepts a `config` object:
|
|
60
|
+
|
|
61
|
+
- `layout`: `'top-bar' | 'bottom-bar' | 'bubble-only'`
|
|
62
|
+
- `features`: Array of tools to display (e.g., `['bold', 'italic', 'link']`)
|
|
63
|
+
- `title`: Optional editor title
|
|
64
|
+
- `showTitle`: Toggle title visibility
|
|
65
|
+
- `placeholder`: Custom placeholder text
|
|
66
|
+
- `width`: Number or string (e.g., `800` or `'100%'`)
|
|
67
|
+
|
|
68
|
+
## 📄 License
|
|
69
|
+
|
|
70
|
+
MIT © [Your Name]
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
:root{--cte-primary:#3b82f6;--cte-primary-foreground:#fff;--cte-background:#fff;--cte-foreground:#0f172a;--cte-muted:#f1f5f9;--cte-muted-foreground:#64748b;--cte-border:#e2e8f0;--cte-accent:#f8fafc;--cte-accent-foreground:#0f172a;--cte-radius:.75rem;--cte-font-family:"Inter", system-ui, sans-serif;--cte-shadow-sm:0 1px 2px 0 #0000000d;--cte-shadow:0 1px 3px 0 #0000001a, 0 1px 2px -1px #0000001a;--cte-shadow-md:0 4px 6px -1px #0000001a, 0 2px 4px -2px #0000001a}.cte-editor-container{background-color:var(--cte-background);color:var(--cte-foreground);border:1px solid var(--cte-border);border-radius:var(--cte-radius);font-family:var(--cte-font-family);width:var(--cte-width,100%);max-width:100%;box-shadow:var(--cte-shadow);flex-direction:column;margin:0 auto;transition:all .3s cubic-bezier(.4,0,.2,1);display:flex;overflow:hidden}.cte-editor-container:focus-within{border-color:var(--cte-primary);box-shadow:0 0 0 2px #3b82f61a, var(--cte-shadow-md)}.cte-title-bar{border-bottom:1px solid var(--cte-border);background-color:var(--cte-background);color:var(--cte-text);padding:1rem 1.25rem;font-size:1.125rem;font-weight:600}.cte-title-input{color:inherit;border:none;border-bottom:1px solid var(--cte-border);background-color:#0000;outline:none;padding:1rem 1.25rem;font-size:1.25rem;font-weight:700}.cte-title-input::placeholder{color:var(--cte-muted-foreground);opacity:.5}.cte-toolbar{border-bottom:1px solid var(--cte-border);background-color:var(--cte-background);white-space:nowrap;scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;align-items:center;gap:.5rem;padding:.5rem .75rem;display:flex;overflow-x:auto}.cte-toolbar.cte-bottom{border-bottom:none;border-top:1px solid var(--cte-border)}.cte-toolbar::-webkit-scrollbar{display:none}.cte-toolbar-group{border-right:1px solid var(--cte-border);align-items:center;gap:.25rem;padding-right:.5rem;display:flex}.cte-toolbar-group:last-child{border-right:none}.cte-toolbar-btn{background-color:var(--cte-toolbar-btn-bg,transparent);width:2rem;height:2rem;color:var(--cte-foreground);cursor:pointer;border:none;border-radius:.375rem;justify-content:center;align-items:center;transition:all .2s;display:inline-flex}.cte-toolbar-btn:hover{background-color:var(--cte-accent)}.cte-toolbar-btn:active,.cte-toolbar-btn.is-active{background-color:var(--cte-primary);color:var(--cte-primary-foreground);transform:scale(.95)}.cte-toolbar-btn:disabled{opacity:.3;cursor:not-allowed;pointer-events:none}.cte-toolbar-btn svg{width:1.25rem;height:1.25rem}.cte-color-swatch{border:1px solid #0000001a;border-radius:50%;width:.875rem;height:.875rem;transition:transform .2s}.cte-toolbar-btn:hover .cte-color-swatch{transform:scale(1.2)}.cte-content-area{cursor:text;outline:none;min-height:200px;padding:1.5rem 1.25rem}.ProseMirror{outline:none}.ProseMirror p{margin-bottom:.75rem}.ProseMirror blockquote{border-left:3px solid var(--cte-primary);color:var(--cte-muted-foreground);margin:1rem 0;padding-left:1rem;font-style:italic}.ProseMirror pre{background:var(--cte-muted);color:var(--cte-foreground);border:1px solid var(--cte-border);border-radius:.5rem;padding:1rem;font-family:Fira Code,monospace;overflow-x:auto}.cte-footer{color:var(--cte-muted-foreground);background-color:var(--cte-muted);border-top:1px solid var(--cte-border);justify-content:flex-end;padding:.5rem 1rem;font-size:.75rem;display:flex}.cte-char-limit-bar{background-color:var(--cte-primary);height:2px;transition:width .3s}.cte-content-area::-webkit-scrollbar{width:6px}.cte-content-area::-webkit-scrollbar-track{background:0 0}.cte-content-area::-webkit-scrollbar-thumb{background:var(--cte-muted-foreground);border-radius:3px}.cte-content-area::-webkit-scrollbar-thumb:hover{background:var(--cte-primary)}
|
|
2
|
+
/*$vite$:1*/
|