ct-rich-text-editor 1.1.1 → 1.1.2
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/{index-33d833ec.js → index-0ffc0dd5.js} +5 -5
- package/dist/index-0ffc0dd5.js.map +1 -0
- package/dist/{index-837e960a.js → index-812c0028.js} +2 -2
- package/dist/index-812c0028.js.map +1 -0
- package/dist/index.js +1 -1
- package/package.json +13 -16
- package/dist/index-33d833ec.js.map +0 -1
- package/dist/index-837e960a.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.
|
|
@@ -708,7 +708,7 @@ const Dm = qr(
|
|
|
708
708
|
children: e
|
|
709
709
|
}
|
|
710
710
|
);
|
|
711
|
-
}, bx = "
|
|
711
|
+
}, bx = "http://localhost:3000/api/license/validate", Cx = () => bx, wx = async (e) => {
|
|
712
712
|
try {
|
|
713
713
|
const t = Cx();
|
|
714
714
|
return (await lm.post(
|
|
@@ -7683,7 +7683,7 @@ process.env.NODE_ENV !== "production" && (d1.propTypes = {
|
|
|
7683
7683
|
useFlexGap: K.bool
|
|
7684
7684
|
});
|
|
7685
7685
|
const z4 = d1, H4 = lm.create({
|
|
7686
|
-
baseURL: "
|
|
7686
|
+
baseURL: "http://localhost:3000/",
|
|
7687
7687
|
headers: {
|
|
7688
7688
|
"Content-Type": "application/json"
|
|
7689
7689
|
}
|
|
@@ -7722,7 +7722,7 @@ const z4 = d1, H4 = lm.create({
|
|
|
7722
7722
|
} catch (t) {
|
|
7723
7723
|
throw console.error("Error in AiEditorAction:", t), t;
|
|
7724
7724
|
}
|
|
7725
|
-
}, W4 = Me.lazy(() => import("./index-
|
|
7725
|
+
}, W4 = Me.lazy(() => import("./index-812c0028.js"));
|
|
7726
7726
|
function K4(e) {
|
|
7727
7727
|
return e.parentElement != null && e.parentElement.tagName === "LI" && e.previousSibling === null && e.getAttribute("aria-roledescription") === "checkbox";
|
|
7728
7728
|
}
|
|
@@ -23969,7 +23969,7 @@ class KO {
|
|
|
23969
23969
|
ke(this, "requestTimeout", 1e4);
|
|
23970
23970
|
// 10 seconds timeout for more reliable responses
|
|
23971
23971
|
ke(this, "pendingRequests", /* @__PURE__ */ new Map());
|
|
23972
|
-
this.apiEndpoint = "
|
|
23972
|
+
this.apiEndpoint = "http://localhost:3000/" + t;
|
|
23973
23973
|
}
|
|
23974
23974
|
async makeRequest(t) {
|
|
23975
23975
|
const n = JSON.stringify(t);
|
|
@@ -27969,4 +27969,4 @@ export {
|
|
|
27969
27969
|
se as u,
|
|
27970
27970
|
wx as v
|
|
27971
27971
|
};
|
|
27972
|
-
//# sourceMappingURL=index-
|
|
27972
|
+
//# sourceMappingURL=index-0ffc0dd5.js.map
|