ct-rich-text-editor 1.1.4 → 1.1.6
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 +147 -147
- package/dist/assets/style.css +1 -1
- package/dist/components/ui/avatar.d.ts +6 -0
- package/dist/components/ui/badge.d.ts +9 -0
- package/dist/components/ui/card.d.ts +8 -0
- package/dist/components/ui/sheet.d.ts +25 -0
- package/dist/components/ui/skeleton.d.ts +3 -0
- package/dist/components/ui/tabs.d.ts +7 -0
- package/dist/components/ui/textarea.d.ts +3 -0
- package/dist/{index-0ffc0dd5.js → index-37fe1b12.js} +14733 -14303
- package/dist/index-37fe1b12.js.map +1 -0
- package/dist/{index-812c0028.js → index-bdc211c1.js} +2 -2
- package/dist/index-bdc211c1.js.map +1 -0
- package/dist/index.js +1 -1
- package/dist/plugins/AutocompletePlugin.d.ts +2 -6
- package/package.json +20 -15
- package/dist/index-0ffc0dd5.js.map +0 -1
- package/dist/index-812c0028.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,147 +1,147 @@
|
|
|
1
|
-
# CT Rich Text Editor
|
|
2
|
-
|
|
3
|
-
A configurable rich text editor component with API key authentication.
|
|
4
|
-
|
|
5
|
-
## Installation
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
npm install ct-rich-text-editor
|
|
9
|
-
# or
|
|
10
|
-
yarn add ct-rich-text-editor
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
## Features
|
|
14
|
-
|
|
15
|
-
- Rich text editor with extensive formatting options
|
|
16
|
-
- API key authentication
|
|
17
|
-
- Configurable UI components (toolbar, floating menu)
|
|
18
|
-
- HTML view option
|
|
19
|
-
- Support for tables, images, links, and more
|
|
20
|
-
- AI chat integration (for premium plans)
|
|
21
|
-
- Environment-based API configuration
|
|
22
|
-
|
|
23
|
-
## Usage
|
|
24
|
-
|
|
25
|
-
### Important: Importing Styles
|
|
26
|
-
To ensure proper styling of the editor components including tables, you must import the package's CSS:
|
|
27
|
-
|
|
28
|
-
```jsx
|
|
29
|
-
// Import the styles in your application
|
|
30
|
-
import 'ct-rich-text-editor/style.css';
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
### Basic Setup
|
|
34
|
-
|
|
35
|
-
```jsx
|
|
36
|
-
import React from 'react';
|
|
37
|
-
import {
|
|
38
|
-
ConfigurableEditorWithAuth,
|
|
39
|
-
EditorProvider,
|
|
40
|
-
defaultEditorConfig
|
|
41
|
-
} from 'ct-rich-text-editor';
|
|
42
|
-
// Import required styles
|
|
43
|
-
import 'ct-rich-text-editor/style.css';
|
|
44
|
-
|
|
45
|
-
function App() {
|
|
46
|
-
const apiKey = 'your-api-key'; // Replace with your actual API key
|
|
47
|
-
|
|
48
|
-
return (
|
|
49
|
-
<EditorProvider
|
|
50
|
-
defaultFontFamilies={defaultEditorConfig.defaultFontFamilies}
|
|
51
|
-
mentionUserList={defaultEditorConfig.mentionUserList}
|
|
52
|
-
>
|
|
53
|
-
<ConfigurableEditorWithAuth
|
|
54
|
-
apiKey={apiKey}
|
|
55
|
-
onAuthSuccess={() => console.log('Authentication successful')}
|
|
56
|
-
onAuthError={(error) => console.error('Authentication error:', error)}
|
|
57
|
-
/>
|
|
58
|
-
</EditorProvider>
|
|
59
|
-
);
|
|
60
|
-
}
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
## API Reference
|
|
64
|
-
|
|
65
|
-
### EditorProvider
|
|
66
|
-
|
|
67
|
-
Provides authentication and configuration context for the editor.
|
|
68
|
-
|
|
69
|
-
#### Props
|
|
70
|
-
|
|
71
|
-
- `children`: React nodes to render
|
|
72
|
-
- `defaultFontFamilies`: Array of font names (optional)
|
|
73
|
-
- `mentionUserList`: Array of usernames for mention functionality (optional)
|
|
74
|
-
|
|
75
|
-
### ConfigurableEditorWithAuth
|
|
76
|
-
|
|
77
|
-
The main editor component with authentication.
|
|
78
|
-
|
|
79
|
-
#### Props
|
|
80
|
-
|
|
81
|
-
- `apiKey`: Your API key for authentication (required)
|
|
82
|
-
- `onAuthSuccess`: Callback function when authentication is successful (optional)
|
|
83
|
-
- `onAuthError`: Callback function when authentication fails (optional)
|
|
84
|
-
- `showToolbar`: Boolean to show/hide the toolbar (optional, default: true)
|
|
85
|
-
- `showFloatingMenu`: Boolean to show/hide the floating menu (optional, default: true)
|
|
86
|
-
- `showHtmlView`: Boolean to show/hide HTML view option (optional, default: true)
|
|
87
|
-
- `initialContent`: Initial content for the editor (optional)
|
|
88
|
-
- `onChange`: Callback function when editor content changes (optional)
|
|
89
|
-
- `readOnly`: Boolean to make editor read-only (optional, default: false)
|
|
90
|
-
- `placeholder`: Placeholder text when editor is empty (optional)
|
|
91
|
-
- `theme`: Custom theme object for styling (optional)
|
|
92
|
-
- `plugins`: Array of custom plugins (optional)
|
|
93
|
-
- `aiEnabled`: Boolean to enable/disable AI features (optional, default: false)
|
|
94
|
-
- `onAiResponse`: Callback function for AI responses (optional)
|
|
95
|
-
- `onAiError`: Callback function for AI errors (optional)
|
|
96
|
-
|
|
97
|
-
## Examples
|
|
98
|
-
|
|
99
|
-
### Basic Editor with Authentication
|
|
100
|
-
|
|
101
|
-
```jsx
|
|
102
|
-
import React from 'react';
|
|
103
|
-
import { ConfigurableEditorWithAuth, EditorProvider } from 'ct-rich-text-editor';
|
|
104
|
-
import 'ct-rich-text-editor/style.css';
|
|
105
|
-
|
|
106
|
-
function App() {
|
|
107
|
-
return (
|
|
108
|
-
<EditorProvider>
|
|
109
|
-
<ConfigurableEditorWithAuth
|
|
110
|
-
apiKey="your-api-key"
|
|
111
|
-
onAuthSuccess={() => console.log('Authenticated')}
|
|
112
|
-
onAuthError={(error) => console.error(error)}
|
|
113
|
-
/>
|
|
114
|
-
</EditorProvider>
|
|
115
|
-
);
|
|
116
|
-
}
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
### Editor with Custom Configuration
|
|
120
|
-
|
|
121
|
-
```jsx
|
|
122
|
-
import React from 'react';
|
|
123
|
-
import { ConfigurableEditorWithAuth, EditorProvider } from 'ct-rich-text-editor';
|
|
124
|
-
import 'ct-rich-text-editor/style.css';
|
|
125
|
-
|
|
126
|
-
function App() {
|
|
127
|
-
return (
|
|
128
|
-
<EditorProvider>
|
|
129
|
-
<ConfigurableEditorWithAuth
|
|
130
|
-
apiKey="your-api-key"
|
|
131
|
-
showToolbar={true}
|
|
132
|
-
showFloatingMenu={true}
|
|
133
|
-
showHtmlView={true}
|
|
134
|
-
readOnly={false}
|
|
135
|
-
placeholder="Start typing..."
|
|
136
|
-
aiEnabled={true}
|
|
137
|
-
onAiResponse={(response) => console.log('AI Response:', response)}
|
|
138
|
-
onAiError={(error) => console.error('AI Error:', error)}
|
|
139
|
-
/>
|
|
140
|
-
</EditorProvider>
|
|
141
|
-
);
|
|
142
|
-
}
|
|
143
|
-
```
|
|
144
|
-
|
|
145
|
-
## License
|
|
146
|
-
|
|
147
|
-
This project is licensed under the MIT License - see the LICENSE file for details.
|
|
1
|
+
# CT Rich Text Editor
|
|
2
|
+
|
|
3
|
+
A configurable rich text editor component with API key authentication.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install ct-rich-text-editor
|
|
9
|
+
# or
|
|
10
|
+
yarn add ct-rich-text-editor
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Features
|
|
14
|
+
|
|
15
|
+
- Rich text editor with extensive formatting options
|
|
16
|
+
- API key authentication
|
|
17
|
+
- Configurable UI components (toolbar, floating menu)
|
|
18
|
+
- HTML view option
|
|
19
|
+
- Support for tables, images, links, and more
|
|
20
|
+
- AI chat integration (for premium plans)
|
|
21
|
+
- Environment-based API configuration
|
|
22
|
+
|
|
23
|
+
## Usage
|
|
24
|
+
|
|
25
|
+
### Important: Importing Styles
|
|
26
|
+
To ensure proper styling of the editor components including tables, you must import the package's CSS:
|
|
27
|
+
|
|
28
|
+
```jsx
|
|
29
|
+
// Import the styles in your application
|
|
30
|
+
import 'ct-rich-text-editor/style.css';
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### Basic Setup
|
|
34
|
+
|
|
35
|
+
```jsx
|
|
36
|
+
import React from 'react';
|
|
37
|
+
import {
|
|
38
|
+
ConfigurableEditorWithAuth,
|
|
39
|
+
EditorProvider,
|
|
40
|
+
defaultEditorConfig
|
|
41
|
+
} from 'ct-rich-text-editor';
|
|
42
|
+
// Import required styles
|
|
43
|
+
import 'ct-rich-text-editor/style.css';
|
|
44
|
+
|
|
45
|
+
function App() {
|
|
46
|
+
const apiKey = 'your-api-key'; // Replace with your actual API key
|
|
47
|
+
|
|
48
|
+
return (
|
|
49
|
+
<EditorProvider
|
|
50
|
+
defaultFontFamilies={defaultEditorConfig.defaultFontFamilies}
|
|
51
|
+
mentionUserList={defaultEditorConfig.mentionUserList}
|
|
52
|
+
>
|
|
53
|
+
<ConfigurableEditorWithAuth
|
|
54
|
+
apiKey={apiKey}
|
|
55
|
+
onAuthSuccess={() => console.log('Authentication successful')}
|
|
56
|
+
onAuthError={(error) => console.error('Authentication error:', error)}
|
|
57
|
+
/>
|
|
58
|
+
</EditorProvider>
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## API Reference
|
|
64
|
+
|
|
65
|
+
### EditorProvider
|
|
66
|
+
|
|
67
|
+
Provides authentication and configuration context for the editor.
|
|
68
|
+
|
|
69
|
+
#### Props
|
|
70
|
+
|
|
71
|
+
- `children`: React nodes to render
|
|
72
|
+
- `defaultFontFamilies`: Array of font names (optional)
|
|
73
|
+
- `mentionUserList`: Array of usernames for mention functionality (optional)
|
|
74
|
+
|
|
75
|
+
### ConfigurableEditorWithAuth
|
|
76
|
+
|
|
77
|
+
The main editor component with authentication.
|
|
78
|
+
|
|
79
|
+
#### Props
|
|
80
|
+
|
|
81
|
+
- `apiKey`: Your API key for authentication (required)
|
|
82
|
+
- `onAuthSuccess`: Callback function when authentication is successful (optional)
|
|
83
|
+
- `onAuthError`: Callback function when authentication fails (optional)
|
|
84
|
+
- `showToolbar`: Boolean to show/hide the toolbar (optional, default: true)
|
|
85
|
+
- `showFloatingMenu`: Boolean to show/hide the floating menu (optional, default: true)
|
|
86
|
+
- `showHtmlView`: Boolean to show/hide HTML view option (optional, default: true)
|
|
87
|
+
- `initialContent`: Initial content for the editor (optional)
|
|
88
|
+
- `onChange`: Callback function when editor content changes (optional)
|
|
89
|
+
- `readOnly`: Boolean to make editor read-only (optional, default: false)
|
|
90
|
+
- `placeholder`: Placeholder text when editor is empty (optional)
|
|
91
|
+
- `theme`: Custom theme object for styling (optional)
|
|
92
|
+
- `plugins`: Array of custom plugins (optional)
|
|
93
|
+
- `aiEnabled`: Boolean to enable/disable AI features (optional, default: false)
|
|
94
|
+
- `onAiResponse`: Callback function for AI responses (optional)
|
|
95
|
+
- `onAiError`: Callback function for AI errors (optional)
|
|
96
|
+
|
|
97
|
+
## Examples
|
|
98
|
+
|
|
99
|
+
### Basic Editor with Authentication
|
|
100
|
+
|
|
101
|
+
```jsx
|
|
102
|
+
import React from 'react';
|
|
103
|
+
import { ConfigurableEditorWithAuth, EditorProvider } from 'ct-rich-text-editor';
|
|
104
|
+
import 'ct-rich-text-editor/style.css';
|
|
105
|
+
|
|
106
|
+
function App() {
|
|
107
|
+
return (
|
|
108
|
+
<EditorProvider>
|
|
109
|
+
<ConfigurableEditorWithAuth
|
|
110
|
+
apiKey="your-api-key"
|
|
111
|
+
onAuthSuccess={() => console.log('Authenticated')}
|
|
112
|
+
onAuthError={(error) => console.error(error)}
|
|
113
|
+
/>
|
|
114
|
+
</EditorProvider>
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### Editor with Custom Configuration
|
|
120
|
+
|
|
121
|
+
```jsx
|
|
122
|
+
import React from 'react';
|
|
123
|
+
import { ConfigurableEditorWithAuth, EditorProvider } from 'ct-rich-text-editor';
|
|
124
|
+
import 'ct-rich-text-editor/style.css';
|
|
125
|
+
|
|
126
|
+
function App() {
|
|
127
|
+
return (
|
|
128
|
+
<EditorProvider>
|
|
129
|
+
<ConfigurableEditorWithAuth
|
|
130
|
+
apiKey="your-api-key"
|
|
131
|
+
showToolbar={true}
|
|
132
|
+
showFloatingMenu={true}
|
|
133
|
+
showHtmlView={true}
|
|
134
|
+
readOnly={false}
|
|
135
|
+
placeholder="Start typing..."
|
|
136
|
+
aiEnabled={true}
|
|
137
|
+
onAiResponse={(response) => console.log('AI Response:', response)}
|
|
138
|
+
onAiError={(error) => console.error('AI Error:', error)}
|
|
139
|
+
/>
|
|
140
|
+
</EditorProvider>
|
|
141
|
+
);
|
|
142
|
+
}
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
## License
|
|
146
|
+
|
|
147
|
+
This project is licensed under the MIT License - see the LICENSE file for details.
|