@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
@@ -7,7 +7,6 @@ var LexicalContentEditable = require('@lexical/react/LexicalContentEditable');
7
7
  var LexicalErrorBoundary = require('@lexical/react/LexicalErrorBoundary');
8
8
  var LexicalNestedComposer = require('@lexical/react/LexicalNestedComposer');
9
9
  var LexicalRichTextPlugin = require('@lexical/react/LexicalRichTextPlugin');
10
- var mdi = require('../../../../node_modules/@mdi/js/mdi.js');
11
10
  var core = require('@react-fabric/core');
12
11
  var lexical = require('lexical');
13
12
  var react = require('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__*/jsxRuntime.jsx(core.Icon, {
177
- icon: mdi.mdiFormatColorFill
176
+ icon: "icon-[mdi--format-color-fill]"
178
177
  })
179
178
  }), /*#__PURE__*/jsxRuntime.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__*/jsxRuntime.jsx(core.Icon, {
185
- icon: mdi.mdiClose
184
+ icon: "icon-[mdi--close]"
186
185
  })
187
186
  })]
188
187
  }), /*#__PURE__*/jsxRuntime.jsx("div", {
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
3
  var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
4
- var LexicalCode = require('../../../../node_modules/@lexical/code/LexicalCode.js');
5
- var LexicalList = require('../../../../node_modules/@lexical/list/LexicalList.js');
4
+ var code = require('@lexical/code');
5
+ var list = require('@lexical/list');
6
6
  var LexicalAutoFocusPlugin = require('@lexical/react/LexicalAutoFocusPlugin');
7
7
  var LexicalCheckListPlugin = require('@lexical/react/LexicalCheckListPlugin');
8
8
  var LexicalComposer = require('@lexical/react/LexicalComposer');
@@ -12,8 +12,8 @@ var LexicalHistoryPlugin = require('@lexical/react/LexicalHistoryPlugin');
12
12
  var LexicalListPlugin = require('@lexical/react/LexicalListPlugin');
13
13
  var LexicalRichTextPlugin = require('@lexical/react/LexicalRichTextPlugin');
14
14
  var LexicalTablePlugin = require('@lexical/react/LexicalTablePlugin');
15
- var LexicalRichText = require('../../../../node_modules/@lexical/rich-text/LexicalRichText.js');
16
- var LexicalTable = require('../../../../node_modules/@lexical/table/LexicalTable.js');
15
+ var richText = require('@lexical/rich-text');
16
+ var table = require('@lexical/table');
17
17
  var core = require('@react-fabric/core');
18
18
  var utilities = require('@react-fabric/utilities');
19
19
  var classNames = require('classnames');
@@ -123,7 +123,7 @@ var LexicalEditor = function LexicalEditor(_ref) {
123
123
  namespace: "MyEditor",
124
124
  editable: !readOnly && !publishMode,
125
125
  theme: theme.LexicalTheme,
126
- nodes: [LexicalRichText.QuoteNode, LexicalRichText.HeadingNode, LexicalCode.CodeHighlightNode, LexicalCode.CodeNode, LexicalList.ListItemNode, LexicalList.ListNode, LexicalTable.TableCellNode, LexicalTable.TableNode, LexicalTable.TableRowNode, StickyNode.StickyNode],
126
+ nodes: [richText.QuoteNode, richText.HeadingNode, code.CodeHighlightNode, code.CodeNode, list.ListItemNode, list.ListNode, table.TableCellNode, table.TableNode, table.TableRowNode, StickyNode.StickyNode],
127
127
  onError: onError
128
128
  };
129
129
  }, []);
@@ -3,14 +3,14 @@
3
3
  var _asyncToGenerator = require('@babel/runtime/helpers/asyncToGenerator');
4
4
  var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
5
5
  var _regeneratorRuntime = require('@babel/runtime/regenerator');
6
- var LexicalCode = require('../../../../node_modules/@lexical/code/LexicalCode.js');
7
- var LexicalLink = require('../../../../node_modules/@lexical/link/LexicalLink.js');
8
- var LexicalList = require('../../../../node_modules/@lexical/list/LexicalList.js');
6
+ var code = require('@lexical/code');
7
+ var link = require('@lexical/link');
8
+ var list = require('@lexical/list');
9
9
  var LexicalComposerContext = require('@lexical/react/LexicalComposerContext');
10
- var LexicalRichText = require('../../../../node_modules/@lexical/rich-text/LexicalRichText.js');
11
- var LexicalSelection = require('../../../../node_modules/@lexical/selection/LexicalSelection.js');
12
- var LexicalTable = require('../../../../node_modules/@lexical/table/LexicalTable.js');
13
- var LexicalUtils = require('../../../../node_modules/@lexical/utils/LexicalUtils.js');
10
+ var richText = require('@lexical/rich-text');
11
+ var selection = require('@lexical/selection');
12
+ var table = require('@lexical/table');
13
+ var utils = require('@lexical/utils');
14
14
  var utilities = require('@react-fabric/utilities');
15
15
  var lexical = require('lexical');
16
16
  var react = require('react');
@@ -29,19 +29,19 @@ var blockTypeToBlockName = {
29
29
  paragraph: "Normal",
30
30
  quote: "Quote"
31
31
  };
32
- function getSelectedNode(selection) {
33
- var anchor = selection.anchor;
34
- var focus = selection.focus;
35
- var anchorNode = selection.anchor.getNode();
36
- var focusNode = selection.focus.getNode();
32
+ function getSelectedNode(selection$1) {
33
+ var anchor = selection$1.anchor;
34
+ var focus = selection$1.focus;
35
+ var anchorNode = selection$1.anchor.getNode();
36
+ var focusNode = selection$1.focus.getNode();
37
37
  if (anchorNode === focusNode) {
38
38
  return anchorNode;
39
39
  }
40
- var isBackward = selection.isBackward();
40
+ var isBackward = selection$1.isBackward();
41
41
  if (isBackward) {
42
- return LexicalSelection.$isAtNodeEnd(focus) ? anchorNode : focusNode;
42
+ return selection.$isAtNodeEnd(focus) ? anchorNode : focusNode;
43
43
  } else {
44
- return LexicalSelection.$isAtNodeEnd(anchor) ? anchorNode : focusNode;
44
+ return selection.$isAtNodeEnd(anchor) ? anchorNode : focusNode;
45
45
  }
46
46
  }
47
47
  var useFormatWatcher = function useFormatWatcher() {
@@ -84,65 +84,69 @@ var useFormatWatcher = function useFormatWatcher() {
84
84
  _useState18 = _slicedToArray(_useState17, 2),
85
85
  fontFamily = _useState18[0],
86
86
  setFontFamily = _useState18[1];
87
- var _useState19 = react.useState(false),
87
+ var _useState19 = react.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 = react.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 = react.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 = react.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 = react.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 = react.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 = react.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 = react.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 = react.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 = react.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 = react.useState(false),
128
128
  _useState40 = _slicedToArray(_useState39, 2),
129
- isRTL = _useState40[0],
130
- setIsRTL = _useState40[1];
131
- var _useState41 = react.useState(""),
129
+ canRedo = _useState40[0],
130
+ setCanRedo = _useState40[1];
131
+ var _useState41 = react.useState(false),
132
132
  _useState42 = _slicedToArray(_useState41, 2),
133
- codeLanguage = _useState42[0],
134
- setCodeLanguage = _useState42[1];
135
- var _useState43 = react.useState(function () {
133
+ isRTL = _useState42[0],
134
+ setIsRTL = _useState42[1];
135
+ var _useState43 = react.useState(""),
136
+ _useState44 = _slicedToArray(_useState43, 2),
137
+ codeLanguage = _useState44[0],
138
+ setCodeLanguage = _useState44[1];
139
+ var _useState45 = react.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 = react.useCallback(function () {
142
- var selection = lexical.$getSelection();
143
- if (lexical.$isRangeSelection(selection)) {
144
- var anchorNode = selection.anchor.getNode();
145
- var element = anchorNode.getKey() === "root" ? anchorNode : LexicalUtils.$findMatchingParent(anchorNode, function (e) {
146
+ var selection$1 = lexical.$getSelection();
147
+ if (lexical.$isRangeSelection(selection$1)) {
148
+ var anchorNode = selection$1.anchor.getNode();
149
+ var element = anchorNode.getKey() === "root" ? anchorNode : utils.$findMatchingParent(anchorNode, function (e) {
146
150
  var parent = e.getParent();
147
151
  return parent !== null && lexical.$isRootOrShadowRoot(parent);
148
152
  });
@@ -153,60 +157,61 @@ var useFormatWatcher = function useFormatWatcher() {
153
157
  var elementDOM = activeEditor.getElementByKey(elementKey);
154
158
 
155
159
  // Update text format
156
- setIsBold(selection.hasFormat("bold"));
157
- setIsItalic(selection.hasFormat("italic"));
158
- setIsUnderline(selection.hasFormat("underline"));
159
- setIsStrikethrough(selection.hasFormat("strikethrough"));
160
- setIsSubscript(selection.hasFormat("subscript"));
161
- setIsSuperscript(selection.hasFormat("superscript"));
162
- setIsCode(selection.hasFormat("code"));
160
+ setIsBold(selection$1.hasFormat("bold"));
161
+ setIsItalic(selection$1.hasFormat("italic"));
162
+ setIsUnderline(selection$1.hasFormat("underline"));
163
+ setIsStrikethrough(selection$1.hasFormat("strikethrough"));
164
+ setIsSubscript(selection$1.hasFormat("subscript"));
165
+ setIsSuperscript(selection$1.hasFormat("superscript"));
166
+ setIsCode(selection$1.hasFormat("code"));
163
167
  editor.read(function () {
164
- setIsRTL(LexicalSelection.$isParentElementRTL(selection));
168
+ setIsRTL(selection.$isParentElementRTL(selection$1));
165
169
  });
166
170
 
167
171
  // Update links
168
- var node = getSelectedNode(selection);
172
+ var node = getSelectedNode(selection$1);
169
173
  var parent = node.getParent();
170
- if (LexicalLink.$isLinkNode(parent) || LexicalLink.$isLinkNode(node)) {
174
+ if (link.$isLinkNode(parent) || link.$isLinkNode(node)) {
171
175
  setIsLink(true);
172
176
  } else {
173
177
  setIsLink(false);
174
178
  }
175
- var tableNode = LexicalUtils.$findMatchingParent(node, LexicalTable.$isTableNode);
176
- if (LexicalTable.$isTableNode(tableNode)) {
179
+ var tableNode = utils.$findMatchingParent(node, table.$isTableNode);
180
+ if (table.$isTableNode(tableNode)) {
177
181
  setRootType("table");
178
182
  } else {
179
183
  setRootType("root");
180
184
  }
181
185
  if (elementDOM !== null) {
182
186
  setSelectedElementKey(elementKey);
183
- if (LexicalList.$isListNode(element)) {
184
- var parentList = LexicalUtils.$getNearestNodeOfType(anchorNode, LexicalList.ListNode);
187
+ elementDOM && setAlign(getComputedStyle(elementDOM).textAlign);
188
+ if (list.$isListNode(element)) {
189
+ var parentList = utils.$getNearestNodeOfType(anchorNode, list.ListNode);
185
190
  var type = parentList ? parentList.getListType() : element.getListType();
186
191
  setBlockType(type);
187
192
  } else {
188
- var _type = LexicalRichText.$isHeadingNode(element) ? element.getTag() : element.getType();
193
+ var _type = richText.$isHeadingNode(element) ? element.getTag() : element.getType();
189
194
  if (_type in blockTypeToBlockName) {
190
195
  setBlockType(_type);
191
196
  }
192
- if (LexicalCode.$isCodeNode(element)) {
197
+ if (code.$isCodeNode(element)) {
193
198
  var language = element.getLanguage();
194
- setCodeLanguage(language ? LexicalCode.CODE_LANGUAGE_MAP[language] || language : "");
199
+ setCodeLanguage(language ? code.CODE_LANGUAGE_MAP[language] || language : "");
195
200
  return;
196
201
  }
197
202
  }
198
203
  }
199
204
  // Handle buttons
200
- setFontSize(parseInt(LexicalSelection.$getSelectionStyleValueForProperty(selection, "font-size", "16")) + "");
201
- setFontColor(LexicalSelection.$getSelectionStyleValueForProperty(selection, "color",
205
+ setFontSize(parseInt(selection.$getSelectionStyleValueForProperty(selection$1, "font-size", "16")) + "");
206
+ setFontColor(selection.$getSelectionStyleValueForProperty(selection$1, "color",
202
207
  // @ts-expect-error ignore
203
208
  // eslint-disable-next-line no-new-wrappers
204
209
  new String("#000")));
205
- setBgColor(LexicalSelection.$getSelectionStyleValueForProperty(selection, "background-color",
210
+ setBgColor(selection.$getSelectionStyleValueForProperty(selection$1, "background-color",
206
211
  // @ts-expect-error ignore
207
212
  // eslint-disable-next-line no-new-wrappers
208
213
  new String("#fff")));
209
- setFontFamily(LexicalSelection.$getSelectionStyleValueForProperty(selection, "font-family", "inherit"));
214
+ setFontFamily(selection.$getSelectionStyleValueForProperty(selection$1, "font-family", "inherit"));
210
215
  }
211
216
  }, []);
212
217
  react.useEffect(function () {
@@ -223,7 +228,7 @@ var useFormatWatcher = function useFormatWatcher() {
223
228
  });
224
229
  }, [activeEditor, $updateToolbar]);
225
230
  react.useEffect(function () {
226
- return LexicalUtils.mergeRegister(editor.registerEditableListener(function (editable) {
231
+ return utils.mergeRegister(editor.registerEditableListener(function (editable) {
227
232
  setIsEditable(editable);
228
233
  }), activeEditor.registerUpdateListener(function (_ref) {
229
234
  var editorState = _ref.editorState;
@@ -243,43 +248,43 @@ var useFormatWatcher = function useFormatWatcher() {
243
248
  activeEditor.update(function () {
244
249
  if (!utilities.isNil(currentSelection)) {
245
250
  lexical.$setSelection(currentSelection.clone());
246
- LexicalSelection.$patchStyleText(currentSelection, styles);
251
+ selection.$patchStyleText(currentSelection, styles);
247
252
  }
248
253
  });
249
254
  }, [activeEditor, currentSelection]);
250
255
  var formatBulletList = function formatBulletList() {
251
256
  setTimeout(function () {
252
257
  if (blockType !== "bullet") {
253
- editor.dispatchCommand(LexicalList.INSERT_UNORDERED_LIST_COMMAND, undefined);
258
+ editor.dispatchCommand(list.INSERT_UNORDERED_LIST_COMMAND, undefined);
254
259
  } else {
255
- editor.dispatchCommand(LexicalList.REMOVE_LIST_COMMAND, undefined);
260
+ editor.dispatchCommand(list.REMOVE_LIST_COMMAND, undefined);
256
261
  }
257
262
  }, 100);
258
263
  };
259
264
  var formatCheckList = function formatCheckList() {
260
265
  setTimeout(function () {
261
266
  if (blockType !== "check") {
262
- editor.dispatchCommand(LexicalList.INSERT_CHECK_LIST_COMMAND, undefined);
267
+ editor.dispatchCommand(list.INSERT_CHECK_LIST_COMMAND, undefined);
263
268
  } else {
264
- editor.dispatchCommand(LexicalList.REMOVE_LIST_COMMAND, undefined);
269
+ editor.dispatchCommand(list.REMOVE_LIST_COMMAND, undefined);
265
270
  }
266
271
  }, 100);
267
272
  };
268
273
  var formatNumberedList = function formatNumberedList() {
269
274
  setTimeout(function () {
270
275
  if (blockType !== "number") {
271
- editor.dispatchCommand(LexicalList.INSERT_ORDERED_LIST_COMMAND, undefined);
276
+ editor.dispatchCommand(list.INSERT_ORDERED_LIST_COMMAND, undefined);
272
277
  } else {
273
- editor.dispatchCommand(LexicalList.REMOVE_LIST_COMMAND, undefined);
278
+ editor.dispatchCommand(list.REMOVE_LIST_COMMAND, undefined);
274
279
  }
275
280
  }, 100);
276
281
  };
277
282
  var formatNormal = react.useCallback(function () {
278
283
  setTimeout(function () {
279
284
  activeEditor.update(function () {
280
- var selection = lexical.$getSelection();
281
- if (lexical.$isRangeSelection(selection)) {
282
- LexicalSelection.$setBlocksType(selection, function () {
285
+ var selection$1 = lexical.$getSelection();
286
+ if (lexical.$isRangeSelection(selection$1)) {
287
+ selection.$setBlocksType(selection$1, function () {
283
288
  return lexical.$createParagraphNode();
284
289
  });
285
290
  }
@@ -290,10 +295,10 @@ var useFormatWatcher = function useFormatWatcher() {
290
295
  if (blockType !== "quote") {
291
296
  setTimeout(function () {
292
297
  activeEditor.update(function () {
293
- var selection = lexical.$getSelection();
294
- if (lexical.$isRangeSelection(selection)) {
295
- LexicalSelection.$setBlocksType(selection, function () {
296
- return LexicalRichText.$createQuoteNode();
298
+ var selection$1 = lexical.$getSelection();
299
+ if (lexical.$isRangeSelection(selection$1)) {
300
+ selection.$setBlocksType(selection$1, function () {
301
+ return richText.$createQuoteNode();
297
302
  });
298
303
  }
299
304
  });
@@ -304,10 +309,10 @@ var useFormatWatcher = function useFormatWatcher() {
304
309
  if (blockType !== "code") {
305
310
  setTimeout(function () {
306
311
  activeEditor.update(function () {
307
- var selection = lexical.$getSelection();
308
- if (lexical.$isRangeSelection(selection)) {
309
- LexicalSelection.$setBlocksType(selection, function () {
310
- return LexicalCode.$createCodeNode();
312
+ var selection$1 = lexical.$getSelection();
313
+ if (lexical.$isRangeSelection(selection$1)) {
314
+ selection.$setBlocksType(selection$1, function () {
315
+ return code.$createCodeNode();
311
316
  });
312
317
  }
313
318
  });
@@ -318,10 +323,10 @@ var useFormatWatcher = function useFormatWatcher() {
318
323
  if (blockType !== headingSize) {
319
324
  setTimeout(function () {
320
325
  activeEditor.update(function () {
321
- var selection = lexical.$getSelection();
322
- if (lexical.$isRangeSelection(selection)) {
323
- LexicalSelection.$setBlocksType(selection, function () {
324
- return LexicalRichText.$createHeadingNode(headingSize);
326
+ var selection$1 = lexical.$getSelection();
327
+ if (lexical.$isRangeSelection(selection$1)) {
328
+ selection.$setBlocksType(selection$1, function () {
329
+ return richText.$createHeadingNode(headingSize);
325
330
  });
326
331
  }
327
332
  });
@@ -363,10 +368,10 @@ var useFormatWatcher = function useFormatWatcher() {
363
368
  }
364
369
  if (node.__format !== 0) {
365
370
  node.setFormat(0);
366
- LexicalUtils.$getNearestBlockElementAncestorOrThrow(node).setFormat("");
371
+ utils.$getNearestBlockElementAncestorOrThrow(node).setFormat("");
367
372
  }
368
373
  }
369
- } else if (LexicalRichText.$isHeadingNode(node) || LexicalRichText.$isQuoteNode(node)) {
374
+ } else if (richText.$isHeadingNode(node) || richText.$isQuoteNode(node)) {
370
375
  node.replace(lexical.$createParagraphNode(), true);
371
376
  }
372
377
  });
@@ -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,24 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var tool = {
6
+ alignCenter: "محاذاة المركز",
7
+ alignJustify: "محاذاة وضبط",
8
+ alignEnd: "محاذاة النهاية",
9
+ alignStart: "محاذاة البداية",
10
+ bold: "عريض",
11
+ clear: "مسح التنسيق",
12
+ hilight: "تسليط الضوء",
13
+ indentIn: "المسافة البادئة في",
14
+ underline: "تسطير",
15
+ strikethrough: "يتوسطه خط",
16
+ italic: "مائل",
17
+ indentOut: "مسافة بادئة للخارج"
18
+ };
19
+ var ar = {
20
+ tool: tool
21
+ };
22
+
23
+ exports.default = ar;
24
+ exports.tool = tool;
@@ -0,0 +1,24 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var tool = {
6
+ alignStart: "Align Start",
7
+ alignCenter: "Align Center",
8
+ alignEnd: "Align End",
9
+ alignJustify: "Align Justify",
10
+ bold: "Bold",
11
+ italic: "Italic",
12
+ underline: "Underline",
13
+ strikethrough: "Strikethrough",
14
+ indentOut: "Indent Out",
15
+ indentIn: "Indent In",
16
+ hilight: "Highlight",
17
+ clear: "Clear Formatting"
18
+ };
19
+ var en = {
20
+ tool: tool
21
+ };
22
+
23
+ exports.default = en;
24
+ exports.tool = tool;
@@ -0,0 +1,33 @@
1
+ 'use strict';
2
+
3
+ var core = require('@react-fabric/core');
4
+ var ar = require('./ar.json.js');
5
+ var en = require('./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
+ core.addTranslationBundle("lexical", {
31
+ en: en.default,
32
+ ar: ar.default
33
+ });
@@ -1,5 +1,6 @@
1
1
  'use strict';
2
2
 
3
+ require('./i18n/index.js');
3
4
  var LexicalEditor = require('./editor/LexicalEditor.js');
4
5
 
5
6
 
@@ -2,8 +2,8 @@
2
2
 
3
3
  var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
4
4
  var LexicalComposerContext = require('@lexical/react/LexicalComposerContext');
5
- var LexicalRichText = require('../../../../node_modules/@lexical/rich-text/LexicalRichText.js');
6
- var LexicalUtils = require('../../../../node_modules/@lexical/utils/LexicalUtils.js');
5
+ var richText = require('@lexical/rich-text');
6
+ var utils = require('@lexical/utils');
7
7
  var lexical = require('lexical');
8
8
  var react = require('react');
9
9
  var reactDom = require('react-dom');
@@ -184,7 +184,7 @@ function useDraggableBlockMenu(editor, anchorElem, isEditable) {
184
184
  if (!isDraggingBlockRef.current) {
185
185
  return false;
186
186
  }
187
- var _eventFiles = LexicalRichText.eventFiles(event),
187
+ var _eventFiles = richText.eventFiles(event),
188
188
  _eventFiles2 = _slicedToArray(_eventFiles, 1),
189
189
  isFileTransfer = _eventFiles2[0];
190
190
  if (isFileTransfer) {
@@ -210,7 +210,7 @@ function useDraggableBlockMenu(editor, anchorElem, isEditable) {
210
210
  if (!isDraggingBlockRef.current) {
211
211
  return false;
212
212
  }
213
- var _eventFiles3 = LexicalRichText.eventFiles(event),
213
+ var _eventFiles3 = richText.eventFiles(event),
214
214
  _eventFiles4 = _slicedToArray(_eventFiles3, 1),
215
215
  isFileTransfer = _eventFiles4[0];
216
216
  if (isFileTransfer) {
@@ -250,7 +250,7 @@ function useDraggableBlockMenu(editor, anchorElem, isEditable) {
250
250
  setDraggableBlockElem(null);
251
251
  return true;
252
252
  }
253
- return LexicalUtils.mergeRegister(editor.registerCommand(lexical.DRAGOVER_COMMAND, function (event) {
253
+ return utils.mergeRegister(editor.registerCommand(lexical.DRAGOVER_COMMAND, function (event) {
254
254
  return onDragover(event);
255
255
  }, lexical.COMMAND_PRIORITY_LOW), editor.registerCommand(lexical.DROP_COMMAND, function (event) {
256
256
  return onDrop(event);