@react-fabric/lexical 1.0.0-beta.60 → 1.0.0-beta.61

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 (127) hide show
  1. package/dist/cjs/{packages/lexical/src/components → components}/StickyComponent.js +2 -3
  2. package/dist/cjs/{packages/lexical/src/editor → editor}/LexicalEditor.js +5 -5
  3. package/dist/cjs/{packages/lexical/src/hooks → hooks}/useFormatWatcher.js +101 -95
  4. package/dist/cjs/i18n/ar.json.js +24 -0
  5. package/dist/cjs/i18n/en.json.js +24 -0
  6. package/dist/cjs/i18n/index.js +33 -0
  7. package/dist/cjs/{packages/lexical/src/index.js → index.js} +1 -0
  8. package/dist/cjs/{packages/lexical/src/plugins → plugins}/DraggableBlockPlugin.js +5 -5
  9. package/dist/cjs/{packages/lexical/src/plugins → plugins}/ToolbarPlugin.js +35 -22
  10. package/dist/esm/{packages/lexical/src/components → components}/StickyComponent.js +2 -3
  11. package/dist/esm/{packages/lexical/src/editor → editor}/LexicalEditor.js +4 -4
  12. package/dist/esm/{packages/lexical/src/hooks → hooks}/useFormatWatcher.js +43 -37
  13. package/dist/esm/i18n/ar.json.js +21 -0
  14. package/dist/esm/i18n/en.json.js +21 -0
  15. package/dist/esm/i18n/index.js +33 -0
  16. package/dist/esm/{packages/lexical/src/index.js → index.js} +1 -0
  17. package/dist/esm/{packages/lexical/src/plugins → plugins}/DraggableBlockPlugin.js +2 -2
  18. package/dist/esm/{packages/lexical/src/plugins → plugins}/ToolbarPlugin.js +36 -23
  19. package/dist/types/hooks/useFormatWatcher.d.ts +1 -0
  20. package/dist/types/i18n/index.d.ts +1 -0
  21. package/dist/types/index.d.ts +1 -0
  22. package/package.json +5 -5
  23. package/src/components/StickyComponent.tsx +2 -3
  24. package/src/hooks/useFormatWatcher.ts +3 -0
  25. package/src/i18n/ar.json +16 -0
  26. package/src/i18n/en.json +16 -0
  27. package/src/i18n/index.ts +28 -0
  28. package/src/index.ts +2 -0
  29. package/src/plugins/ToolbarPlugin.tsx +34 -23
  30. package/dist/cjs/_virtual/prism.js +0 -5
  31. package/dist/cjs/node_modules/@lexical/clipboard/LexicalClipboard.dev.js +0 -474
  32. package/dist/cjs/node_modules/@lexical/clipboard/LexicalClipboard.js +0 -21
  33. package/dist/cjs/node_modules/@lexical/clipboard/LexicalClipboard.prod.js +0 -27
  34. package/dist/cjs/node_modules/@lexical/code/LexicalCode.dev.js +0 -1537
  35. package/dist/cjs/node_modules/@lexical/code/LexicalCode.js +0 -25
  36. package/dist/cjs/node_modules/@lexical/code/LexicalCode.prod.js +0 -57
  37. package/dist/cjs/node_modules/@lexical/html/LexicalHtml.dev.js +0 -252
  38. package/dist/cjs/node_modules/@lexical/html/LexicalHtml.js +0 -19
  39. package/dist/cjs/node_modules/@lexical/html/LexicalHtml.prod.js +0 -18
  40. package/dist/cjs/node_modules/@lexical/link/LexicalLink.dev.js +0 -572
  41. package/dist/cjs/node_modules/@lexical/link/LexicalLink.js +0 -17
  42. package/dist/cjs/node_modules/@lexical/link/LexicalLink.prod.js +0 -25
  43. package/dist/cjs/node_modules/@lexical/list/LexicalList.dev.js +0 -1614
  44. package/dist/cjs/node_modules/@lexical/list/LexicalList.js +0 -29
  45. package/dist/cjs/node_modules/@lexical/list/LexicalList.prod.js +0 -36
  46. package/dist/cjs/node_modules/@lexical/rich-text/LexicalRichText.dev.js +0 -838
  47. package/dist/cjs/node_modules/@lexical/rich-text/LexicalRichText.js +0 -29
  48. package/dist/cjs/node_modules/@lexical/rich-text/LexicalRichText.prod.js +0 -26
  49. package/dist/cjs/node_modules/@lexical/selection/LexicalSelection.dev.js +0 -1057
  50. package/dist/cjs/node_modules/@lexical/selection/LexicalSelection.js +0 -39
  51. package/dist/cjs/node_modules/@lexical/selection/LexicalSelection.prod.js +0 -45
  52. package/dist/cjs/node_modules/@lexical/table/LexicalTable.dev.js +0 -4207
  53. package/dist/cjs/node_modules/@lexical/table/LexicalTable.js +0 -23
  54. package/dist/cjs/node_modules/@lexical/table/LexicalTable.prod.js +0 -68
  55. package/dist/cjs/node_modules/@lexical/utils/LexicalUtils.dev.js +0 -1166
  56. package/dist/cjs/node_modules/@lexical/utils/LexicalUtils.js +0 -47
  57. package/dist/cjs/node_modules/@lexical/utils/LexicalUtils.prod.js +0 -81
  58. package/dist/cjs/node_modules/@mdi/js/mdi.js +0 -8
  59. package/dist/cjs/node_modules/prismjs/components/prism-c.js +0 -82
  60. package/dist/cjs/node_modules/prismjs/components/prism-clike.js +0 -33
  61. package/dist/cjs/node_modules/prismjs/components/prism-cpp.js +0 -101
  62. package/dist/cjs/node_modules/prismjs/components/prism-css.js +0 -66
  63. package/dist/cjs/node_modules/prismjs/components/prism-java.js +0 -126
  64. package/dist/cjs/node_modules/prismjs/components/prism-javascript.js +0 -174
  65. package/dist/cjs/node_modules/prismjs/components/prism-markdown.js +0 -417
  66. package/dist/cjs/node_modules/prismjs/components/prism-markup.js +0 -188
  67. package/dist/cjs/node_modules/prismjs/components/prism-objectivec.js +0 -14
  68. package/dist/cjs/node_modules/prismjs/components/prism-powershell.js +0 -60
  69. package/dist/cjs/node_modules/prismjs/components/prism-python.js +0 -67
  70. package/dist/cjs/node_modules/prismjs/components/prism-rust.js +0 -130
  71. package/dist/cjs/node_modules/prismjs/components/prism-sql.js +0 -34
  72. package/dist/cjs/node_modules/prismjs/components/prism-swift.js +0 -150
  73. package/dist/cjs/node_modules/prismjs/components/prism-typescript.js +0 -62
  74. package/dist/cjs/node_modules/prismjs/prism.js +0 -1951
  75. package/dist/esm/_virtual/prism.js +0 -5
  76. package/dist/esm/node_modules/@lexical/clipboard/LexicalClipboard.dev.js +0 -465
  77. package/dist/esm/node_modules/@lexical/clipboard/LexicalClipboard.js +0 -19
  78. package/dist/esm/node_modules/@lexical/clipboard/LexicalClipboard.prod.js +0 -18
  79. package/dist/esm/node_modules/@lexical/code/LexicalCode.dev.js +0 -1512
  80. package/dist/esm/node_modules/@lexical/code/LexicalCode.js +0 -21
  81. package/dist/esm/node_modules/@lexical/code/LexicalCode.prod.js +0 -32
  82. package/dist/esm/node_modules/@lexical/html/LexicalHtml.dev.js +0 -251
  83. package/dist/esm/node_modules/@lexical/html/LexicalHtml.js +0 -18
  84. package/dist/esm/node_modules/@lexical/html/LexicalHtml.prod.js +0 -17
  85. package/dist/esm/node_modules/@lexical/link/LexicalLink.dev.js +0 -563
  86. package/dist/esm/node_modules/@lexical/link/LexicalLink.js +0 -17
  87. package/dist/esm/node_modules/@lexical/link/LexicalLink.prod.js +0 -16
  88. package/dist/esm/node_modules/@lexical/list/LexicalList.dev.js +0 -1595
  89. package/dist/esm/node_modules/@lexical/list/LexicalList.js +0 -23
  90. package/dist/esm/node_modules/@lexical/list/LexicalList.prod.js +0 -17
  91. package/dist/esm/node_modules/@lexical/rich-text/LexicalRichText.dev.js +0 -830
  92. package/dist/esm/node_modules/@lexical/rich-text/LexicalRichText.js +0 -23
  93. package/dist/esm/node_modules/@lexical/rich-text/LexicalRichText.prod.js +0 -18
  94. package/dist/esm/node_modules/@lexical/selection/LexicalSelection.dev.js +0 -1028
  95. package/dist/esm/node_modules/@lexical/selection/LexicalSelection.js +0 -28
  96. package/dist/esm/node_modules/@lexical/selection/LexicalSelection.prod.js +0 -16
  97. package/dist/esm/node_modules/@lexical/table/LexicalTable.dev.js +0 -4156
  98. package/dist/esm/node_modules/@lexical/table/LexicalTable.js +0 -20
  99. package/dist/esm/node_modules/@lexical/table/LexicalTable.prod.js +0 -17
  100. package/dist/esm/node_modules/@lexical/utils/LexicalUtils.dev.js +0 -1102
  101. package/dist/esm/node_modules/@lexical/utils/LexicalUtils.js +0 -32
  102. package/dist/esm/node_modules/@lexical/utils/LexicalUtils.prod.js +0 -17
  103. package/dist/esm/node_modules/@mdi/js/mdi.js +0 -7
  104. package/dist/esm/node_modules/prismjs/components/prism-c.js +0 -82
  105. package/dist/esm/node_modules/prismjs/components/prism-clike.js +0 -33
  106. package/dist/esm/node_modules/prismjs/components/prism-cpp.js +0 -101
  107. package/dist/esm/node_modules/prismjs/components/prism-css.js +0 -66
  108. package/dist/esm/node_modules/prismjs/components/prism-java.js +0 -126
  109. package/dist/esm/node_modules/prismjs/components/prism-javascript.js +0 -174
  110. package/dist/esm/node_modules/prismjs/components/prism-markdown.js +0 -417
  111. package/dist/esm/node_modules/prismjs/components/prism-markup.js +0 -188
  112. package/dist/esm/node_modules/prismjs/components/prism-objectivec.js +0 -14
  113. package/dist/esm/node_modules/prismjs/components/prism-powershell.js +0 -60
  114. package/dist/esm/node_modules/prismjs/components/prism-python.js +0 -67
  115. package/dist/esm/node_modules/prismjs/components/prism-rust.js +0 -130
  116. package/dist/esm/node_modules/prismjs/components/prism-sql.js +0 -34
  117. package/dist/esm/node_modules/prismjs/components/prism-swift.js +0 -150
  118. package/dist/esm/node_modules/prismjs/components/prism-typescript.js +0 -62
  119. package/dist/esm/node_modules/prismjs/prism.js +0 -1951
  120. /package/dist/cjs/{packages/lexical/src/editor → editor}/theme.js +0 -0
  121. /package/dist/cjs/{packages/lexical/src/nodes → nodes}/StickyNode.js +0 -0
  122. /package/dist/cjs/{packages/lexical/src/plugins → plugins}/StickyPlugin.js +0 -0
  123. /package/dist/cjs/{packages/lexical/src/utils → utils}/index.js +0 -0
  124. /package/dist/esm/{packages/lexical/src/editor → editor}/theme.js +0 -0
  125. /package/dist/esm/{packages/lexical/src/nodes → nodes}/StickyNode.js +0 -0
  126. /package/dist/esm/{packages/lexical/src/plugins → plugins}/StickyPlugin.js +0 -0
  127. /package/dist/esm/{packages/lexical/src/utils → utils}/index.js +0 -0
@@ -25,14 +25,14 @@ var blockTypeToBlockName = {
25
25
  quote: "Quote"
26
26
  };
27
27
  var blockTypeToBlockIcon = {
28
- bullet: core.CoreIcons.formatListBullet,
29
- code: core.CoreIcons.formatCodeBlock,
28
+ bullet: "icon-[mdi--format-list-bulleted]",
29
+ code: "icon-[mdi--code-block-tags]",
30
30
  h1: " ",
31
31
  h2: " ",
32
32
  paragraph: "",
33
- h6: core.CoreIcons.formatCommentBlock,
34
- number: core.CoreIcons.formatListNumber,
35
- quote: core.CoreIcons.formatQuoteBlock
33
+ h6: "icon-[mdi--comment-text-outline]",
34
+ number: "icon-[mdi--format-list-numbered]",
35
+ quote: "icon-[mdi--format-quote-open]"
36
36
  };
37
37
  var SIZES = Object.freeze(["8", "9", "10", "11", "12", "13", "14", "16", "18", "20", "24", "28", "32", "36", "48", "64", "72"]);
38
38
  var ButtonWrapper = function ButtonWrapper(_ref) {
@@ -64,7 +64,7 @@ var ToolbarPlugin = function ToolbarPlugin() {
64
64
  children: [/*#__PURE__*/jsxRuntime.jsx(core.Button, {
65
65
  variant: "link",
66
66
  tabIndex: -1,
67
- altIcon: core.CoreIcons.caretDown,
67
+ altIcon: "icon-[mdi--menu-down]",
68
68
  icon: blockTypeToBlockIcon[watch.blockType],
69
69
  children: blockTypeToBlockName[watch.blockType]
70
70
  }), /*#__PURE__*/jsxRuntime.jsxs(core.Menu, {
@@ -114,7 +114,8 @@ var ToolbarPlugin = function ToolbarPlugin() {
114
114
  children: /*#__PURE__*/jsxRuntime.jsxs(core.Dropdown, {
115
115
  children: [/*#__PURE__*/jsxRuntime.jsx(core.Button, {
116
116
  variant: "link",
117
- altIcon: core.CoreIcons.caretDown,
117
+ altIcon: "icon-[mdi--menu-down]",
118
+ tabIndex: -1,
118
119
  children: utilities.getValue(watch.fontSize + "", "16")
119
120
  }), /*#__PURE__*/jsxRuntime.jsx(core.Menu, {
120
121
  className: "hide-icons",
@@ -136,8 +137,10 @@ var ToolbarPlugin = function ToolbarPlugin() {
136
137
  children: [/*#__PURE__*/jsxRuntime.jsx(ButtonWrapper, {
137
138
  value: "start",
138
139
  label: t("tool.alignStart"),
140
+ variant: watch.align === "start" ? "soft" : "link",
141
+ color: watch.align === "start" ? "primary" : "default",
139
142
  icon: {
140
- icon: core.CoreIcons.alignLeft,
143
+ icon: "icon-[mdi--format-align-left]",
141
144
  rtlFlip: true
142
145
  },
143
146
  onClick: function onClick() {
@@ -146,15 +149,19 @@ var ToolbarPlugin = function ToolbarPlugin() {
146
149
  }), /*#__PURE__*/jsxRuntime.jsx(ButtonWrapper, {
147
150
  value: "center",
148
151
  label: t("tool.alignCenter"),
149
- icon: core.CoreIcons.alignCenter,
152
+ variant: watch.align === "center" ? "soft" : "link",
153
+ color: watch.align === "center" ? "primary" : "default",
154
+ icon: "icon-[mdi--format-align-center]",
150
155
  onClick: function onClick() {
151
156
  return watch.activeEditor.dispatchCommand(lexical.FORMAT_ELEMENT_COMMAND, "center");
152
157
  }
153
158
  }), /*#__PURE__*/jsxRuntime.jsx(ButtonWrapper, {
154
159
  value: "end",
155
160
  label: t("tool.alignEnd"),
161
+ variant: watch.align === "end" ? "soft" : "link",
162
+ color: watch.align === "end" ? "primary" : "default",
156
163
  icon: {
157
- icon: core.CoreIcons.alignRight,
164
+ icon: "icon-[mdi--format-align-right]",
158
165
  rtlFlip: true
159
166
  },
160
167
  onClick: function onClick() {
@@ -163,8 +170,10 @@ var ToolbarPlugin = function ToolbarPlugin() {
163
170
  }), /*#__PURE__*/jsxRuntime.jsx(ButtonWrapper, {
164
171
  value: "justify",
165
172
  label: t("tool.alignJustify"),
173
+ variant: watch.align === "justify" ? "soft" : "link",
174
+ color: watch.align === "justify" ? "primary" : "default",
166
175
  icon: {
167
- icon: core.CoreIcons.alignJustify,
176
+ icon: "icon-[mdi--format-align-justify]",
168
177
  rtlFlip: true
169
178
  },
170
179
  onClick: function onClick() {
@@ -174,7 +183,7 @@ var ToolbarPlugin = function ToolbarPlugin() {
174
183
  value: "justify",
175
184
  label: t("tool.indentOut"),
176
185
  icon: {
177
- icon: core.CoreIcons.formatIndentDecrease,
186
+ icon: "icon-[mdi--format-indent-decrease]",
178
187
  rtlFlip: true
179
188
  },
180
189
  onClick: function onClick() {
@@ -182,9 +191,9 @@ var ToolbarPlugin = function ToolbarPlugin() {
182
191
  }
183
192
  }), /*#__PURE__*/jsxRuntime.jsx(ButtonWrapper, {
184
193
  value: "justify",
185
- label: t("tool.identIn"),
194
+ label: t("tool.indentIn"),
186
195
  icon: {
187
- icon: core.CoreIcons.formatIndentIncrease,
196
+ icon: "icon-[mdi--format-indent-increase]",
188
197
  rtlFlip: true
189
198
  },
190
199
  onClick: function onClick() {
@@ -199,28 +208,32 @@ var ToolbarPlugin = function ToolbarPlugin() {
199
208
  children: [/*#__PURE__*/jsxRuntime.jsx(ButtonWrapper, {
200
209
  value: "bold",
201
210
  label: t("tool.bold"),
202
- icon: core.CoreIcons.formatBold,
211
+ icon: "icon-[mdi--format-bold]",
212
+ color: textFormat.includes("bold") ? "primary" : "default",
203
213
  onClick: function onClick() {
204
214
  return watch.activeEditor.dispatchCommand(lexical.FORMAT_TEXT_COMMAND, "bold");
205
215
  }
206
216
  }), /*#__PURE__*/jsxRuntime.jsx(ButtonWrapper, {
207
217
  value: "italic",
208
218
  label: t("tool.italic"),
209
- icon: core.CoreIcons.formatItalic,
219
+ icon: "icon-[mdi--format-italic]",
220
+ color: textFormat.includes("italic") ? "primary" : "default",
210
221
  onClick: function onClick() {
211
222
  return watch.activeEditor.dispatchCommand(lexical.FORMAT_TEXT_COMMAND, "italic");
212
223
  }
213
224
  }), /*#__PURE__*/jsxRuntime.jsx(ButtonWrapper, {
214
225
  value: "underline",
215
226
  label: t("tool.underline"),
216
- icon: core.CoreIcons.formatUnderline,
227
+ icon: "icon-[mdi--format-underline]",
228
+ color: textFormat.includes("underline") ? "primary" : "default",
217
229
  onClick: function onClick() {
218
230
  return watch.activeEditor.dispatchCommand(lexical.FORMAT_TEXT_COMMAND, "underline");
219
231
  }
220
232
  }), /*#__PURE__*/jsxRuntime.jsx(ButtonWrapper, {
221
233
  value: "strikethrough",
222
234
  label: t("tool.strikethrough"),
223
- icon: core.CoreIcons.formatStrikethrough,
235
+ icon: "icon-[mdi--format-strikethrough-variant]",
236
+ color: textFormat.includes("strikethrough") ? "primary" : "default",
224
237
  onClick: function onClick() {
225
238
  return watch.activeEditor.dispatchCommand(lexical.FORMAT_TEXT_COMMAND, "strikethrough");
226
239
  }
@@ -234,7 +247,7 @@ var ToolbarPlugin = function ToolbarPlugin() {
234
247
  return watch.onFontColorSelect(v !== null && v !== void 0 ? v : undefined);
235
248
  },
236
249
  decorateStart: /*#__PURE__*/jsxRuntime.jsx(core.Icon, {
237
- icon: core.CoreIcons.formatText
250
+ icon: "icon-[mdi--format-text]"
238
251
  })
239
252
  }), /*#__PURE__*/jsxRuntime.jsx(form.ColorInput, {
240
253
  noOutline: true,
@@ -243,19 +256,19 @@ var ToolbarPlugin = function ToolbarPlugin() {
243
256
  return watch.onBgColorSelect(v !== null && v !== void 0 ? v : undefined);
244
257
  },
245
258
  decorateStart: /*#__PURE__*/jsxRuntime.jsx(core.Icon, {
246
- icon: core.CoreIcons.formatFill
259
+ icon: "icon-[mdi--format-color-fill]"
247
260
  })
248
261
  }), /*#__PURE__*/jsxRuntime.jsx(ButtonWrapper, {
249
262
  value: "hilight",
250
263
  label: t("tool.hilight"),
251
- icon: core.CoreIcons.formatHilight,
264
+ icon: "icon-[mdi--format-color-highlight]",
252
265
  onClick: function onClick() {
253
266
  return watch.onBgColorSelect("#fde68a");
254
267
  }
255
268
  }), /*#__PURE__*/jsxRuntime.jsx(ButtonWrapper, {
256
269
  value: "hilight",
257
270
  label: t("tool.clear"),
258
- icon: core.CoreIcons.formatClear,
271
+ icon: "icon-[mdi--format-clear]",
259
272
  onClick: function onClick() {
260
273
  return watch.clearFormatting();
261
274
  }
@@ -7,7 +7,6 @@ import { ContentEditable } from '@lexical/react/LexicalContentEditable';
7
7
  import { LexicalErrorBoundary } from '@lexical/react/LexicalErrorBoundary';
8
8
  import { LexicalNestedComposer } from '@lexical/react/LexicalNestedComposer';
9
9
  import { RichTextPlugin } from '@lexical/react/LexicalRichTextPlugin';
10
- import { mdiFormatColorFill, mdiClose } from '../../../../node_modules/@mdi/js/mdi.js';
11
10
  import { Icon } from '@react-fabric/core';
12
11
  import { createEditor, $getNodeByKey } from 'lexical';
13
12
  import { useRef, useEffect, useMemo } from 'react';
@@ -174,7 +173,7 @@ var StickyComponent = function StickyComponent(_ref) {
174
173
  "aria-label": "Change sticky note color",
175
174
  title: "Color",
176
175
  children: /*#__PURE__*/jsx(Icon, {
177
- icon: mdiFormatColorFill
176
+ icon: "icon-[mdi--format-color-fill]"
178
177
  })
179
178
  }), /*#__PURE__*/jsx("button", {
180
179
  onClick: handleDelete,
@@ -182,7 +181,7 @@ var StickyComponent = function StickyComponent(_ref) {
182
181
  "aria-label": "Delete sticky note",
183
182
  title: "Delete",
184
183
  children: /*#__PURE__*/jsx(Icon, {
185
- icon: mdiClose
184
+ icon: "icon-[mdi--close]"
186
185
  })
187
186
  })]
188
187
  }), /*#__PURE__*/jsx("div", {
@@ -1,8 +1,8 @@
1
1
  'use client';
2
2
 
3
3
  import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
4
- import { CodeHighlightNode, CodeNode } from '../../../../node_modules/@lexical/code/LexicalCode.js';
5
- import { ListItemNode, ListNode } from '../../../../node_modules/@lexical/list/LexicalList.js';
4
+ import { CodeHighlightNode, CodeNode } from '@lexical/code';
5
+ import { ListItemNode, ListNode } from '@lexical/list';
6
6
  import { AutoFocusPlugin } from '@lexical/react/LexicalAutoFocusPlugin';
7
7
  import { CheckListPlugin } from '@lexical/react/LexicalCheckListPlugin';
8
8
  import { LexicalComposer } from '@lexical/react/LexicalComposer';
@@ -12,8 +12,8 @@ import { HistoryPlugin } from '@lexical/react/LexicalHistoryPlugin';
12
12
  import { ListPlugin } from '@lexical/react/LexicalListPlugin';
13
13
  import { RichTextPlugin } from '@lexical/react/LexicalRichTextPlugin';
14
14
  import { TablePlugin } from '@lexical/react/LexicalTablePlugin';
15
- import { QuoteNode, HeadingNode } from '../../../../node_modules/@lexical/rich-text/LexicalRichText.js';
16
- import { TableCellNode, TableNode, TableRowNode } from '../../../../node_modules/@lexical/table/LexicalTable.js';
15
+ import { QuoteNode, HeadingNode } from '@lexical/rich-text';
16
+ import { TableCellNode, TableNode, TableRowNode } from '@lexical/table';
17
17
  import { Header, ErrorBoundary, ThemeProvider } from '@react-fabric/core';
18
18
  import { debounce } from '@react-fabric/utilities';
19
19
  import classNames from 'classnames';
@@ -3,14 +3,14 @@
3
3
  import _asyncToGenerator from '@babel/runtime/helpers/asyncToGenerator';
4
4
  import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
5
5
  import _regeneratorRuntime from '@babel/runtime/regenerator';
6
- import { $isCodeNode, CODE_LANGUAGE_MAP, $createCodeNode } from '../../../../node_modules/@lexical/code/LexicalCode.js';
7
- import { $isLinkNode } from '../../../../node_modules/@lexical/link/LexicalLink.js';
8
- import { $isListNode, ListNode, INSERT_UNORDERED_LIST_COMMAND, REMOVE_LIST_COMMAND, INSERT_CHECK_LIST_COMMAND, INSERT_ORDERED_LIST_COMMAND } from '../../../../node_modules/@lexical/list/LexicalList.js';
6
+ import { $isCodeNode, CODE_LANGUAGE_MAP, $createCodeNode } from '@lexical/code';
7
+ import { $isLinkNode } from '@lexical/link';
8
+ import { $isListNode, ListNode, INSERT_UNORDERED_LIST_COMMAND, REMOVE_LIST_COMMAND, INSERT_CHECK_LIST_COMMAND, INSERT_ORDERED_LIST_COMMAND } from '@lexical/list';
9
9
  import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
10
- import { $isHeadingNode, $createQuoteNode, $createHeadingNode, $isQuoteNode } from '../../../../node_modules/@lexical/rich-text/LexicalRichText.js';
11
- import { $isParentElementRTL, $getSelectionStyleValueForProperty, $patchStyleText, $setBlocksType, $isAtNodeEnd } from '../../../../node_modules/@lexical/selection/LexicalSelection.js';
12
- import { $isTableNode } from '../../../../node_modules/@lexical/table/LexicalTable.js';
13
- import { $findMatchingParent, $getNearestNodeOfType, mergeRegister, $getNearestBlockElementAncestorOrThrow } from '../../../../node_modules/@lexical/utils/LexicalUtils.js';
10
+ import { $isHeadingNode, $createQuoteNode, $createHeadingNode, $isQuoteNode } from '@lexical/rich-text';
11
+ import { $isParentElementRTL, $getSelectionStyleValueForProperty, $patchStyleText, $setBlocksType, $isAtNodeEnd } from '@lexical/selection';
12
+ import { $isTableNode } from '@lexical/table';
13
+ import { $findMatchingParent, $getNearestNodeOfType, mergeRegister, $getNearestBlockElementAncestorOrThrow } from '@lexical/utils';
14
14
  import { isNil } from '@react-fabric/utilities';
15
15
  import { $getSelection, $isRangeSelection, $isRootOrShadowRoot, SELECTION_CHANGE_COMMAND, COMMAND_PRIORITY_CRITICAL, CAN_UNDO_COMMAND, CAN_REDO_COMMAND, $setSelection, $createParagraphNode, INDENT_CONTENT_COMMAND, OUTDENT_CONTENT_COMMAND, $isTextNode } from 'lexical';
16
16
  import { useState, useCallback, useEffect } from 'react';
@@ -84,60 +84,64 @@ var useFormatWatcher = function useFormatWatcher() {
84
84
  _useState18 = _slicedToArray(_useState17, 2),
85
85
  fontFamily = _useState18[0],
86
86
  setFontFamily = _useState18[1];
87
- var _useState19 = useState(false),
87
+ var _useState19 = useState(""),
88
88
  _useState20 = _slicedToArray(_useState19, 2),
89
- isLink = _useState20[0],
90
- setIsLink = _useState20[1];
89
+ align = _useState20[0],
90
+ setAlign = _useState20[1];
91
91
  var _useState21 = useState(false),
92
92
  _useState22 = _slicedToArray(_useState21, 2),
93
- isBold = _useState22[0],
94
- setIsBold = _useState22[1];
93
+ isLink = _useState22[0],
94
+ setIsLink = _useState22[1];
95
95
  var _useState23 = useState(false),
96
96
  _useState24 = _slicedToArray(_useState23, 2),
97
- isItalic = _useState24[0],
98
- setIsItalic = _useState24[1];
97
+ isBold = _useState24[0],
98
+ setIsBold = _useState24[1];
99
99
  var _useState25 = useState(false),
100
100
  _useState26 = _slicedToArray(_useState25, 2),
101
- isUnderline = _useState26[0],
102
- setIsUnderline = _useState26[1];
101
+ isItalic = _useState26[0],
102
+ setIsItalic = _useState26[1];
103
103
  var _useState27 = useState(false),
104
104
  _useState28 = _slicedToArray(_useState27, 2),
105
- isStrikethrough = _useState28[0],
106
- setIsStrikethrough = _useState28[1];
105
+ isUnderline = _useState28[0],
106
+ setIsUnderline = _useState28[1];
107
107
  var _useState29 = useState(false),
108
108
  _useState30 = _slicedToArray(_useState29, 2),
109
- isSubscript = _useState30[0],
110
- setIsSubscript = _useState30[1];
109
+ isStrikethrough = _useState30[0],
110
+ setIsStrikethrough = _useState30[1];
111
111
  var _useState31 = useState(false),
112
112
  _useState32 = _slicedToArray(_useState31, 2),
113
- isSuperscript = _useState32[0],
114
- setIsSuperscript = _useState32[1];
113
+ isSubscript = _useState32[0],
114
+ setIsSubscript = _useState32[1];
115
115
  var _useState33 = useState(false),
116
116
  _useState34 = _slicedToArray(_useState33, 2),
117
- isCode = _useState34[0],
118
- setIsCode = _useState34[1];
117
+ isSuperscript = _useState34[0],
118
+ setIsSuperscript = _useState34[1];
119
119
  var _useState35 = useState(false),
120
120
  _useState36 = _slicedToArray(_useState35, 2),
121
- canUndo = _useState36[0],
122
- setCanUndo = _useState36[1];
121
+ isCode = _useState36[0],
122
+ setIsCode = _useState36[1];
123
123
  var _useState37 = useState(false),
124
124
  _useState38 = _slicedToArray(_useState37, 2),
125
- canRedo = _useState38[0],
126
- setCanRedo = _useState38[1];
125
+ canUndo = _useState38[0],
126
+ setCanUndo = _useState38[1];
127
127
  var _useState39 = useState(false),
128
128
  _useState40 = _slicedToArray(_useState39, 2),
129
- isRTL = _useState40[0],
130
- setIsRTL = _useState40[1];
131
- var _useState41 = useState(""),
129
+ canRedo = _useState40[0],
130
+ setCanRedo = _useState40[1];
131
+ var _useState41 = useState(false),
132
132
  _useState42 = _slicedToArray(_useState41, 2),
133
- codeLanguage = _useState42[0],
134
- setCodeLanguage = _useState42[1];
135
- var _useState43 = useState(function () {
133
+ isRTL = _useState42[0],
134
+ setIsRTL = _useState42[1];
135
+ var _useState43 = useState(""),
136
+ _useState44 = _slicedToArray(_useState43, 2),
137
+ codeLanguage = _useState44[0],
138
+ setCodeLanguage = _useState44[1];
139
+ var _useState45 = useState(function () {
136
140
  return editor.isEditable();
137
141
  }),
138
- _useState44 = _slicedToArray(_useState43, 2),
139
- isEditable = _useState44[0],
140
- setIsEditable = _useState44[1];
142
+ _useState46 = _slicedToArray(_useState45, 2),
143
+ isEditable = _useState46[0],
144
+ setIsEditable = _useState46[1];
141
145
  var $updateToolbar = useCallback(function () {
142
146
  var selection = $getSelection();
143
147
  if ($isRangeSelection(selection)) {
@@ -180,6 +184,7 @@ var useFormatWatcher = function useFormatWatcher() {
180
184
  }
181
185
  if (elementDOM !== null) {
182
186
  setSelectedElementKey(elementKey);
187
+ elementDOM && setAlign(getComputedStyle(elementDOM).textAlign);
183
188
  if ($isListNode(element)) {
184
189
  var parentList = $getNearestNodeOfType(anchorNode, ListNode);
185
190
  var type = parentList ? parentList.getListType() : element.getListType();
@@ -431,6 +436,7 @@ var useFormatWatcher = function useFormatWatcher() {
431
436
  canUndo: canUndo,
432
437
  canRedo: canRedo,
433
438
  isRTL: isRTL,
439
+ align: align,
434
440
  isEditable: isEditable,
435
441
  codeLanguage: codeLanguage,
436
442
  activeEditor: activeEditor,
@@ -0,0 +1,21 @@
1
+ 'use client';
2
+
3
+ var tool = {
4
+ alignCenter: "محاذاة المركز",
5
+ alignJustify: "محاذاة وضبط",
6
+ alignEnd: "محاذاة النهاية",
7
+ alignStart: "محاذاة البداية",
8
+ bold: "عريض",
9
+ clear: "مسح التنسيق",
10
+ hilight: "تسليط الضوء",
11
+ indentIn: "المسافة البادئة في",
12
+ underline: "تسطير",
13
+ strikethrough: "يتوسطه خط",
14
+ italic: "مائل",
15
+ indentOut: "مسافة بادئة للخارج"
16
+ };
17
+ var ar = {
18
+ tool: tool
19
+ };
20
+
21
+ export { ar as default, tool };
@@ -0,0 +1,21 @@
1
+ 'use client';
2
+
3
+ var tool = {
4
+ alignStart: "Align Start",
5
+ alignCenter: "Align Center",
6
+ alignEnd: "Align End",
7
+ alignJustify: "Align Justify",
8
+ bold: "Bold",
9
+ italic: "Italic",
10
+ underline: "Underline",
11
+ strikethrough: "Strikethrough",
12
+ indentOut: "Indent Out",
13
+ indentIn: "Indent In",
14
+ hilight: "Highlight",
15
+ clear: "Clear Formatting"
16
+ };
17
+ var en = {
18
+ tool: tool
19
+ };
20
+
21
+ export { en as default, tool };
@@ -0,0 +1,33 @@
1
+ 'use client';
2
+
3
+ import { addTranslationBundle } from '@react-fabric/core';
4
+ import ar from './ar.json.js';
5
+ import en from './en.json.js';
6
+
7
+ /*
8
+ * React Fabric
9
+ * @version: 1.0.0
10
+ *
11
+ *
12
+ * The MIT License (MIT)
13
+ * Copyright (c) 2024 Adarsh Pastakia
14
+ *
15
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
16
+ * and associated documentation files (the "Software"), to deal in the Software without restriction,
17
+ * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
18
+ * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
19
+ * subject to the following conditions:
20
+ *
21
+ * The above copyright notice and this permission notice shall be included in all copies or substantial
22
+ * portions of the Software.
23
+ *
24
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
25
+ * TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
26
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
27
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28
+ */
29
+
30
+ addTranslationBundle("lexical", {
31
+ en: en,
32
+ ar: ar
33
+ });
@@ -1,3 +1,4 @@
1
1
  'use client';
2
2
 
3
+ import './i18n/index.js';
3
4
  export { LexicalEditor } from './editor/LexicalEditor.js';
@@ -2,8 +2,8 @@
2
2
 
3
3
  import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
4
4
  import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
5
- import { eventFiles } from '../../../../node_modules/@lexical/rich-text/LexicalRichText.js';
6
- import { mergeRegister } from '../../../../node_modules/@lexical/utils/LexicalUtils.js';
5
+ import { eventFiles } from '@lexical/rich-text';
6
+ import { mergeRegister } from '@lexical/utils';
7
7
  import { DRAGOVER_COMMAND, COMMAND_PRIORITY_LOW, DROP_COMMAND, COMMAND_PRIORITY_HIGH, $getNodeByKey, $getNearestNodeFromDOMNode, $getRoot } from 'lexical';
8
8
  import { useRef, useState, useEffect } from 'react';
9
9
  import { createPortal } from 'react-dom';
@@ -2,7 +2,7 @@
2
2
 
3
3
  import _defineProperty from '@babel/runtime/helpers/defineProperty';
4
4
  import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
5
- import { CoreIcons, Dropdown, Button, Menu, MenuItem, Divider, ButtonGroup, ToggleButtonGroup, Icon, Tooltip } from '@react-fabric/core';
5
+ import { Dropdown, Button, Menu, MenuItem, Divider, ButtonGroup, ToggleButtonGroup, Icon, Tooltip } from '@react-fabric/core';
6
6
  import { ColorInput } from '@react-fabric/form';
7
7
  import { getValue } from '@react-fabric/utilities';
8
8
  import { FORMAT_ELEMENT_COMMAND, FORMAT_TEXT_COMMAND } from 'lexical';
@@ -25,14 +25,14 @@ var blockTypeToBlockName = {
25
25
  quote: "Quote"
26
26
  };
27
27
  var blockTypeToBlockIcon = {
28
- bullet: CoreIcons.formatListBullet,
29
- code: CoreIcons.formatCodeBlock,
28
+ bullet: "icon-[mdi--format-list-bulleted]",
29
+ code: "icon-[mdi--code-block-tags]",
30
30
  h1: " ",
31
31
  h2: " ",
32
32
  paragraph: "",
33
- h6: CoreIcons.formatCommentBlock,
34
- number: CoreIcons.formatListNumber,
35
- quote: CoreIcons.formatQuoteBlock
33
+ h6: "icon-[mdi--comment-text-outline]",
34
+ number: "icon-[mdi--format-list-numbered]",
35
+ quote: "icon-[mdi--format-quote-open]"
36
36
  };
37
37
  var SIZES = Object.freeze(["8", "9", "10", "11", "12", "13", "14", "16", "18", "20", "24", "28", "32", "36", "48", "64", "72"]);
38
38
  var ButtonWrapper = function ButtonWrapper(_ref) {
@@ -64,7 +64,7 @@ var ToolbarPlugin = function ToolbarPlugin() {
64
64
  children: [/*#__PURE__*/jsx(Button, {
65
65
  variant: "link",
66
66
  tabIndex: -1,
67
- altIcon: CoreIcons.caretDown,
67
+ altIcon: "icon-[mdi--menu-down]",
68
68
  icon: blockTypeToBlockIcon[watch.blockType],
69
69
  children: blockTypeToBlockName[watch.blockType]
70
70
  }), /*#__PURE__*/jsxs(Menu, {
@@ -114,7 +114,8 @@ var ToolbarPlugin = function ToolbarPlugin() {
114
114
  children: /*#__PURE__*/jsxs(Dropdown, {
115
115
  children: [/*#__PURE__*/jsx(Button, {
116
116
  variant: "link",
117
- altIcon: CoreIcons.caretDown,
117
+ altIcon: "icon-[mdi--menu-down]",
118
+ tabIndex: -1,
118
119
  children: getValue(watch.fontSize + "", "16")
119
120
  }), /*#__PURE__*/jsx(Menu, {
120
121
  className: "hide-icons",
@@ -136,8 +137,10 @@ var ToolbarPlugin = function ToolbarPlugin() {
136
137
  children: [/*#__PURE__*/jsx(ButtonWrapper, {
137
138
  value: "start",
138
139
  label: t("tool.alignStart"),
140
+ variant: watch.align === "start" ? "soft" : "link",
141
+ color: watch.align === "start" ? "primary" : "default",
139
142
  icon: {
140
- icon: CoreIcons.alignLeft,
143
+ icon: "icon-[mdi--format-align-left]",
141
144
  rtlFlip: true
142
145
  },
143
146
  onClick: function onClick() {
@@ -146,15 +149,19 @@ var ToolbarPlugin = function ToolbarPlugin() {
146
149
  }), /*#__PURE__*/jsx(ButtonWrapper, {
147
150
  value: "center",
148
151
  label: t("tool.alignCenter"),
149
- icon: CoreIcons.alignCenter,
152
+ variant: watch.align === "center" ? "soft" : "link",
153
+ color: watch.align === "center" ? "primary" : "default",
154
+ icon: "icon-[mdi--format-align-center]",
150
155
  onClick: function onClick() {
151
156
  return watch.activeEditor.dispatchCommand(FORMAT_ELEMENT_COMMAND, "center");
152
157
  }
153
158
  }), /*#__PURE__*/jsx(ButtonWrapper, {
154
159
  value: "end",
155
160
  label: t("tool.alignEnd"),
161
+ variant: watch.align === "end" ? "soft" : "link",
162
+ color: watch.align === "end" ? "primary" : "default",
156
163
  icon: {
157
- icon: CoreIcons.alignRight,
164
+ icon: "icon-[mdi--format-align-right]",
158
165
  rtlFlip: true
159
166
  },
160
167
  onClick: function onClick() {
@@ -163,8 +170,10 @@ var ToolbarPlugin = function ToolbarPlugin() {
163
170
  }), /*#__PURE__*/jsx(ButtonWrapper, {
164
171
  value: "justify",
165
172
  label: t("tool.alignJustify"),
173
+ variant: watch.align === "justify" ? "soft" : "link",
174
+ color: watch.align === "justify" ? "primary" : "default",
166
175
  icon: {
167
- icon: CoreIcons.alignJustify,
176
+ icon: "icon-[mdi--format-align-justify]",
168
177
  rtlFlip: true
169
178
  },
170
179
  onClick: function onClick() {
@@ -174,7 +183,7 @@ var ToolbarPlugin = function ToolbarPlugin() {
174
183
  value: "justify",
175
184
  label: t("tool.indentOut"),
176
185
  icon: {
177
- icon: CoreIcons.formatIndentDecrease,
186
+ icon: "icon-[mdi--format-indent-decrease]",
178
187
  rtlFlip: true
179
188
  },
180
189
  onClick: function onClick() {
@@ -182,9 +191,9 @@ var ToolbarPlugin = function ToolbarPlugin() {
182
191
  }
183
192
  }), /*#__PURE__*/jsx(ButtonWrapper, {
184
193
  value: "justify",
185
- label: t("tool.identIn"),
194
+ label: t("tool.indentIn"),
186
195
  icon: {
187
- icon: CoreIcons.formatIndentIncrease,
196
+ icon: "icon-[mdi--format-indent-increase]",
188
197
  rtlFlip: true
189
198
  },
190
199
  onClick: function onClick() {
@@ -199,28 +208,32 @@ var ToolbarPlugin = function ToolbarPlugin() {
199
208
  children: [/*#__PURE__*/jsx(ButtonWrapper, {
200
209
  value: "bold",
201
210
  label: t("tool.bold"),
202
- icon: CoreIcons.formatBold,
211
+ icon: "icon-[mdi--format-bold]",
212
+ color: textFormat.includes("bold") ? "primary" : "default",
203
213
  onClick: function onClick() {
204
214
  return watch.activeEditor.dispatchCommand(FORMAT_TEXT_COMMAND, "bold");
205
215
  }
206
216
  }), /*#__PURE__*/jsx(ButtonWrapper, {
207
217
  value: "italic",
208
218
  label: t("tool.italic"),
209
- icon: CoreIcons.formatItalic,
219
+ icon: "icon-[mdi--format-italic]",
220
+ color: textFormat.includes("italic") ? "primary" : "default",
210
221
  onClick: function onClick() {
211
222
  return watch.activeEditor.dispatchCommand(FORMAT_TEXT_COMMAND, "italic");
212
223
  }
213
224
  }), /*#__PURE__*/jsx(ButtonWrapper, {
214
225
  value: "underline",
215
226
  label: t("tool.underline"),
216
- icon: CoreIcons.formatUnderline,
227
+ icon: "icon-[mdi--format-underline]",
228
+ color: textFormat.includes("underline") ? "primary" : "default",
217
229
  onClick: function onClick() {
218
230
  return watch.activeEditor.dispatchCommand(FORMAT_TEXT_COMMAND, "underline");
219
231
  }
220
232
  }), /*#__PURE__*/jsx(ButtonWrapper, {
221
233
  value: "strikethrough",
222
234
  label: t("tool.strikethrough"),
223
- icon: CoreIcons.formatStrikethrough,
235
+ icon: "icon-[mdi--format-strikethrough-variant]",
236
+ color: textFormat.includes("strikethrough") ? "primary" : "default",
224
237
  onClick: function onClick() {
225
238
  return watch.activeEditor.dispatchCommand(FORMAT_TEXT_COMMAND, "strikethrough");
226
239
  }
@@ -234,7 +247,7 @@ var ToolbarPlugin = function ToolbarPlugin() {
234
247
  return watch.onFontColorSelect(v !== null && v !== void 0 ? v : undefined);
235
248
  },
236
249
  decorateStart: /*#__PURE__*/jsx(Icon, {
237
- icon: CoreIcons.formatText
250
+ icon: "icon-[mdi--format-text]"
238
251
  })
239
252
  }), /*#__PURE__*/jsx(ColorInput, {
240
253
  noOutline: true,
@@ -243,19 +256,19 @@ var ToolbarPlugin = function ToolbarPlugin() {
243
256
  return watch.onBgColorSelect(v !== null && v !== void 0 ? v : undefined);
244
257
  },
245
258
  decorateStart: /*#__PURE__*/jsx(Icon, {
246
- icon: CoreIcons.formatFill
259
+ icon: "icon-[mdi--format-color-fill]"
247
260
  })
248
261
  }), /*#__PURE__*/jsx(ButtonWrapper, {
249
262
  value: "hilight",
250
263
  label: t("tool.hilight"),
251
- icon: CoreIcons.formatHilight,
264
+ icon: "icon-[mdi--format-color-highlight]",
252
265
  onClick: function onClick() {
253
266
  return watch.onBgColorSelect("#fde68a");
254
267
  }
255
268
  }), /*#__PURE__*/jsx(ButtonWrapper, {
256
269
  value: "hilight",
257
270
  label: t("tool.clear"),
258
- icon: CoreIcons.formatClear,
271
+ icon: "icon-[mdi--format-clear]",
259
272
  onClick: function onClick() {
260
273
  return watch.clearFormatting();
261
274
  }
@@ -21,6 +21,7 @@ export declare const useFormatWatcher: () => {
21
21
  canUndo: boolean;
22
22
  canRedo: boolean;
23
23
  isRTL: boolean;
24
+ align: string;
24
25
  isEditable: boolean;
25
26
  codeLanguage: string;
26
27
  activeEditor: import("lexical").LexicalEditor;
@@ -0,0 +1 @@
1
+ export {};
@@ -1 +1,2 @@
1
+ import "./i18n";
1
2
  export { LexicalEditor } from "./editor/LexicalEditor";