ct-rich-text-editor 1.3.11 → 1.3.12

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
@@ -45,6 +45,14 @@ import 'ct-rich-text-editor/style.css';
45
45
  function App() {
46
46
  const apiKey = 'your-api-key'; // Replace with your actual API key
47
47
 
48
+ // Current logged-in user for comments
49
+ const currentUser = {
50
+ id: 'user-123',
51
+ name: 'John Doe',
52
+ email: 'john@example.com',
53
+ avatar: 'https://example.com/avatar.jpg' // optional
54
+ };
55
+
48
56
  const handleContentChange = (html) => {
49
57
  console.log('Editor HTML content:', html);
50
58
  // Handle the HTML content (save to state, send to server, etc.)
@@ -53,12 +61,13 @@ function App() {
53
61
  return (
54
62
  <EditorProvider
55
63
  defaultFontFamilies={defaultEditorConfig.defaultFontFamilies}
56
- mentionUserList={defaultEditorConfig.mentionUserList}
64
+ currentUser={currentUser}
57
65
  >
58
66
  <ConfigurableEditorWithAuth
59
67
  apiKey={apiKey}
60
68
  onChange={handleContentChange}
61
69
  initialContent="<p>Welcome to the editor!</p>"
70
+ mentionUserList={["Alice", "Bob", "Charlie"]}
62
71
  onAuthSuccess={() => console.log('Authentication successful')}
63
72
  onAuthError={(error) => console.error('Authentication error:', error)}
64
73
  />
@@ -77,7 +86,7 @@ Provides authentication and configuration context for the editor.
77
86
 
78
87
  - `children`: React nodes to render
79
88
  - `defaultFontFamilies`: Array of font names (optional)
80
- - `mentionUserList`: Array of usernames for mention functionality (optional)
89
+ - `currentUser`: Current logged-in user for comments (optional) - Object with `id`, `name`, `email`, and optional `avatar`
81
90
 
82
91
  ### ConfigurableEditorWithAuth
83
92
 
@@ -89,7 +98,7 @@ The main editor component with authentication.
89
98
  - `initialContent`: Initial HTML content for the editor (optional) - string
90
99
  - `onChange`: Callback function when editor content changes (optional) - receives HTML string
91
100
  - `defaultFontFamilies`: Array of font names for the font selector (optional)
92
- - `mentionUserList`: Array of usernames for mention functionality (optional)
101
+ - `mentionUserList`: Array of usernames for mention functionality (optional) - Array of strings like `["Alice", "Bob", "Charlie"]`
93
102
  - `onAuthSuccess`: Callback function when authentication is successful (optional)
94
103
  - `onAuthError`: Callback function when authentication fails (optional)
95
104
  - `customVerifyKey`: Custom function to verify API key (optional)
@@ -126,6 +135,13 @@ import 'ct-rich-text-editor/style.css';
126
135
  function App() {
127
136
  const [editorContent, setEditorContent] = useState('');
128
137
 
138
+ // Current user (typically from your auth system)
139
+ const currentUser = {
140
+ id: 'user-456',
141
+ name: 'Jane Smith',
142
+ email: 'jane@example.com'
143
+ };
144
+
129
145
  const handleContentChange = (html) => {
130
146
  setEditorContent(html);
131
147
  console.log('Current content:', html);
@@ -140,18 +156,18 @@ function App() {
140
156
 
141
157
  const loadSavedContent = () => {
142
158
  const saved = '<p>Start writing your content here...</p>';
143
- return saved
159
+ return saved;
144
160
  };
145
161
 
146
162
  return (
147
163
  <div>
148
- <EditorProvider>
164
+ <EditorProvider currentUser={currentUser}>
149
165
  <ConfigurableEditorWithAuth
150
166
  apiKey="your-api-key"
151
167
  initialContent={loadSavedContent()}
152
168
  onChange={handleContentChange}
153
169
  defaultFontFamilies={['Arial', 'Helvetica', 'Times New Roman']}
154
- mentionUserList={['@john', '@jane', '@bob']}
170
+ mentionUserList={['Alice', 'Bob', 'Charlie']}
155
171
  onAuthSuccess={() => console.log('Ready to edit!')}
156
172
  onAuthError={(error) => console.error('Auth failed:', error)}
157
173
  />
@@ -1,4 +1,10 @@
1
1
  import { EditorConfigTypes } from '../types';
2
+ export interface CurrentUser {
3
+ id: string;
4
+ name: string;
5
+ email?: string;
6
+ avatar?: string;
7
+ }
2
8
  interface EditorContextType {
3
9
  isAuthenticated: boolean;
4
10
  isLoading: boolean;
@@ -7,6 +13,7 @@ interface EditorContextType {
7
13
  projectName: string | null;
8
14
  isPaidPlan: boolean;
9
15
  apiKey: string | null;
16
+ currentUser: CurrentUser | null;
10
17
  verifyKey: (apiKey: string) => Promise<void>;
11
18
  }
12
19
  export declare const useEditor: () => EditorContextType;
@@ -14,6 +21,7 @@ interface EditorProviderProps {
14
21
  children: React.ReactNode;
15
22
  defaultFontFamilies?: string[];
16
23
  mentionUserList?: string[];
24
+ currentUser?: CurrentUser;
17
25
  }
18
26
  export declare const EditorProvider: React.FC<EditorProviderProps>;
19
27
  export {};
@@ -648,6 +648,10 @@ video {
648
648
  left: 0.625rem;
649
649
  }
650
650
 
651
+ .cteditor-left-3{
652
+ left: 0.75rem;
653
+ }
654
+
651
655
  .cteditor-left-\[50\%\]{
652
656
  left: 50%;
653
657
  }
@@ -680,6 +684,10 @@ video {
680
684
  top: 0.5rem;
681
685
  }
682
686
 
687
+ .cteditor-top-3{
688
+ top: 0.75rem;
689
+ }
690
+
683
691
  .cteditor-top-4{
684
692
  top: 1rem;
685
693
  }
@@ -794,10 +802,6 @@ video {
794
802
  margin-left: 0.5rem;
795
803
  }
796
804
 
797
- .cteditor-ml-4{
798
- margin-left: 1rem;
799
- }
800
-
801
805
  .cteditor-ml-auto{
802
806
  margin-left: auto;
803
807
  }
@@ -810,6 +814,10 @@ video {
810
814
  margin-right: 0.5rem;
811
815
  }
812
816
 
817
+ .cteditor-ms-auto{
818
+ margin-inline-start: auto;
819
+ }
820
+
813
821
  .cteditor-mt-0\.5{
814
822
  margin-top: 0.125rem;
815
823
  }
@@ -830,10 +838,6 @@ video {
830
838
  margin-top: 1rem;
831
839
  }
832
840
 
833
- .cteditor-mt-5{
834
- margin-top: 1.25rem;
835
- }
836
-
837
841
  .cteditor-mt-6{
838
842
  margin-top: 1.5rem;
839
843
  }
@@ -902,6 +906,11 @@ video {
902
906
  height: 1.5rem !important;
903
907
  }
904
908
 
909
+ .\!cteditor-size-8{
910
+ width: 2rem !important;
911
+ height: 2rem !important;
912
+ }
913
+
905
914
  .\!cteditor-size-\[18px\]{
906
915
  width: 18px !important;
907
916
  height: 18px !important;
@@ -917,6 +926,11 @@ video {
917
926
  height: 2.5rem;
918
927
  }
919
928
 
929
+ .cteditor-size-11{
930
+ width: 2.75rem;
931
+ height: 2.75rem;
932
+ }
933
+
920
934
  .cteditor-size-3{
921
935
  width: 0.75rem;
922
936
  height: 0.75rem;
@@ -952,6 +966,18 @@ video {
952
966
  height: auto;
953
967
  }
954
968
 
969
+ .\!cteditor-h-10{
970
+ height: 2.5rem !important;
971
+ }
972
+
973
+ .\!cteditor-h-11{
974
+ height: 2.75rem !important;
975
+ }
976
+
977
+ .\!cteditor-h-4{
978
+ height: 1rem !important;
979
+ }
980
+
955
981
  .\!cteditor-h-6{
956
982
  height: 1.5rem !important;
957
983
  }
@@ -1060,6 +1086,10 @@ video {
1060
1086
  max-height: 12rem;
1061
1087
  }
1062
1088
 
1089
+ .cteditor-max-h-5{
1090
+ max-height: 1.25rem;
1091
+ }
1092
+
1063
1093
  .cteditor-max-h-56{
1064
1094
  max-height: 14rem;
1065
1095
  }
@@ -1100,6 +1130,10 @@ video {
1100
1130
  max-height: 650px;
1101
1131
  }
1102
1132
 
1133
+ .cteditor-max-h-\[90vh\]{
1134
+ max-height: 90vh;
1135
+ }
1136
+
1103
1137
  .cteditor-max-h-\[var\(--radix-dropdown-menu-content-available-height\)\]{
1104
1138
  max-height: var(--radix-dropdown-menu-content-available-height);
1105
1139
  }
@@ -1144,6 +1178,14 @@ video {
1144
1178
  min-height: 100vh;
1145
1179
  }
1146
1180
 
1181
+ .\!cteditor-w-24{
1182
+ width: 6rem !important;
1183
+ }
1184
+
1185
+ .\!cteditor-w-4{
1186
+ width: 1rem !important;
1187
+ }
1188
+
1147
1189
  .\!cteditor-w-9{
1148
1190
  width: 2.25rem !important;
1149
1191
  }
@@ -1156,20 +1198,20 @@ video {
1156
1198
  width: 2.5rem;
1157
1199
  }
1158
1200
 
1159
- .cteditor-w-14{
1160
- width: 3.5rem;
1201
+ .cteditor-w-11{
1202
+ width: 2.75rem;
1161
1203
  }
1162
1204
 
1163
- .cteditor-w-16{
1164
- width: 4rem;
1205
+ .cteditor-w-12{
1206
+ width: 3rem;
1165
1207
  }
1166
1208
 
1167
- .cteditor-w-2{
1168
- width: 0.5rem;
1209
+ .cteditor-w-14{
1210
+ width: 3.5rem;
1169
1211
  }
1170
1212
 
1171
- .cteditor-w-24{
1172
- width: 6rem;
1213
+ .cteditor-w-2{
1214
+ width: 0.5rem;
1173
1215
  }
1174
1216
 
1175
1217
  .cteditor-w-3{
@@ -1244,10 +1286,6 @@ video {
1244
1286
  width: 340px;
1245
1287
  }
1246
1288
 
1247
- .cteditor-w-\[400px\]{
1248
- width: 400px;
1249
- }
1250
-
1251
1289
  .cteditor-w-auto{
1252
1290
  width: auto;
1253
1291
  }
@@ -1696,6 +1734,10 @@ video {
1696
1734
  border-left-width: 1px;
1697
1735
  }
1698
1736
 
1737
+ .cteditor-border-l-2{
1738
+ border-left-width: 2px;
1739
+ }
1740
+
1699
1741
  .cteditor-border-l-4{
1700
1742
  border-left-width: 4px;
1701
1743
  }
@@ -1782,6 +1824,10 @@ video {
1782
1824
  border-color: hsl(var(--cteditorf47ac10b-foreground) / 0.2);
1783
1825
  }
1784
1826
 
1827
+ .cteditor-border-foreground\/30{
1828
+ border-color: hsl(var(--cteditorf47ac10b-foreground) / 0.3);
1829
+ }
1830
+
1785
1831
  .cteditor-border-foreground\/5{
1786
1832
  border-color: hsl(var(--cteditorf47ac10b-foreground) / 0.05);
1787
1833
  }
@@ -1800,11 +1846,6 @@ video {
1800
1846
  border-color: rgb(209 213 219 / var(--tw-border-opacity, 1));
1801
1847
  }
1802
1848
 
1803
- .cteditor-border-gray-400{
1804
- --tw-border-opacity: 1;
1805
- border-color: rgb(156 163 175 / var(--tw-border-opacity, 1));
1806
- }
1807
-
1808
1849
  .cteditor-border-gray-500{
1809
1850
  --tw-border-opacity: 1;
1810
1851
  border-color: rgb(107 114 128 / var(--tw-border-opacity, 1));
@@ -1897,6 +1938,10 @@ video {
1897
1938
  background-color: hsl(var(--cteditorf47ac10b-foreground) / 0.1) !important;
1898
1939
  }
1899
1940
 
1941
+ .\!cteditor-bg-foreground\/15{
1942
+ background-color: hsl(var(--cteditorf47ac10b-foreground) / 0.15) !important;
1943
+ }
1944
+
1900
1945
  .\!cteditor-bg-foreground\/5{
1901
1946
  background-color: hsl(var(--cteditorf47ac10b-foreground) / 0.05) !important;
1902
1947
  }
@@ -1991,6 +2036,10 @@ video {
1991
2036
  background-color: hsl(var(--cteditorf47ac10b-destructive) / 0.1);
1992
2037
  }
1993
2038
 
2039
+ .cteditor-bg-foreground{
2040
+ background-color: hsl(var(--cteditorf47ac10b-foreground));
2041
+ }
2042
+
1994
2043
  .cteditor-bg-foreground\/15{
1995
2044
  background-color: hsl(var(--cteditorf47ac10b-foreground) / 0.15);
1996
2045
  }
@@ -2003,6 +2052,14 @@ video {
2003
2052
  background-color: hsl(var(--cteditorf47ac10b-foreground) / 0.05);
2004
2053
  }
2005
2054
 
2055
+ .cteditor-bg-foreground\/90{
2056
+ background-color: hsl(var(--cteditorf47ac10b-foreground) / 0.9);
2057
+ }
2058
+
2059
+ .cteditor-bg-foreground\/\[0\.02\]{
2060
+ background-color: hsl(var(--cteditorf47ac10b-foreground) / 0.02);
2061
+ }
2062
+
2006
2063
  .cteditor-bg-gray-100{
2007
2064
  --tw-bg-opacity: 1;
2008
2065
  background-color: rgb(243 244 246 / var(--tw-bg-opacity, 1));
@@ -2053,10 +2110,6 @@ video {
2053
2110
  background-color: hsl(var(--cteditorf47ac10b-primary) / 0.1);
2054
2111
  }
2055
2112
 
2056
- .cteditor-bg-primary\/20{
2057
- background-color: hsl(var(--cteditorf47ac10b-primary) / 0.2);
2058
- }
2059
-
2060
2113
  .cteditor-bg-primary\/5{
2061
2114
  background-color: hsl(var(--cteditorf47ac10b-primary) / 0.05);
2062
2115
  }
@@ -2253,6 +2306,11 @@ video {
2253
2306
  padding-right: 0.25rem !important;
2254
2307
  }
2255
2308
 
2309
+ .\!cteditor-px-2{
2310
+ padding-left: 0.5rem !important;
2311
+ padding-right: 0.5rem !important;
2312
+ }
2313
+
2256
2314
  .\!cteditor-py-0\.5{
2257
2315
  padding-top: 0.125rem !important;
2258
2316
  padding-bottom: 0.125rem !important;
@@ -2447,10 +2505,6 @@ video {
2447
2505
  font-size: 13px;
2448
2506
  }
2449
2507
 
2450
- .cteditor-text-\[15px\]{
2451
- font-size: 15px;
2452
- }
2453
-
2454
2508
  .cteditor-text-\[9px\]{
2455
2509
  font-size: 9px;
2456
2510
  }
@@ -2549,11 +2603,6 @@ video {
2549
2603
  color: rgb(180 83 9 / var(--tw-text-opacity, 1)) !important;
2550
2604
  }
2551
2605
 
2552
- .cteditor-text-\[\#9e9e9e\]{
2553
- --tw-text-opacity: 1;
2554
- color: rgb(158 158 158 / var(--tw-text-opacity, 1));
2555
- }
2556
-
2557
2606
  .cteditor-text-amber-600{
2558
2607
  --tw-text-opacity: 1;
2559
2608
  color: rgb(217 119 6 / var(--tw-text-opacity, 1));
@@ -2883,6 +2932,14 @@ video {
2883
2932
  box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000);
2884
2933
  }
2885
2934
 
2935
+ .cteditor-ring-background{
2936
+ --tw-ring-color: hsl(var(--cteditorf47ac10b-background));
2937
+ }
2938
+
2939
+ .cteditor-ring-foreground{
2940
+ --tw-ring-color: hsl(var(--cteditorf47ac10b-foreground));
2941
+ }
2942
+
2886
2943
  .cteditor-ring-primary\/20{
2887
2944
  --tw-ring-color: hsl(var(--cteditorf47ac10b-primary) / 0.2);
2888
2945
  }
@@ -3277,6 +3334,15 @@ body .ai-chat-popup .ai-chat-input {
3277
3334
  scrollbar-width: none; /* Firefox */
3278
3335
  }
3279
3336
 
3337
+ body .EmojiPickerReact{
3338
+ --epr-bg-color: hsl(var(--cteditorf47ac10b-background) / 0.5);
3339
+ --epr-picker-border-color:hsl(var(--cteditorf47ac10b-foreground) / 0.2);
3340
+ --epr-search-input-bg-color:hsl(var(--cteditorf47ac10b-background));
3341
+ --epr-search-border-color:hsl(var(--cteditorf47ac10b-foreground) / 0.2);
3342
+ --epr-category-label-bg-color:hsl(var(--cteditorf47ac10b-foreground) / 0.03);
3343
+ --epr-category-label-text-color:hsl(var(--cteditorf47ac10b-foreground));
3344
+ }
3345
+
3280
3346
  .\*\:cteditor-size-5 > *{
3281
3347
  width: 1.25rem;
3282
3348
  height: 1.25rem;
@@ -3408,6 +3474,10 @@ body .ai-chat-popup .ai-chat-input {
3408
3474
  background-color: hsl(var(--cteditorf47ac10b-foreground) / 0.05);
3409
3475
  }
3410
3476
 
3477
+ .hover\:cteditor-bg-foreground\/\[0\.04\]:hover{
3478
+ background-color: hsl(var(--cteditorf47ac10b-foreground) / 0.04);
3479
+ }
3480
+
3411
3481
  .hover\:cteditor-bg-gray-100:hover{
3412
3482
  --tw-bg-opacity: 1;
3413
3483
  background-color: rgb(243 244 246 / var(--tw-bg-opacity, 1));
@@ -4111,8 +4181,12 @@ body .ai-chat-popup .ai-chat-input {
4111
4181
  width: 28rem;
4112
4182
  }
4113
4183
 
4114
- .sm\:cteditor-w-\[400px\]{
4115
- width: 400px;
4184
+ .sm\:cteditor-max-w-\[500px\]{
4185
+ max-width: 500px;
4186
+ }
4187
+
4188
+ .sm\:cteditor-max-w-lg{
4189
+ max-width: 32rem;
4116
4190
  }
4117
4191
 
4118
4192
  .sm\:cteditor-max-w-md{
@@ -4284,6 +4358,10 @@ body .ai-chat-popup .ai-chat-input {
4284
4358
  opacity: 0.5;
4285
4359
  }
4286
4360
 
4361
+ .\[\&\>div\>input\]\:\!cteditor-w-5>div>input{
4362
+ width: 1.25rem !important;
4363
+ }
4364
+
4287
4365
  .\[\&\>hr\]\:cteditor-h-\[2px\]>hr{
4288
4366
  height: 2px;
4289
4367
  }
@@ -4366,8 +4444,6 @@ body .ai-chat-popup .ai-chat-input {
4366
4444
  .\[\&_svg\]\:cteditor-shrink-0 svg{
4367
4445
  flex-shrink: 0;
4368
4446
  }
4369
-
4370
-
4371
4447
  #ct-editor-f47ac10b {
4372
4448
  /* Responsive container styles for constrained spaces */
4373
4449
  .editor-container {
@@ -1,8 +1,16 @@
1
1
  import { default as React } from 'react';
2
+ export interface CurrentUser {
3
+ id: string;
4
+ name: string;
5
+ email?: string;
6
+ avatar?: string;
7
+ }
2
8
  export interface Comment {
3
9
  id: string;
4
10
  text: string;
5
11
  author: string;
12
+ authorId?: string;
13
+ authorAvatar?: string;
6
14
  timestamp: number;
7
15
  status: "open" | "resolved";
8
16
  replies: Reply[];
@@ -12,10 +20,13 @@ export interface Reply {
12
20
  id: string;
13
21
  text: string;
14
22
  author: string;
23
+ authorId?: string;
24
+ authorAvatar?: string;
15
25
  timestamp: number;
16
26
  }
17
27
  interface CommentContextType {
18
28
  comments: Comment[];
29
+ currentUser: CurrentUser | null;
19
30
  addComment: (comment: Omit<Comment, "id" | "timestamp" | "status" | "replies">) => string;
20
31
  updateComment: (id: string, updates: Partial<Comment>) => void;
21
32
  deleteComment: (id: string) => void;
@@ -26,6 +37,7 @@ interface CommentContextType {
26
37
  export declare const useComments: () => CommentContextType;
27
38
  interface CommentProviderProps {
28
39
  children: React.ReactNode;
40
+ currentUser?: CurrentUser | null;
29
41
  }
30
42
  export declare const CommentProvider: React.FC<CommentProviderProps>;
31
43
  export {};
@@ -4,7 +4,7 @@ var __publicField = (obj, key, value) => {
4
4
  __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
5
  return value;
6
6
  };
7
- import { g as getDefaultExportFromCjs, c as commonjsGlobal } from "./index-ca05509b.js";
7
+ import { g as getDefaultExportFromCjs, c as commonjsGlobal } from "./index-78acd11a.js";
8
8
  function _mergeNamespaces(n, m) {
9
9
  for (var i = 0; i < m.length; i++) {
10
10
  const e = m[i];
@@ -46125,4 +46125,4 @@ const html2pdf_bundle$1 = /* @__PURE__ */ _mergeNamespaces({
46125
46125
  export {
46126
46126
  html2pdf_bundle$1 as h
46127
46127
  };
46128
- //# sourceMappingURL=html2pdf.bundle-f2c10c61.js.map
46128
+ //# sourceMappingURL=html2pdf.bundle-83da4814.js.map