rj-editor 0.1.1 → 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.
Files changed (147) hide show
  1. package/README.md +313 -22
  2. package/dist/assets/icons/AttachmentIcon01.d.ts +2 -0
  3. package/dist/assets/icons/BorderRadiusIcon.d.ts +2 -0
  4. package/dist/assets/icons/ChevronSelectorHorizontalIcon.d.ts +2 -0
  5. package/dist/assets/icons/ChevronSelectorVerticalIcon.d.ts +2 -0
  6. package/dist/assets/icons/ImageIcon03.d.ts +2 -0
  7. package/dist/assets/icons/ImageIdentLeftIcon.d.ts +2 -0
  8. package/dist/assets/icons/ImageWrapTopBottomIcon.d.ts +2 -0
  9. package/dist/assets/icons/LayoutGridIcon01.d.ts +2 -0
  10. package/dist/assets/icons/LeftIndentIcon01.d.ts +2 -0
  11. package/dist/assets/icons/LineHeightIcon.d.ts +2 -0
  12. package/dist/assets/icons/MaximizeIcon02.d.ts +2 -0
  13. package/dist/assets/icons/MinimizeIcon02.d.ts +2 -0
  14. package/dist/assets/icons/PaintPourIcon.d.ts +2 -0
  15. package/dist/assets/icons/PaletteIcon.d.ts +2 -0
  16. package/dist/assets/icons/ParagraphSpacingIco.d.ts +2 -0
  17. package/dist/assets/icons/RefreshCcwIcon01.d.ts +2 -0
  18. package/dist/assets/icons/RefreshCcwIcon05.d.ts +2 -0
  19. package/dist/assets/icons/RefreshCwIcon01.d.ts +2 -0
  20. package/dist/assets/icons/RightIndentIcon01.d.ts +2 -0
  21. package/dist/assets/icons/SubscriptIcon.d.ts +2 -0
  22. package/dist/assets/icons/SupscriptIcon.d.ts +2 -0
  23. package/dist/assets/icons/TrashIcon03.d.ts +2 -0
  24. package/dist/assets/icons/VerticalAlignBottomIcon.d.ts +2 -0
  25. package/dist/assets/icons/VerticalAlignMiddleIcon.d.ts +2 -0
  26. package/dist/assets/icons/VerticalAlignTopIcon.d.ts +2 -0
  27. package/dist/assets/icons/YoutubeIcon.d.ts +2 -0
  28. package/dist/components/RJTextEditor.d.ts +3 -9
  29. package/dist/components/equation/EquationComponent.d.ts +10 -0
  30. package/dist/components/global/input-number/InputNumber.d.ts +14 -0
  31. package/dist/components/global/input-number/index.d.ts +2 -0
  32. package/dist/components/global/modal/Modal.d.ts +12 -0
  33. package/dist/components/global/modal/index.d.ts +2 -0
  34. package/dist/components/image/ImageComponent.d.ts +21 -0
  35. package/dist/components/rj-text-editor/HtmlValuePlugin.d.ts +7 -0
  36. package/dist/components/rj-text-editor/RJTextEditor.types.d.ts +18 -0
  37. package/dist/components/rj-text-editor/RJTextEditorContent.d.ts +17 -0
  38. package/dist/components/rj-text-editor/createInitialConfig.d.ts +47 -0
  39. package/dist/components/rj-text-editor/editorTheme.d.ts +26 -0
  40. package/dist/components/rj-text-editor/handleEditorChange.d.ts +3 -0
  41. package/dist/components/toolbar/Toolbar.d.ts +6 -1
  42. package/dist/components/toolbar/equation/EquationToolbar.d.ts +1 -0
  43. package/dist/components/toolbar/equation/utils.d.ts +13 -0
  44. package/dist/components/toolbar/home/HomeToolbar.d.ts +6 -0
  45. package/dist/components/toolbar/home/indent/IndentControls.d.ts +1 -0
  46. package/dist/components/toolbar/home/spacing/SpacingControls.d.ts +1 -0
  47. package/dist/components/toolbar/image/ImageToolbar.d.ts +2 -0
  48. package/dist/components/toolbar/image/divider/ToolbarDivider.d.ts +1 -0
  49. package/dist/components/toolbar/image/utils.d.ts +26 -0
  50. package/dist/components/toolbar/insert/InsertToolbar.d.ts +5 -0
  51. package/dist/components/toolbar/insert/divider/ToolbarDivider.d.ts +1 -0
  52. package/dist/components/toolbar/insert/equation/EquationControl.d.ts +2 -0
  53. package/dist/components/toolbar/insert/equation/EquationExamples.d.ts +6 -0
  54. package/dist/components/toolbar/insert/equation/EquationModal.d.ts +11 -0
  55. package/dist/components/toolbar/insert/equation/EquationPreview.d.ts +8 -0
  56. package/dist/components/toolbar/insert/horizontal-rule/HorizontalRuleControl.d.ts +1 -0
  57. package/dist/components/toolbar/insert/image/ImageControl.d.ts +1 -0
  58. package/dist/components/toolbar/insert/link/LinkControl.d.ts +7 -0
  59. package/dist/components/toolbar/insert/table/TableControl.d.ts +5 -0
  60. package/dist/components/toolbar/insert/youtube/YouTubeControl.d.ts +2 -0
  61. package/dist/components/toolbar/layout/LayoutToolbar.d.ts +1 -0
  62. package/dist/components/toolbar/table/TableToolbar.d.ts +1 -0
  63. package/dist/components/toolbar/table/cell/CellControls.d.ts +1 -0
  64. package/dist/components/toolbar/table/columns/ColumnControls.d.ts +1 -0
  65. package/dist/components/toolbar/table/delete/DeleteTableControls.d.ts +1 -0
  66. package/dist/components/toolbar/table/divider/ToolbarDivider.d.ts +1 -0
  67. package/dist/components/toolbar/table/header-cell/HeaderCellControls.d.ts +1 -0
  68. package/dist/components/toolbar/table/merge/MergeControls.d.ts +1 -0
  69. package/dist/components/toolbar/table/rows/RowControls.d.ts +1 -0
  70. package/dist/components/toolbar/table/utils.d.ts +23 -0
  71. package/dist/components/youtube/YouTubeComponent.d.ts +9 -0
  72. package/dist/constants/equationEditorEventName.d.ts +1 -0
  73. package/dist/constants/equationExamples.d.ts +16 -0
  74. package/dist/constants/equationStructures.d.ts +33 -0
  75. package/dist/constants/equationSymbols.d.ts +1 -0
  76. package/dist/constants/index.d.ts +10 -0
  77. package/dist/constants/insertEquationCommand.d.ts +2 -0
  78. package/dist/constants/insertImageCommand.d.ts +2 -0
  79. package/dist/constants/insertYouTubeCommand.d.ts +2 -0
  80. package/dist/constants/lineHeightOptions.d.ts +1 -0
  81. package/dist/constants/maxImageFileSize.d.ts +1 -0
  82. package/dist/constants/openLinkModalEventName.d.ts +1 -0
  83. package/dist/i18n/I18nContext.d.ts +9 -0
  84. package/dist/i18n/RJEditorI18nContext.d.ts +3 -0
  85. package/dist/i18n/index.d.ts +6 -0
  86. package/dist/i18n/locales/en.d.ts +2 -0
  87. package/dist/i18n/locales/ru.d.ts +2 -0
  88. package/dist/i18n/locales/uz.d.ts +2 -0
  89. package/dist/i18n/mergeTranslations.d.ts +2 -0
  90. package/dist/i18n/useRJEditorI18n.d.ts +1 -0
  91. package/dist/index.d.ts +2 -1
  92. package/dist/nodes/EquationNode.d.ts +26 -0
  93. package/dist/nodes/ExtendedTextNode.d.ts +12 -0
  94. package/dist/nodes/ImageNode.d.ts +62 -0
  95. package/dist/nodes/YouTubeNode.d.ts +25 -0
  96. package/dist/nodes/index.d.ts +4 -0
  97. package/dist/plugins/EquationPlugin.d.ts +1 -0
  98. package/dist/plugins/ImagePlugin.d.ts +1 -0
  99. package/dist/plugins/KeyboardShortcutsPlugin.d.ts +1 -0
  100. package/dist/plugins/TableBoundaryPlugin.d.ts +1 -0
  101. package/dist/plugins/YouTubePlugin.d.ts +1 -0
  102. package/dist/rj-editor.css +1 -1
  103. package/dist/rj-editor.js +32116 -555
  104. package/dist/rj-editor.umd.cjs +259 -1
  105. package/dist/slice/index.d.ts +1 -1
  106. package/dist/slice/toolbarSlice.d.ts +1 -1
  107. package/dist/types/DeepPartial.d.ts +3 -0
  108. package/dist/types/EquationDisplayMode.d.ts +1 -0
  109. package/dist/types/ImageAlignment.d.ts +1 -0
  110. package/dist/types/ImageObjectFit.d.ts +1 -0
  111. package/dist/types/ImageTextWrap.d.ts +1 -0
  112. package/dist/types/InsertEquationPayload.d.ts +5 -0
  113. package/dist/types/InsertImagePayload.d.ts +19 -0
  114. package/dist/types/InsertYouTubePayload.d.ts +4 -0
  115. package/dist/types/RJEditorLocaleCode.d.ts +1 -0
  116. package/dist/types/RJEditorTranslations.d.ts +173 -0
  117. package/dist/types/SerializedEquationNode.d.ts +6 -0
  118. package/dist/types/SerializedImageNode.d.ts +20 -0
  119. package/dist/types/SerializedYouTubeNode.d.ts +5 -0
  120. package/dist/types/ToolbarState.d.ts +35 -0
  121. package/dist/types/index.d.ts +13 -0
  122. package/dist/utils/helpers/clampValue.d.ts +1 -0
  123. package/dist/utils/helpers/formatNumberText.d.ts +1 -0
  124. package/dist/utils/helpers/formatShortcutTitle.d.ts +1 -0
  125. package/dist/utils/helpers/getYouTubeVideoId.d.ts +1 -0
  126. package/dist/utils/helpers/index.d.ts +12 -0
  127. package/dist/utils/helpers/isApplePlatform.d.ts +1 -0
  128. package/dist/utils/helpers/normalizeNumberText.d.ts +1 -0
  129. package/dist/utils/helpers/normalizeRJEditorHtml.d.ts +2 -0
  130. package/dist/utils/helpers/numberToInputText.d.ts +1 -0
  131. package/dist/utils/helpers/openFilePicker.d.ts +1 -0
  132. package/dist/utils/helpers/readFileAsDataUrl.d.ts +1 -0
  133. package/dist/utils/helpers/renderEquationToHtml.d.ts +3 -0
  134. package/dist/utils/helpers/setEditorHtml.d.ts +2 -0
  135. package/package.json +33 -1
  136. /package/dist/components/toolbar/{alignment → home/alignment}/AlignmentControls.d.ts +0 -0
  137. /package/dist/components/toolbar/{divider → home/divider}/ToolbarDivider.d.ts +0 -0
  138. /package/dist/components/toolbar/{history → home/history}/HistoryControls.d.ts +0 -0
  139. /package/dist/components/toolbar/{list → home/list}/ListControls.d.ts +0 -0
  140. /package/dist/components/toolbar/{style-controls → home/style-controls}/StyleControls.d.ts +0 -0
  141. /package/dist/components/toolbar/{style-controls → home/style-controls}/background-color/BackgroundColorControl.d.ts +0 -0
  142. /package/dist/components/toolbar/{style-controls → home/style-controls}/clear-formatting/ClearFormattingControl.d.ts +0 -0
  143. /package/dist/components/toolbar/{style-controls → home/style-controls}/font-family/FontFamilyControl.d.ts +0 -0
  144. /package/dist/components/toolbar/{style-controls → home/style-controls}/font-size/FontSizeControl.d.ts +0 -0
  145. /package/dist/components/toolbar/{style-controls → home/style-controls}/text-color/TextColorControl.d.ts +0 -0
  146. /package/dist/components/toolbar/{style-controls → home/style-controls}/utils.d.ts +0 -0
  147. /package/dist/components/toolbar/{text-format → home/text-format}/TextFormatControls.d.ts +0 -0
package/README.md CHANGED
@@ -1,51 +1,342 @@
1
1
  # RJ Editor
2
2
 
3
- Lexical asosida qurilgan React rich text editor komponenti.
3
+ `rj-editor` - React uchun qurilgan rich text editor kutubxonasi. U maqola yozish, admin panel, CMS, blog, ta'lim platformasi yoki hujjatga yaqin matn kiritish tajribasi kerak bo'lgan React loyihalar uchun mo'ljallangan.
4
4
 
5
- ## Install
5
+ Editor bitta `RJTextEditor` komponenti orqali matn formatlash, jadval, link, rasm, YouTube video, fullscreen, i18n, theme va Ant Design Form integratsiyasini beradi.
6
+
7
+ ## Demo
8
+
9
+ `RJTextEditor` imkoniyatlarini live demo orqali sinab ko'rish mumkin. Demo editorni Ant Design `Form.Item` ichida ishlatadi, `onChange` orqali HTML outputni ko'rsatadi va form submit qilinganda editor qiymatini preview sifatida chiqaradi.
10
+
11
+ **Live demo:** [https://rj-editor.vercel.app](https://rj-editor.vercel.app)
12
+
13
+ Demo'ni lokal ishga tushirish:
14
+
15
+ ```bash
16
+ git clone https://github.com/RavshanJumaqulov/rj-editor.git
17
+ cd rj-editor
18
+ npm install
19
+ npm run dev
20
+ ```
21
+
22
+ Keyin browserda Vite ko'rsatgan lokal manzilni oching. Odatda:
23
+
24
+ ```txt
25
+ http://localhost:5173
26
+ ```
27
+
28
+ Demo sahifada quyidagilarni tekshirish mumkin:
29
+
30
+ - `RJTextEditor`ni oddiy component sifatida ishlatish;
31
+ - Ant Design `Form.Item` bilan qiymat yig'ish;
32
+ - HTML outputni real vaqt rejimida olish;
33
+ - table, image, link, YouTube, fullscreen va contextual toolbarlarni sinash;
34
+ - `defaultValue`/`value` orqali saqlangan HTML kontentni qayta editorga yuklash.
35
+
36
+ Demo kodi: [`src/App.tsx`](https://github.com/RavshanJumaqulov/rj-editor/blob/main/src/App.tsx)
37
+
38
+ ## Imkoniyatlar
39
+
40
+ - Rich text: bold, italic, underline, strikethrough, subscript, superscript.
41
+ - Style controls: font size, font family, text color, background color, clear formatting.
42
+ - Paragraph tools: alignment, ordered/unordered list, indent/outdent, line and paragraph spacing.
43
+ - Insert tools: table, link, image, YouTube video.
44
+ - Table tools: row/column qo'shish va o'chirish, merge/split, header row/column, cell background, vertical alignment, table delete.
45
+ - Image tools: local image upload, drag-and-drop, paste from clipboard, base64 saqlash, resize, alignment, alt text, caption, link, border, radius, shadow, crop mode, wrapping, rotate, replace, delete.
46
+ - Browser fullscreen mode.
47
+ - Ant Design `Form.Item` bilan ishlash.
48
+ - `uz`, `en`, `ru` lokalizatsiya va custom translation qo'shish.
49
+ - Theme qilish uchun CSS custom property'lar.
50
+
51
+ ## O'rnatish
6
52
 
7
53
  ```bash
8
54
  npm install rj-editor
9
55
  ```
10
56
 
11
- ## Usage
57
+ React va ReactDOM peer dependency hisoblanadi. Loyihangizda ular o'rnatilgan bo'lishi kerak.
58
+
59
+ ```bash
60
+ npm install react react-dom
61
+ ```
62
+
63
+ ## Tez Boshlash
12
64
 
13
65
  ```tsx
14
- import { RJTextEditor } from 'rj-editor'
15
- import 'rj-editor/style.css'
66
+ import { RJTextEditor } from "rj-editor";
16
67
 
17
68
  export function App() {
18
69
  return (
19
70
  <RJTextEditor
20
71
  autofocus
21
- onChange={(value) => {
22
- console.log(value.html)
23
- console.log(value.json)
72
+ locale="uz"
73
+ placeholder="Maqolangizni shu yerga yozing..."
74
+ onChange={(html) => {
75
+ console.log(html);
24
76
  }}
25
- placeholder="Matn yozing..."
26
77
  />
27
- )
78
+ );
28
79
  }
29
80
  ```
30
81
 
31
- ## Props
82
+ Style faylni alohida import qilish shart emas. `RJTextEditor` import qilinganda kutubxona style'lari build ichida ulanadi.
32
83
 
33
- ```ts
34
- type RJTextEditorProps = {
35
- autofocus?: boolean
36
- className?: string
37
- namespace?: string
38
- onChange?: (value: RJTextEditorValue) => void
39
- placeholder?: string
84
+ ## Default Value
85
+
86
+ Editorga dastlabki HTML qiymat berish mumkin.
87
+
88
+ ```tsx
89
+ <RJTextEditor
90
+ defaultValue="<p>Salom, dunyo!</p>"
91
+ onChange={(html) => console.log(html)}
92
+ />
93
+ ```
94
+
95
+ ## Controlled Value
96
+
97
+ `value` prop orqali editorni controlled holatda ishlatish mumkin. `onChange` signature o'zgarmaydi: birinchi argument doim HTML string bo'ladi.
98
+
99
+ ```tsx
100
+ import { useState } from "react";
101
+ import { RJTextEditor } from "rj-editor";
102
+
103
+ export function App() {
104
+ const [content, setContent] = useState("<p>Dastlabki matn</p>");
105
+
106
+ return <RJTextEditor value={content} onChange={(html) => setContent(html)} />;
107
+ }
108
+ ```
109
+
110
+ ## Ant Design Form Bilan Ishlatish
111
+
112
+ `RJTextEditor` Ant Design `Form.Item` ichida oddiy input kabi ishlaydi. Form `name` bo'yicha editor HTML qiymatini yig'adi.
113
+
114
+ ```tsx
115
+ import { Button, Form } from "antd";
116
+ import { RJTextEditor } from "rj-editor";
117
+
118
+ export function ArticleForm() {
119
+ return (
120
+ <Form
121
+ layout="vertical"
122
+ onFinish={(values) => {
123
+ console.log(values.content);
124
+ }}
125
+ >
126
+ <Form.Item
127
+ label="Maqola"
128
+ name="content"
129
+ rules={[{ required: true, message: "Maqola matnini kiriting" }]}
130
+ >
131
+ <RJTextEditor placeholder="Maqolangizni yozing..." />
132
+ </Form.Item>
133
+
134
+ <Button htmlType="submit" type="primary">
135
+ Saqlash
136
+ </Button>
137
+ </Form>
138
+ );
40
139
  }
41
140
  ```
42
141
 
43
- ## Style
142
+ Validatsiya xatolik holatida editor borderi Ant Design error rangiga kiradi.
143
+
144
+ ## Props
145
+
146
+ | Prop | Type | Default | Izoh |
147
+ | -------------- | --------------------------------------------------- | -------------------- | ---------------------------------------------------------------------- |
148
+ | `autofocus` | `boolean` | `false` | Editor ochilganda avtomatik focus beradi. |
149
+ | `className` | `string` | `undefined` | Root editor wrapper uchun qo'shimcha class. |
150
+ | `defaultValue` | `string` | `undefined` | Editorning dastlabki HTML qiymati. |
151
+ | `id` | `string` | `undefined` | Root editor wrapper uchun `id`. Form.Item bilan kelganda ham ishlaydi. |
152
+ | `locale` | `'uz' \| 'en' \| 'ru' \| string` | `'uz'` | Editor tili. |
153
+ | `locales` | `Record<string, DeepPartial<RJEditorTranslations>>` | `undefined` | Qo'shimcha custom locale'lar. |
154
+ | `namespace` | `string` | `'RJEditor'` | Editor instance uchun namespace qiymati. |
155
+ | `onBlur` | `React.FocusEventHandler<HTMLDivElement>` | `undefined` | Root wrapper blur eventi. |
156
+ | `onChange` | `(html, json, editorState) => void` | `undefined` | Editor kontenti o'zgarganda chaqiriladi. |
157
+ | `onFocus` | `React.FocusEventHandler<HTMLDivElement>` | `undefined` | Root wrapper focus eventi. |
158
+ | `placeholder` | `string` | Locale bo'yicha matn | Bo'sh editor ichida ko'rinadigan matn. |
159
+ | `translations` | `DeepPartial<RJEditorTranslations>` | `undefined` | Joriy locale tarjimalarini qisman override qilish. |
160
+ | `value` | `string` | `undefined` | Controlled HTML qiymat. |
161
+
162
+ ## onChange
44
163
 
45
- Paket CSS faylini alohida import qiladi:
164
+ `onChange` uchta argument qaytaradi:
46
165
 
47
166
  ```ts
48
- import 'rj-editor/style.css'
167
+ type OnChange = (
168
+ html: string,
169
+ json: string,
170
+ editorState: unknown,
171
+ ) => void;
172
+ ```
173
+
174
+ - `html` - kontentning HTML string ko'rinishi. Serverga saqlash va keyin `defaultValue` yoki `value` sifatida qayta berish uchun qulay.
175
+ - `json` - editor holatining JSON string ko'rinishi.
176
+ - `editorState` - editorning joriy runtime holati.
177
+
178
+ ## Toolbar
179
+
180
+ Toolbar tablar asosida ishlaydi:
181
+
182
+ - `Home` - asosiy text formatlash va paragraph tool'lar.
183
+ - `Insert` - table, link, image va YouTube video qo'shish.
184
+ - `Image` - rasm tanlanganda chiqadigan contextual tab.
185
+ - `Table` - cursor table ichida bo'lganda chiqadigan contextual tab.
186
+
187
+ `Image` va `Table` tablari faqat kerakli context mavjud bo'lganda ko'rinadi. Bu Word'dagi contextual toolbar tajribasiga yaqinroq UX beradi.
188
+
189
+ ## Rasm Bilan Ishlash
190
+
191
+ Rasm hozircha serverga yuklanmaydi. Local fayl tanlanganda, drag-and-drop qilinganda yoki clipboard'dan paste qilinganda rasm `base64` ko'rinishida editor ichidagi image node `src` qiymatiga yoziladi.
192
+
193
+ Muhim cheklovlar:
194
+
195
+ - Maksimal rasm hajmi: `5MB`.
196
+ - Base64 HTML/JSON hajmini oshiradi.
197
+ - Katta production loyihalarda keyinchalik server upload yoki storage adapter qo'shish tavsiya qilinadi.
198
+
199
+ Mavjud image amallari:
200
+
201
+ - alignment: left, center, right;
202
+ - width percent qiymati;
203
+ - 25%, 50%, 100% quick resize;
204
+ - alt text;
205
+ - caption;
206
+ - image link;
207
+ - border;
208
+ - border radius;
209
+ - shadow;
210
+ - object fit: contain, cover, fill;
211
+ - text wrapping: top-bottom va square;
212
+ - rotate left/right;
213
+ - replace image;
214
+ - delete image.
215
+
216
+ ## Table Bilan Ishlash
217
+
218
+ `Insert > Table` orqali jadvalni grid selector yordamida yoki row/column qiymatlarini qo'lda kiritib yaratish mumkin. Table ichida cursor turganda `Table` tab avtomatik ko'rinadi.
219
+
220
+ Mavjud table amallari:
221
+
222
+ - row/column qo'shish;
223
+ - row/column o'chirish;
224
+ - cell merge/split;
225
+ - header row/header column;
226
+ - cell background;
227
+ - vertical alignment;
228
+ - table delete.
229
+
230
+ ## Link Qo'shish
231
+
232
+ Link qo'shish browser `prompt` orqali emas, kutubxona ichidagi custom `Modal` orqali ishlaydi. Modal fullscreen holatida ham to'g'ri layer'da ochiladi va draggable.
233
+
234
+ ## YouTube Video Qo'shish
235
+
236
+ `Insert` tab orqali YouTube video linkini kiritish mumkin. Editor YouTube URL'dan video id ni ajratib olib, embed iframe ko'rinishida joylaydi.
237
+
238
+ ## Fullscreen
239
+
240
+ Toolbar yuqori o'ng qismidagi fullscreen tugmasi browser Fullscreen API orqali editorni fullscreen holatiga o'tkazadi. Bu faqat CSS bilan kattalashtirish emas, browser miqyosidagi fullscreen rejimidir.
241
+
242
+ ## I18n
243
+
244
+ Kutubxona ichida `uz`, `en`, `ru` tarjimalar mavjud.
245
+
246
+ ```tsx
247
+ <RJTextEditor locale="uz" />
248
+ <RJTextEditor locale="en" />
249
+ <RJTextEditor locale="ru" />
250
+ ```
251
+
252
+ Joriy locale tarjimalarini qisman override qilish:
253
+
254
+ ```tsx
255
+ <RJTextEditor
256
+ locale="uz"
257
+ translations={{
258
+ placeholders: {
259
+ editor: "Matnni shu yerga kiriting...",
260
+ },
261
+ }}
262
+ />
263
+ ```
264
+
265
+ Yangi locale qo'shish:
266
+
267
+ ```tsx
268
+ <RJTextEditor
269
+ locale="kaa"
270
+ locales={{
271
+ kaa: {
272
+ placeholders: {
273
+ editor: "Maqalanı usı jerge jazıń...",
274
+ },
275
+ tabs: {
276
+ home: "Bas bet",
277
+ insert: "Qosıw",
278
+ },
279
+ },
280
+ }}
281
+ />
282
+ ```
283
+
284
+ ## Theme
285
+
286
+ Kutubxona ranglarni CSS custom property sifatida chiqaradi. Loyihangizda theme qilish uchun `--rj-*` o'zgaruvchilarini override qiling.
287
+
288
+ ```scss
289
+ :root {
290
+ --rj-color-brand: #2563eb;
291
+ --rj-color-brand-tint: #eaf2ff;
292
+ --rj-color-surface: #ffffff;
293
+ --rj-color-surface-soft: #f8fafc;
294
+ --rj-color-border: #d9dde5;
295
+ --rj-color-text: #111827;
296
+
297
+ --rj-editor-bg: var(--rj-color-surface);
298
+ --rj-editor-border: var(--rj-color-border);
299
+ --rj-editor-text: var(--rj-color-text);
300
+ --rj-editor-toolbar-bg: var(--rj-color-surface-soft);
301
+ }
49
302
  ```
50
303
 
51
- Theme qilish uchun `--rj-*` CSS variable qiymatlarini override qilish mumkin.
304
+ Ko'p ishlatiladigan variable'lar:
305
+
306
+ | Variable | Vazifasi |
307
+ | -------------------------------------- | ------------------------------------- |
308
+ | `--rj-editor-bg` | Editor content background. |
309
+ | `--rj-editor-border` | Editor border rangi. |
310
+ | `--rj-editor-text` | Asosiy text rangi. |
311
+ | `--rj-editor-placeholder` | Placeholder rangi. |
312
+ | `--rj-editor-toolbar-bg` | Toolbar background. |
313
+ | `--rj-editor-toolbar-button-bg` | Toolbar button background. |
314
+ | `--rj-editor-toolbar-button-active-bg` | Active button background. |
315
+ | `--rj-editor-link` | Link rangi. |
316
+ | `--rj-editor-focus-border` | Focus/active border rangi. |
317
+ | `--rj-editor-error-border` | Form validation error border rangi. |
318
+ | `--rj-editor-warning-border` | Form validation warning border rangi. |
319
+ | `--rj-editor-table-border` | Table border rangi. |
320
+ | `--rj-editor-table-header-bg` | Table header background. |
321
+ | `--rj-editor-image-border` | Image selection/border rangi. |
322
+ | `--rj-editor-danger` | Delete/clear action rangi. |
323
+
324
+ ## Browser Support
325
+
326
+ `rj-editor` browser muhitida ishlaydi. SSR loyihalarda komponentni client-only render qilish tavsiya qilinadi, chunki editor DOM, selection, clipboard va Fullscreen API kabi browser imkoniyatlariga tayanadi.
327
+
328
+ ## Publish Checklist
329
+
330
+ Kutubxonani npm'ga chiqarishdan oldin:
331
+
332
+ 1. `npm run lint`
333
+ 2. `npm run build`
334
+ 3. `npm pack --dry-run`
335
+ 4. `package.json` ichida `version` qiymatini yangilash
336
+ 5. `npm publish`
337
+
338
+ Agar npm 2FA yoqilgan bo'lsa, publish uchun OTP yoki 2FA bypass yoqilgan granular access token kerak bo'ladi.
339
+
340
+ ## License
341
+
342
+ License ma'lumoti `package.json` ichida ko'rsatilishi kerak.
@@ -0,0 +1,2 @@
1
+ import React from 'react';
2
+ export default function AttachmentIcon01(props: React.SVGProps<SVGSVGElement>): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import React from 'react';
2
+ export default function BorderRadiusIcon(props: React.SVGProps<SVGSVGElement>): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import React from 'react';
2
+ export default function ChevronSelectorHorizontalIcon(props: React.SVGProps<SVGSVGElement>): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import React from 'react';
2
+ export default function ChevronSelectorVerticalIcon(props: React.SVGProps<SVGSVGElement>): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import React from 'react';
2
+ export default function ImageIcon03(props: React.SVGProps<SVGSVGElement>): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import React from 'react';
2
+ export default function ImageIdentLeftIcon(props: React.SVGProps<SVGSVGElement>): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import React from 'react';
2
+ export default function ImageWrapTopBottomIcon(props: React.SVGProps<SVGSVGElement>): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import React from 'react';
2
+ export default function LayoutGridIcon01(props: React.SVGProps<SVGSVGElement>): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import React from 'react';
2
+ export default function LeftIndentIcon01(props: React.SVGProps<SVGSVGElement>): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import React from 'react';
2
+ export default function LineHeightIcon(props: React.SVGProps<SVGSVGElement>): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import React from 'react';
2
+ export default function MaximizeIcon02(props: React.SVGProps<SVGSVGElement>): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import React from 'react';
2
+ export default function MinimizeIcon02(props: React.SVGProps<SVGSVGElement>): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import React from 'react';
2
+ export default function PaintPourIcon(props: React.SVGProps<SVGSVGElement>): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import React from 'react';
2
+ export default function PaletteIcon(props: React.SVGProps<SVGSVGElement>): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import React from 'react';
2
+ export default function ParagraphSpacingIco(props: React.SVGProps<SVGSVGElement>): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import React from 'react';
2
+ export default function RefreshCcwIcon01(props: React.SVGProps<SVGSVGElement>): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import React from 'react';
2
+ export default function RefreshCcwIcon05(props: React.SVGProps<SVGSVGElement>): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import React from 'react';
2
+ export default function RefreshCwIcon01(props: React.SVGProps<SVGSVGElement>): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import React from 'react';
2
+ export default function RightIndentIcon01(props: React.SVGProps<SVGSVGElement>): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import React from 'react';
2
+ export default function SubscriptIcon(props: React.SVGProps<SVGSVGElement>): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import React from 'react';
2
+ export default function SupscriptIcon(props: React.SVGProps<SVGSVGElement>): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import React from 'react';
2
+ export default function TrashIcon03(props: React.SVGProps<SVGSVGElement>): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import React from 'react';
2
+ export default function VerticalAlignBottomIcon(props: React.SVGProps<SVGSVGElement>): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import React from 'react';
2
+ export default function VerticalAlignMiddleIcon(props: React.SVGProps<SVGSVGElement>): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import React from 'react';
2
+ export default function VerticalAlignTopIcon(props: React.SVGProps<SVGSVGElement>): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import React from 'react';
2
+ export default function YoutubeIcon(props: React.SVGProps<SVGSVGElement>): import("react/jsx-runtime").JSX.Element;
@@ -1,10 +1,4 @@
1
- import type { RJTextEditorValue } from '@/types';
1
+ import type { RJTextEditorProps } from './rj-text-editor/RJTextEditor.types';
2
2
  import './RJTextEditor.scss';
3
- export type RJTextEditorProps = {
4
- autofocus?: boolean;
5
- className?: string;
6
- namespace?: string;
7
- onChange?: (value: RJTextEditorValue) => void;
8
- placeholder?: string;
9
- };
10
- export declare function RJTextEditor({ autofocus, className, namespace, onChange, placeholder, }: RJTextEditorProps): import("react/jsx-runtime").JSX.Element;
3
+ export type { RJTextEditorProps } from './rj-text-editor/RJTextEditor.types';
4
+ export declare function RJTextEditor({ autofocus, className, defaultValue, id, locale, locales, namespace, onBlur, onChange, onFocus, placeholder, translations, value, }: RJTextEditorProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,10 @@
1
+ import { type NodeKey } from 'lexical';
2
+ import React from 'react';
3
+ import type { EquationDisplayMode } from '@/types';
4
+ type EquationComponentProps = {
5
+ displayMode: EquationDisplayMode;
6
+ equation: string;
7
+ nodeKey: NodeKey;
8
+ };
9
+ export declare const EquationComponent: React.MemoExoticComponent<({ displayMode, equation, nodeKey, }: EquationComponentProps) => import("react/jsx-runtime").JSX.Element>;
10
+ export {};
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+ export type InputNumberProps = Omit<React.InputHTMLAttributes<HTMLInputElement>, 'defaultValue' | 'inputMode' | 'onChange' | 'prefix' | 'suffix' | 'type' | 'value'> & {
3
+ decimalScale?: number;
4
+ defaultValue?: number;
5
+ integerOnly?: boolean;
6
+ locale?: boolean;
7
+ max?: number;
8
+ min?: number;
9
+ onChange?: (value: number) => void;
10
+ prefix?: React.ReactNode;
11
+ suffix?: React.ReactNode;
12
+ value?: number;
13
+ };
14
+ export default function InputNumber({ className, decimalScale, defaultValue, integerOnly, locale, max, min, onBlur, onChange, prefix, suffix, value, ...props }: InputNumberProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ export { default as InputNumber } from './InputNumber';
2
+ export type { InputNumberProps } from './InputNumber';
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ export type ModalProps = {
3
+ cancelText?: string;
4
+ children: React.ReactNode;
5
+ okText?: string;
6
+ onCancel: () => void;
7
+ onOk?: () => void;
8
+ open: boolean;
9
+ title?: React.ReactNode;
10
+ width?: number;
11
+ };
12
+ export declare function Modal({ cancelText, children, okText, onCancel, onOk, open, title, width, }: ModalProps): React.ReactPortal | null;
@@ -0,0 +1,2 @@
1
+ export { Modal } from './Modal';
2
+ export type { ModalProps } from './Modal';
@@ -0,0 +1,21 @@
1
+ import { type NodeKey } from 'lexical';
2
+ import type { ImageAlignment, ImageObjectFit, ImageTextWrap } from '@/types';
3
+ type ImageComponentProps = {
4
+ alignment: ImageAlignment;
5
+ altText: string;
6
+ aspectRatioLocked: boolean;
7
+ borderEnabled: boolean;
8
+ borderRadius: number;
9
+ caption: string;
10
+ height?: number;
11
+ linkUrl: string;
12
+ nodeKey: NodeKey;
13
+ objectFit: ImageObjectFit;
14
+ rotation: number;
15
+ shadowEnabled: boolean;
16
+ src: string;
17
+ textWrap: ImageTextWrap;
18
+ width: number;
19
+ };
20
+ export declare function ImageComponent({ alignment, altText, aspectRatioLocked, borderEnabled, borderRadius, caption, height, linkUrl, nodeKey, objectFit, rotation, shadowEnabled, src, textWrap, width, }: ImageComponentProps): import("react/jsx-runtime").JSX.Element;
21
+ export {};
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ type HtmlValuePluginProps = {
3
+ lastHtmlRef: React.MutableRefObject<string | undefined>;
4
+ value?: string;
5
+ };
6
+ export declare function HtmlValuePlugin({ lastHtmlRef, value, }: HtmlValuePluginProps): null;
7
+ export {};
@@ -0,0 +1,18 @@
1
+ import type React from 'react';
2
+ import type { EditorState } from 'lexical';
3
+ import type { DeepPartial, RJEditorLocaleCode, RJEditorTranslations } from '@/types';
4
+ export type RJTextEditorProps = {
5
+ autofocus?: boolean;
6
+ className?: string;
7
+ defaultValue?: string;
8
+ id?: string;
9
+ namespace?: string;
10
+ onBlur?: React.FocusEventHandler<HTMLDivElement>;
11
+ onChange?: (html: string, json: string, editorState: EditorState) => void;
12
+ onFocus?: React.FocusEventHandler<HTMLDivElement>;
13
+ locale?: RJEditorLocaleCode;
14
+ locales?: Record<string, DeepPartial<RJEditorTranslations>>;
15
+ placeholder?: string;
16
+ translations?: DeepPartial<RJEditorTranslations>;
17
+ value?: string;
18
+ };
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ import type { RJTextEditorProps } from './RJTextEditor.types';
3
+ type RJTextEditorContentProps = {
4
+ autofocus: boolean;
5
+ className?: string;
6
+ editorRef: React.RefObject<HTMLDivElement | null>;
7
+ id?: string;
8
+ isFullscreen: boolean;
9
+ onBlur?: React.FocusEventHandler<HTMLDivElement>;
10
+ onChange?: RJTextEditorProps['onChange'];
11
+ onFocus?: React.FocusEventHandler<HTMLDivElement>;
12
+ onToggleFullscreen: () => void;
13
+ placeholder?: string;
14
+ value?: string;
15
+ };
16
+ export declare function RJTextEditorContent({ autofocus, className, editorRef, id, isFullscreen, onBlur, onChange, onFocus, onToggleFullscreen, placeholder, value, }: RJTextEditorContentProps): import("react/jsx-runtime").JSX.Element;
17
+ export {};
@@ -0,0 +1,47 @@
1
+ import { LinkNode } from '@lexical/link';
2
+ import { ListItemNode, ListNode } from '@lexical/list';
3
+ import { TableCellNode, TableNode, TableRowNode } from '@lexical/table';
4
+ import { TextNode, type LexicalEditor } from 'lexical';
5
+ import { EquationNode, ExtendedTextNode, ImageNode, YouTubeNode, replaceTextNodeWithExtendedTextNode } from '@/nodes';
6
+ type CreateInitialConfigOptions = {
7
+ defaultValue?: string;
8
+ namespace: string;
9
+ value?: string;
10
+ };
11
+ export declare function createInitialConfig({ defaultValue, namespace, value, }: CreateInitialConfigOptions): {
12
+ namespace: string;
13
+ nodes: (typeof EquationNode | typeof ExtendedTextNode | typeof ImageNode | typeof YouTubeNode | typeof LinkNode | typeof ListNode | typeof ListItemNode | typeof TableCellNode | typeof TableNode | typeof TableRowNode | {
14
+ replace: typeof TextNode;
15
+ with: typeof replaceTextNodeWithExtendedTextNode;
16
+ withKlass: typeof ExtendedTextNode;
17
+ })[];
18
+ onError(error: Error): never;
19
+ editorState: ((editor: LexicalEditor) => void) | undefined;
20
+ theme: {
21
+ paragraph: string;
22
+ text: {
23
+ bold: string;
24
+ italic: string;
25
+ strikethrough: string;
26
+ subscript: string;
27
+ superscript: string;
28
+ underline: string;
29
+ };
30
+ list: {
31
+ ol: string;
32
+ ul: string;
33
+ listitem: string;
34
+ };
35
+ equation: string;
36
+ image: string;
37
+ youtube: string;
38
+ table: string;
39
+ tableCell: string;
40
+ tableCellHeader: string;
41
+ tableCellSelected: string;
42
+ tableRow: string;
43
+ tableScrollableWrapper: string;
44
+ tableSelection: string;
45
+ };
46
+ };
47
+ export {};