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

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 (39) hide show
  1. package/css/_lexical.css +67 -9
  2. package/dist/cjs/editor/LexicalEditor.js +34 -11
  3. package/dist/cjs/hooks/useFormatWatcher.js +54 -56
  4. package/dist/cjs/i18n/{ar.json.js → ar/lexical.json.js} +10 -4
  5. package/dist/cjs/i18n/{en.json.js → en/lexical.json.js} +7 -1
  6. package/dist/cjs/i18n/index.js +4 -4
  7. package/dist/cjs/plugins/CommentPlugin.js +471 -0
  8. package/dist/cjs/plugins/DraggableBlockPlugin.js +10 -13
  9. package/dist/esm/editor/LexicalEditor.js +35 -12
  10. package/dist/esm/hooks/useFormatWatcher.js +54 -56
  11. package/dist/esm/i18n/{ar.json.js → ar/lexical.json.js} +9 -5
  12. package/dist/esm/i18n/{en.json.js → en/lexical.json.js} +6 -2
  13. package/dist/esm/i18n/index.js +2 -2
  14. package/dist/esm/plugins/CommentPlugin.js +471 -0
  15. package/dist/esm/plugins/DraggableBlockPlugin.js +11 -14
  16. package/dist/types/editor/LexicalEditor.d.ts +13 -4
  17. package/dist/types/hooks/useFormatWatcher.d.ts +1 -1
  18. package/dist/types/plugins/CommentPlugin.d.ts +5 -0
  19. package/dist/types/plugins/DraggableBlockPlugin.d.ts +3 -2
  20. package/package.json +14 -13
  21. package/src/editor/LexicalEditor.tsx +66 -19
  22. package/src/hooks/useFormatWatcher.ts +0 -2
  23. package/src/i18n/{ar.json → ar/lexical.json} +6 -4
  24. package/src/i18n/{en.json → en/lexical.json} +3 -1
  25. package/src/i18n/index.ts +2 -2
  26. package/src/plugins/CommentPlugin.tsx +554 -0
  27. package/src/plugins/DraggableBlockPlugin.tsx +8 -13
  28. package/dist/cjs/components/StickyComponent.js +0 -220
  29. package/dist/cjs/nodes/StickyNode.js +0 -218
  30. package/dist/cjs/plugins/StickyPlugin.js +0 -20
  31. package/dist/esm/components/StickyComponent.js +0 -220
  32. package/dist/esm/nodes/StickyNode.js +0 -216
  33. package/dist/esm/plugins/StickyPlugin.js +0 -20
  34. package/dist/types/components/StickyComponent.d.ts +0 -9
  35. package/dist/types/nodes/StickyNode.d.ts +0 -34
  36. package/dist/types/plugins/StickyPlugin.d.ts +0 -1
  37. package/src/components/StickyComponent.tsx +0 -270
  38. package/src/nodes/StickyNode.tsx +0 -249
  39. package/src/plugins/StickyPlugin.ts +0 -38
@@ -65,83 +65,83 @@ var useFormatWatcher = function useFormatWatcher() {
65
65
  rootType = _useState8[0],
66
66
  setRootType = _useState8[1];
67
67
  var _useState9 = useState(null),
68
- _useState10 = _slicedToArray(_useState9, 2),
69
- selectedElementKey = _useState10[0],
70
- setSelectedElementKey = _useState10[1];
71
- var _useState11 = useState("16"),
68
+ _useState0 = _slicedToArray(_useState9, 2),
69
+ selectedElementKey = _useState0[0],
70
+ setSelectedElementKey = _useState0[1];
71
+ var _useState1 = useState("16"),
72
+ _useState10 = _slicedToArray(_useState1, 2),
73
+ fontSize = _useState10[0],
74
+ setFontSize = _useState10[1];
75
+ var _useState11 = useState("#000"),
72
76
  _useState12 = _slicedToArray(_useState11, 2),
73
- fontSize = _useState12[0],
74
- setFontSize = _useState12[1];
75
- var _useState13 = useState("#000"),
77
+ fontColor = _useState12[0],
78
+ setFontColor = _useState12[1];
79
+ var _useState13 = useState("#fff"),
76
80
  _useState14 = _slicedToArray(_useState13, 2),
77
- fontColor = _useState14[0],
78
- setFontColor = _useState14[1];
79
- var _useState15 = useState("#fff"),
81
+ bgColor = _useState14[0],
82
+ setBgColor = _useState14[1];
83
+ var _useState15 = useState("Arial"),
80
84
  _useState16 = _slicedToArray(_useState15, 2),
81
- bgColor = _useState16[0],
82
- setBgColor = _useState16[1];
83
- var _useState17 = useState("Arial"),
85
+ fontFamily = _useState16[0],
86
+ setFontFamily = _useState16[1];
87
+ var _useState17 = useState(""),
84
88
  _useState18 = _slicedToArray(_useState17, 2),
85
- fontFamily = _useState18[0],
86
- setFontFamily = _useState18[1];
87
- var _useState19 = useState(""),
89
+ align = _useState18[0],
90
+ setAlign = _useState18[1];
91
+ var _useState19 = useState(false),
88
92
  _useState20 = _slicedToArray(_useState19, 2),
89
- align = _useState20[0],
90
- setAlign = _useState20[1];
93
+ isLink = _useState20[0],
94
+ setIsLink = _useState20[1];
91
95
  var _useState21 = useState(false),
92
96
  _useState22 = _slicedToArray(_useState21, 2),
93
- isLink = _useState22[0],
94
- setIsLink = _useState22[1];
97
+ isBold = _useState22[0],
98
+ setIsBold = _useState22[1];
95
99
  var _useState23 = useState(false),
96
100
  _useState24 = _slicedToArray(_useState23, 2),
97
- isBold = _useState24[0],
98
- setIsBold = _useState24[1];
101
+ isItalic = _useState24[0],
102
+ setIsItalic = _useState24[1];
99
103
  var _useState25 = useState(false),
100
104
  _useState26 = _slicedToArray(_useState25, 2),
101
- isItalic = _useState26[0],
102
- setIsItalic = _useState26[1];
105
+ isUnderline = _useState26[0],
106
+ setIsUnderline = _useState26[1];
103
107
  var _useState27 = useState(false),
104
108
  _useState28 = _slicedToArray(_useState27, 2),
105
- isUnderline = _useState28[0],
106
- setIsUnderline = _useState28[1];
109
+ isStrikethrough = _useState28[0],
110
+ setIsStrikethrough = _useState28[1];
107
111
  var _useState29 = useState(false),
108
112
  _useState30 = _slicedToArray(_useState29, 2),
109
- isStrikethrough = _useState30[0],
110
- setIsStrikethrough = _useState30[1];
113
+ isSubscript = _useState30[0],
114
+ setIsSubscript = _useState30[1];
111
115
  var _useState31 = useState(false),
112
116
  _useState32 = _slicedToArray(_useState31, 2),
113
- isSubscript = _useState32[0],
114
- setIsSubscript = _useState32[1];
117
+ isSuperscript = _useState32[0],
118
+ setIsSuperscript = _useState32[1];
115
119
  var _useState33 = useState(false),
116
120
  _useState34 = _slicedToArray(_useState33, 2),
117
- isSuperscript = _useState34[0],
118
- setIsSuperscript = _useState34[1];
121
+ isCode = _useState34[0],
122
+ setIsCode = _useState34[1];
119
123
  var _useState35 = useState(false),
120
124
  _useState36 = _slicedToArray(_useState35, 2),
121
- isCode = _useState36[0],
122
- setIsCode = _useState36[1];
125
+ canUndo = _useState36[0],
126
+ setCanUndo = _useState36[1];
123
127
  var _useState37 = useState(false),
124
128
  _useState38 = _slicedToArray(_useState37, 2),
125
- canUndo = _useState38[0],
126
- setCanUndo = _useState38[1];
129
+ canRedo = _useState38[0],
130
+ setCanRedo = _useState38[1];
127
131
  var _useState39 = useState(false),
128
132
  _useState40 = _slicedToArray(_useState39, 2),
129
- canRedo = _useState40[0],
130
- setCanRedo = _useState40[1];
131
- var _useState41 = useState(false),
133
+ isRTL = _useState40[0],
134
+ setIsRTL = _useState40[1];
135
+ var _useState41 = useState(""),
132
136
  _useState42 = _slicedToArray(_useState41, 2),
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 () {
137
+ codeLanguage = _useState42[0],
138
+ setCodeLanguage = _useState42[1];
139
+ var _useState43 = useState(function () {
140
140
  return editor.isEditable();
141
141
  }),
142
- _useState46 = _slicedToArray(_useState45, 2),
143
- isEditable = _useState46[0],
144
- setIsEditable = _useState46[1];
142
+ _useState44 = _slicedToArray(_useState43, 2),
143
+ isEditable = _useState44[0],
144
+ setIsEditable = _useState44[1];
145
145
  var $updateToolbar = useCallback(function () {
146
146
  var selection = $getSelection();
147
147
  if ($isRangeSelection(selection)) {
@@ -205,11 +205,9 @@ var useFormatWatcher = function useFormatWatcher() {
205
205
  setFontSize(parseInt($getSelectionStyleValueForProperty(selection, "font-size", "16")) + "");
206
206
  setFontColor($getSelectionStyleValueForProperty(selection, "color",
207
207
  // @ts-expect-error ignore
208
- // eslint-disable-next-line no-new-wrappers
209
208
  new String("#000")));
210
209
  setBgColor($getSelectionStyleValueForProperty(selection, "background-color",
211
210
  // @ts-expect-error ignore
212
- // eslint-disable-next-line no-new-wrappers
213
211
  new String("#fff")));
214
212
  setFontFamily($getSelectionStyleValueForProperty(selection, "font-family", "inherit"));
215
213
  }
@@ -397,20 +395,20 @@ var useFormatWatcher = function useFormatWatcher() {
397
395
  }, [applyStyleText]);
398
396
 
399
397
  // @ts-expect-error ignore
400
- window.$getSelection = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
401
- return _regeneratorRuntime.wrap(function _callee$(_context) {
398
+ window.$getSelection = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
399
+ return _regeneratorRuntime.wrap(function (_context) {
402
400
  while (1) switch (_context.prev = _context.next) {
403
401
  case 0:
404
- _context.next = 2;
402
+ _context.next = 1;
405
403
  return new Promise(function (resolve) {
406
404
  activeEditor.update(function () {
407
405
  var selection = $getSelection();
408
406
  resolve(selection);
409
407
  });
410
408
  });
411
- case 2:
409
+ case 1:
412
410
  return _context.abrupt("return", _context.sent);
413
- case 3:
411
+ case 2:
414
412
  case "end":
415
413
  return _context.stop();
416
414
  }
@@ -1,21 +1,25 @@
1
1
  'use client';
2
2
 
3
+ var addComment = "أضف تعليقا";
4
+ var reply = "رد";
3
5
  var tool = {
4
6
  alignCenter: "محاذاة المركز",
5
- alignJustify: "محاذاة وضبط",
6
7
  alignEnd: "محاذاة النهاية",
8
+ alignJustify: "محاذاة وضبط",
7
9
  alignStart: "محاذاة البداية",
8
10
  bold: "عريض",
9
11
  clear: "مسح التنسيق",
10
12
  hilight: "تسليط الضوء",
11
13
  indentIn: "المسافة البادئة في",
12
- underline: "تسطير",
13
- strikethrough: "يتوسطه خط",
14
+ indentOut: "مسافة بادئة للخارج",
14
15
  italic: "مائل",
15
- indentOut: "مسافة بادئة للخارج"
16
+ strikethrough: "يتوسطه خط",
17
+ underline: "تسطير"
16
18
  };
17
19
  var ar = {
20
+ addComment: addComment,
21
+ reply: reply,
18
22
  tool: tool
19
23
  };
20
24
 
21
- export { ar as default, tool };
25
+ export { addComment, ar as default, reply, tool };
@@ -14,8 +14,12 @@ var tool = {
14
14
  hilight: "Highlight",
15
15
  clear: "Clear Formatting"
16
16
  };
17
+ var addComment = "Add comment";
18
+ var reply = "Reply";
17
19
  var en = {
18
- tool: tool
20
+ tool: tool,
21
+ addComment: addComment,
22
+ reply: reply
19
23
  };
20
24
 
21
- export { en as default, tool };
25
+ export { addComment, en as default, reply, tool };
@@ -1,8 +1,8 @@
1
1
  'use client';
2
2
 
3
3
  import { addTranslationBundle } from '@react-fabric/core';
4
- import ar from './ar.json.js';
5
- import en from './en.json.js';
4
+ import ar from './ar/lexical.json.js';
5
+ import en from './en/lexical.json.js';
6
6
 
7
7
  /*
8
8
  * React Fabric