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 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.