@react-fabric/lexical 1.0.0-beta.6 → 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 (134) hide show
  1. package/{src/editor/Lexical.module.css → css/_lexical.css} +8 -4
  2. package/css/styles.css +24 -0
  3. package/dist/cjs/{packages/lexical/src/components → components}/StickyComponent.js +3 -4
  4. package/dist/cjs/{packages/lexical/src/editor → editor}/LexicalEditor.js +35 -10
  5. package/dist/cjs/{packages/lexical/src/hooks → hooks}/useFormatWatcher.js +154 -145
  6. package/dist/cjs/i18n/ar.json.js +24 -0
  7. package/dist/cjs/i18n/en.json.js +24 -0
  8. package/dist/cjs/i18n/index.js +33 -0
  9. package/dist/cjs/{packages/lexical/src/index.js → index.js} +1 -0
  10. package/dist/cjs/{packages/lexical/src/plugins → plugins}/DraggableBlockPlugin.js +5 -5
  11. package/dist/cjs/{packages/lexical/src/plugins → plugins}/ToolbarPlugin.js +55 -34
  12. package/dist/esm/{packages/lexical/src/components → components}/StickyComponent.js +3 -4
  13. package/dist/esm/{packages/lexical/src/editor → editor}/LexicalEditor.js +34 -9
  14. package/dist/esm/{packages/lexical/src/hooks → hooks}/useFormatWatcher.js +102 -93
  15. package/dist/esm/i18n/ar.json.js +21 -0
  16. package/dist/esm/i18n/en.json.js +21 -0
  17. package/dist/esm/i18n/index.js +33 -0
  18. package/dist/esm/{packages/lexical/src/index.js → index.js} +1 -0
  19. package/dist/esm/{packages/lexical/src/plugins → plugins}/DraggableBlockPlugin.js +2 -2
  20. package/dist/esm/{packages/lexical/src/plugins → plugins}/ToolbarPlugin.js +56 -35
  21. package/dist/types/editor/LexicalEditor.d.ts +25 -0
  22. package/dist/types/hooks/useFormatWatcher.d.ts +3 -2
  23. package/dist/types/i18n/index.d.ts +1 -0
  24. package/dist/types/index.d.ts +1 -0
  25. package/dist/types/nodes/StickyNode.d.ts +0 -1
  26. package/package.json +14 -13
  27. package/src/components/StickyComponent.tsx +4 -5
  28. package/src/editor/LexicalEditor.tsx +57 -26
  29. package/src/hooks/useFormatWatcher.ts +38 -31
  30. package/src/i18n/ar.json +16 -0
  31. package/src/i18n/en.json +16 -0
  32. package/src/i18n/index.ts +28 -0
  33. package/src/index.ts +2 -0
  34. package/src/plugins/ToolbarPlugin.tsx +56 -35
  35. package/dist/cjs/_virtual/prism.js +0 -5
  36. package/dist/cjs/editor/Lexical.module.css +0 -1
  37. package/dist/cjs/node_modules/@lexical/clipboard/LexicalClipboard.dev.js +0 -432
  38. package/dist/cjs/node_modules/@lexical/clipboard/LexicalClipboard.js +0 -21
  39. package/dist/cjs/node_modules/@lexical/clipboard/LexicalClipboard.prod.js +0 -27
  40. package/dist/cjs/node_modules/@lexical/code/LexicalCode.dev.js +0 -1139
  41. package/dist/cjs/node_modules/@lexical/code/LexicalCode.js +0 -25
  42. package/dist/cjs/node_modules/@lexical/code/LexicalCode.prod.js +0 -50
  43. package/dist/cjs/node_modules/@lexical/html/LexicalHtml.dev.js +0 -245
  44. package/dist/cjs/node_modules/@lexical/html/LexicalHtml.js +0 -19
  45. package/dist/cjs/node_modules/@lexical/html/LexicalHtml.prod.js +0 -18
  46. package/dist/cjs/node_modules/@lexical/link/LexicalLink.dev.js +0 -471
  47. package/dist/cjs/node_modules/@lexical/link/LexicalLink.js +0 -17
  48. package/dist/cjs/node_modules/@lexical/link/LexicalLink.prod.js +0 -24
  49. package/dist/cjs/node_modules/@lexical/list/LexicalList.dev.js +0 -1275
  50. package/dist/cjs/node_modules/@lexical/list/LexicalList.js +0 -29
  51. package/dist/cjs/node_modules/@lexical/list/LexicalList.prod.js +0 -29
  52. package/dist/cjs/node_modules/@lexical/rich-text/LexicalRichText.dev.js +0 -789
  53. package/dist/cjs/node_modules/@lexical/rich-text/LexicalRichText.js +0 -29
  54. package/dist/cjs/node_modules/@lexical/rich-text/LexicalRichText.prod.js +0 -26
  55. package/dist/cjs/node_modules/@lexical/selection/LexicalSelection.dev.js +0 -976
  56. package/dist/cjs/node_modules/@lexical/selection/LexicalSelection.js +0 -35
  57. package/dist/cjs/node_modules/@lexical/selection/LexicalSelection.prod.js +0 -35
  58. package/dist/cjs/node_modules/@lexical/table/LexicalTable.dev.js +0 -2792
  59. package/dist/cjs/node_modules/@lexical/table/LexicalTable.js +0 -23
  60. package/dist/cjs/node_modules/@lexical/table/LexicalTable.prod.js +0 -55
  61. package/dist/cjs/node_modules/@lexical/utils/LexicalUtils.dev.js +0 -888
  62. package/dist/cjs/node_modules/@lexical/utils/LexicalUtils.js +0 -35
  63. package/dist/cjs/node_modules/@lexical/utils/LexicalUtils.prod.js +0 -66
  64. package/dist/cjs/node_modules/@mdi/js/mdi.js +0 -8
  65. package/dist/cjs/node_modules/prismjs/components/prism-c.js +0 -82
  66. package/dist/cjs/node_modules/prismjs/components/prism-clike.js +0 -33
  67. package/dist/cjs/node_modules/prismjs/components/prism-cpp.js +0 -101
  68. package/dist/cjs/node_modules/prismjs/components/prism-css.js +0 -66
  69. package/dist/cjs/node_modules/prismjs/components/prism-java.js +0 -126
  70. package/dist/cjs/node_modules/prismjs/components/prism-javascript.js +0 -174
  71. package/dist/cjs/node_modules/prismjs/components/prism-markdown.js +0 -417
  72. package/dist/cjs/node_modules/prismjs/components/prism-markup.js +0 -188
  73. package/dist/cjs/node_modules/prismjs/components/prism-objectivec.js +0 -14
  74. package/dist/cjs/node_modules/prismjs/components/prism-powershell.js +0 -60
  75. package/dist/cjs/node_modules/prismjs/components/prism-python.js +0 -67
  76. package/dist/cjs/node_modules/prismjs/components/prism-rust.js +0 -130
  77. package/dist/cjs/node_modules/prismjs/components/prism-sql.js +0 -34
  78. package/dist/cjs/node_modules/prismjs/components/prism-swift.js +0 -150
  79. package/dist/cjs/node_modules/prismjs/components/prism-typescript.js +0 -62
  80. package/dist/cjs/node_modules/prismjs/prism.js +0 -1951
  81. package/dist/esm/_virtual/prism.js +0 -5
  82. package/dist/esm/editor/Lexical.module.css +0 -1
  83. package/dist/esm/node_modules/@lexical/clipboard/LexicalClipboard.dev.js +0 -423
  84. package/dist/esm/node_modules/@lexical/clipboard/LexicalClipboard.js +0 -19
  85. package/dist/esm/node_modules/@lexical/clipboard/LexicalClipboard.prod.js +0 -18
  86. package/dist/esm/node_modules/@lexical/code/LexicalCode.dev.js +0 -1121
  87. package/dist/esm/node_modules/@lexical/code/LexicalCode.js +0 -21
  88. package/dist/esm/node_modules/@lexical/code/LexicalCode.prod.js +0 -32
  89. package/dist/esm/node_modules/@lexical/html/LexicalHtml.dev.js +0 -244
  90. package/dist/esm/node_modules/@lexical/html/LexicalHtml.js +0 -18
  91. package/dist/esm/node_modules/@lexical/html/LexicalHtml.prod.js +0 -17
  92. package/dist/esm/node_modules/@lexical/link/LexicalLink.dev.js +0 -463
  93. package/dist/esm/node_modules/@lexical/link/LexicalLink.js +0 -17
  94. package/dist/esm/node_modules/@lexical/link/LexicalLink.prod.js +0 -16
  95. package/dist/esm/node_modules/@lexical/list/LexicalList.dev.js +0 -1262
  96. package/dist/esm/node_modules/@lexical/list/LexicalList.js +0 -23
  97. package/dist/esm/node_modules/@lexical/list/LexicalList.prod.js +0 -16
  98. package/dist/esm/node_modules/@lexical/rich-text/LexicalRichText.dev.js +0 -781
  99. package/dist/esm/node_modules/@lexical/rich-text/LexicalRichText.js +0 -23
  100. package/dist/esm/node_modules/@lexical/rich-text/LexicalRichText.prod.js +0 -18
  101. package/dist/esm/node_modules/@lexical/selection/LexicalSelection.dev.js +0 -957
  102. package/dist/esm/node_modules/@lexical/selection/LexicalSelection.js +0 -26
  103. package/dist/esm/node_modules/@lexical/selection/LexicalSelection.prod.js +0 -16
  104. package/dist/esm/node_modules/@lexical/table/LexicalTable.dev.js +0 -2754
  105. package/dist/esm/node_modules/@lexical/table/LexicalTable.js +0 -20
  106. package/dist/esm/node_modules/@lexical/table/LexicalTable.prod.js +0 -17
  107. package/dist/esm/node_modules/@lexical/utils/LexicalUtils.dev.js +0 -839
  108. package/dist/esm/node_modules/@lexical/utils/LexicalUtils.js +0 -26
  109. package/dist/esm/node_modules/@lexical/utils/LexicalUtils.prod.js +0 -17
  110. package/dist/esm/node_modules/@mdi/js/mdi.js +0 -7
  111. package/dist/esm/node_modules/prismjs/components/prism-c.js +0 -82
  112. package/dist/esm/node_modules/prismjs/components/prism-clike.js +0 -33
  113. package/dist/esm/node_modules/prismjs/components/prism-cpp.js +0 -101
  114. package/dist/esm/node_modules/prismjs/components/prism-css.js +0 -66
  115. package/dist/esm/node_modules/prismjs/components/prism-java.js +0 -126
  116. package/dist/esm/node_modules/prismjs/components/prism-javascript.js +0 -174
  117. package/dist/esm/node_modules/prismjs/components/prism-markdown.js +0 -417
  118. package/dist/esm/node_modules/prismjs/components/prism-markup.js +0 -188
  119. package/dist/esm/node_modules/prismjs/components/prism-objectivec.js +0 -14
  120. package/dist/esm/node_modules/prismjs/components/prism-powershell.js +0 -60
  121. package/dist/esm/node_modules/prismjs/components/prism-python.js +0 -67
  122. package/dist/esm/node_modules/prismjs/components/prism-rust.js +0 -130
  123. package/dist/esm/node_modules/prismjs/components/prism-sql.js +0 -34
  124. package/dist/esm/node_modules/prismjs/components/prism-swift.js +0 -150
  125. package/dist/esm/node_modules/prismjs/components/prism-typescript.js +0 -62
  126. package/dist/esm/node_modules/prismjs/prism.js +0 -1951
  127. /package/dist/cjs/{packages/lexical/src/editor → editor}/theme.js +0 -0
  128. /package/dist/cjs/{packages/lexical/src/nodes → nodes}/StickyNode.js +0 -0
  129. /package/dist/cjs/{packages/lexical/src/plugins → plugins}/StickyPlugin.js +0 -0
  130. /package/dist/cjs/{packages/lexical/src/utils → utils}/index.js +0 -0
  131. /package/dist/esm/{packages/lexical/src/editor → editor}/theme.js +0 -0
  132. /package/dist/esm/{packages/lexical/src/nodes → nodes}/StickyNode.js +0 -0
  133. /package/dist/esm/{packages/lexical/src/plugins → plugins}/StickyPlugin.js +0 -0
  134. /package/dist/esm/{packages/lexical/src/utils → utils}/index.js +0 -0
@@ -53,16 +53,17 @@ import {
53
53
  $getNearestNodeOfType,
54
54
  mergeRegister,
55
55
  } from "@lexical/utils";
56
+ import { isNil } from "@react-fabric/utilities";
56
57
  import {
57
58
  $createParagraphNode,
58
59
  $getSelection,
59
60
  $isRangeSelection,
60
61
  $isRootOrShadowRoot,
61
62
  $isTextNode,
63
+ $setSelection,
62
64
  CAN_REDO_COMMAND,
63
65
  CAN_UNDO_COMMAND,
64
66
  COMMAND_PRIORITY_CRITICAL,
65
- FOCUS_COMMAND,
66
67
  INDENT_CONTENT_COMMAND,
67
68
  OUTDENT_CONTENT_COMMAND,
68
69
  SELECTION_CHANGE_COMMAND,
@@ -71,7 +72,7 @@ import {
71
72
  type RangeSelection,
72
73
  type TextNode,
73
74
  } from "lexical";
74
- import { useCallback, useEffect, useState, useTransition } from "react";
75
+ import { useCallback, useEffect, useState } from "react";
75
76
 
76
77
  const blockTypeToBlockName = {
77
78
  bullet: "Bulleted List",
@@ -111,9 +112,9 @@ export function getSelectedNode(
111
112
  }
112
113
 
113
114
  export const useFormatWatcher = () => {
114
- const [, startTransition] = useTransition();
115
115
  const [editor] = useLexicalComposerContext();
116
116
  const [activeEditor, setActiveEditor] = useState(editor);
117
+ const [currentSelection, setCurrentSelection] = useState<AnyObject>();
117
118
  const [blockType, setBlockType] =
118
119
  useState<keyof typeof blockTypeToBlockName>("paragraph");
119
120
  const [rootType, setRootType] =
@@ -125,6 +126,7 @@ export const useFormatWatcher = () => {
125
126
  const [fontColor, setFontColor] = useState<string>("#000");
126
127
  const [bgColor, setBgColor] = useState<string>("#fff");
127
128
  const [fontFamily, setFontFamily] = useState<string>("Arial");
129
+ const [align, setAlign] = useState("");
128
130
  const [isLink, setIsLink] = useState(false);
129
131
  const [isBold, setIsBold] = useState(false);
130
132
  const [isItalic, setIsItalic] = useState(false);
@@ -166,7 +168,9 @@ export const useFormatWatcher = () => {
166
168
  setIsSubscript(selection.hasFormat("subscript"));
167
169
  setIsSuperscript(selection.hasFormat("superscript"));
168
170
  setIsCode(selection.hasFormat("code"));
169
- setIsRTL($isParentElementRTL(selection));
171
+ editor.read(() => {
172
+ setIsRTL($isParentElementRTL(selection));
173
+ });
170
174
 
171
175
  // Update links
172
176
  const node = getSelectedNode(selection);
@@ -186,6 +190,7 @@ export const useFormatWatcher = () => {
186
190
 
187
191
  if (elementDOM !== null) {
188
192
  setSelectedElementKey(elementKey);
193
+ elementDOM && setAlign(getComputedStyle(elementDOM).textAlign);
189
194
  if ($isListNode(element)) {
190
195
  const parentList = $getNearestNodeOfType<ListNode>(
191
196
  anchorNode,
@@ -218,41 +223,46 @@ export const useFormatWatcher = () => {
218
223
  ) + "",
219
224
  );
220
225
  setFontColor(
221
- $getSelectionStyleValueForProperty(selection, "color", "#000"),
226
+ $getSelectionStyleValueForProperty(
227
+ selection,
228
+ "color",
229
+ // @ts-expect-error ignore
230
+ // eslint-disable-next-line no-new-wrappers
231
+ new String("#000"),
232
+ ),
222
233
  );
223
234
  setBgColor(
224
235
  $getSelectionStyleValueForProperty(
225
236
  selection,
226
237
  "background-color",
227
- "#fff",
238
+ // @ts-expect-error ignore
239
+ // eslint-disable-next-line no-new-wrappers
240
+ new String("#fff"),
228
241
  ),
229
242
  );
230
243
  setFontFamily(
231
244
  $getSelectionStyleValueForProperty(selection, "font-family", "inherit"),
232
245
  );
233
246
  }
234
- }, [activeEditor]);
247
+ }, []);
235
248
 
236
249
  useEffect(() => {
237
250
  return editor.registerCommand(
238
- FOCUS_COMMAND,
251
+ SELECTION_CHANGE_COMMAND,
239
252
  (_payload, newEditor) => {
240
253
  setActiveEditor(newEditor);
254
+ setCurrentSelection($getSelection());
255
+ $updateToolbar();
241
256
  return false;
242
257
  },
243
258
  COMMAND_PRIORITY_CRITICAL,
244
259
  );
245
- }, [editor]);
260
+ }, [editor, $updateToolbar]);
246
261
 
247
262
  useEffect(() => {
248
- return activeEditor.registerCommand(
249
- SELECTION_CHANGE_COMMAND,
250
- (_payload, newEditor) => {
251
- $updateToolbar();
252
- return false;
253
- },
254
- COMMAND_PRIORITY_CRITICAL,
255
- );
263
+ activeEditor.getEditorState().read(() => {
264
+ $updateToolbar();
265
+ });
256
266
  }, [activeEditor, $updateToolbar]);
257
267
 
258
268
  useEffect(() => {
@@ -286,16 +296,15 @@ export const useFormatWatcher = () => {
286
296
 
287
297
  const applyStyleText = useCallback(
288
298
  (styles: Record<string, string>) => {
289
- setTimeout(() => {
290
- editor.update(() => {
291
- const selection = $getSelection();
292
- if ($isRangeSelection(selection)) {
293
- $patchStyleText(selection, styles);
294
- }
295
- });
296
- }, 100);
299
+ // activeEditor.focus();
300
+ activeEditor.update(() => {
301
+ if (!isNil(currentSelection)) {
302
+ $setSelection(currentSelection.clone());
303
+ $patchStyleText(currentSelection, styles);
304
+ }
305
+ });
297
306
  },
298
- [editor],
307
+ [activeEditor, currentSelection],
299
308
  );
300
309
 
301
310
  const formatBulletList = () => {
@@ -432,23 +441,20 @@ export const useFormatWatcher = () => {
432
441
 
433
442
  const onSizeChange = useCallback(
434
443
  (value: string) => {
435
- startTransition(() => setFontColor(value));
436
444
  applyStyleText({ "font-size": +value + "px" });
437
445
  },
438
446
  [applyStyleText],
439
447
  );
440
448
 
441
449
  const onFontColorSelect = useCallback(
442
- (value: string) => {
443
- startTransition(() => setFontColor(value));
450
+ (value: string = "#000000") => {
444
451
  applyStyleText({ color: value });
445
452
  },
446
453
  [applyStyleText],
447
454
  );
448
455
 
449
456
  const onBgColorSelect = useCallback(
450
- (value: string) => {
451
- startTransition(() => setBgColor(value));
457
+ (value: string = "#ffffff") => {
452
458
  applyStyleText({ "background-color": value });
453
459
  },
454
460
  [applyStyleText],
@@ -484,6 +490,7 @@ export const useFormatWatcher = () => {
484
490
  canUndo,
485
491
  canRedo,
486
492
  isRTL,
493
+ align,
487
494
  isEditable,
488
495
  codeLanguage,
489
496
  activeEditor,
@@ -0,0 +1,16 @@
1
+ {
2
+ "tool": {
3
+ "alignCenter": "محاذاة المركز",
4
+ "alignJustify": "محاذاة وضبط",
5
+ "alignEnd": "محاذاة النهاية",
6
+ "alignStart": "محاذاة البداية",
7
+ "bold": "عريض",
8
+ "clear": "مسح التنسيق",
9
+ "hilight": "تسليط الضوء",
10
+ "indentIn": "المسافة البادئة في",
11
+ "underline": "تسطير",
12
+ "strikethrough": "يتوسطه خط",
13
+ "italic": "مائل",
14
+ "indentOut": "مسافة بادئة للخارج"
15
+ }
16
+ }
@@ -0,0 +1,16 @@
1
+ {
2
+ "tool": {
3
+ "alignStart": "Align Start",
4
+ "alignCenter": "Align Center",
5
+ "alignEnd": "Align End",
6
+ "alignJustify": "Align Justify",
7
+ "bold": "Bold",
8
+ "italic": "Italic",
9
+ "underline": "Underline",
10
+ "strikethrough": "Strikethrough",
11
+ "indentOut": "Indent Out",
12
+ "indentIn": "Indent In",
13
+ "hilight": "Highlight",
14
+ "clear": "Clear Formatting"
15
+ }
16
+ }
@@ -0,0 +1,28 @@
1
+ /*
2
+ * React Fabric
3
+ * @version: 1.0.0
4
+ *
5
+ *
6
+ * The MIT License (MIT)
7
+ * Copyright (c) 2024 Adarsh Pastakia
8
+ *
9
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
10
+ * and associated documentation files (the "Software"), to deal in the Software without restriction,
11
+ * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
12
+ * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
13
+ * subject to the following conditions:
14
+ *
15
+ * The above copyright notice and this permission notice shall be included in all copies or substantial
16
+ * portions of the Software.
17
+ *
18
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
19
+ * TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
+ */
23
+
24
+ import { addTranslationBundle } from "@react-fabric/core";
25
+ import ar from "./ar.json";
26
+ import en from "./en.json";
27
+
28
+ addTranslationBundle("lexical", { en, ar });
package/src/index.ts CHANGED
@@ -21,4 +21,6 @@
21
21
  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
22
  */
23
23
 
24
+ import "./i18n";
25
+
24
26
  export { LexicalEditor } from "./editor/LexicalEditor";
@@ -1,14 +1,29 @@
1
1
  /*
2
- * Marble NEXT
3
- * @version : 4.0.0
4
- * @copyright : 2023
5
- * @license : Presight.ai
2
+ * React Fabric
3
+ * @version: 1.0.0
4
+ *
5
+ *
6
+ * The MIT License (MIT)
7
+ * Copyright (c) 2025 Adarsh Pastakia
8
+ *
9
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
10
+ * and associated documentation files (the "Software"), to deal in the Software without restriction,
11
+ * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
12
+ * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
13
+ * subject to the following conditions:
14
+ *
15
+ * The above copyright notice and this permission notice shall be included in all copies or substantial
16
+ * portions of the Software.
17
+ *
18
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
19
+ * TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
6
22
  */
7
23
 
8
24
  import {
9
25
  Button,
10
26
  ButtonGroup,
11
- CoreIcons,
12
27
  Divider,
13
28
  Dropdown,
14
29
  Icon,
@@ -35,14 +50,14 @@ const blockTypeToBlockName: KeyValue = {
35
50
  quote: "Quote",
36
51
  };
37
52
  const blockTypeToBlockIcon: KeyValue = {
38
- bullet: CoreIcons.formatListBullet,
39
- code: CoreIcons.formatCodeBlock,
53
+ bullet: "icon-[mdi--format-list-bulleted]",
54
+ code: "icon-[mdi--code-block-tags]",
40
55
  h1: " ",
41
56
  h2: " ",
42
57
  paragraph: "",
43
- h6: CoreIcons.formatCommentBlock,
44
- number: CoreIcons.formatListNumber,
45
- quote: CoreIcons.formatQuoteBlock,
58
+ h6: "icon-[mdi--comment-text-outline]",
59
+ number: "icon-[mdi--format-list-numbered]",
60
+ quote: "icon-[mdi--format-quote-open]",
46
61
  };
47
62
 
48
63
  const SIZES = Object.freeze([
@@ -89,7 +104,7 @@ export const ToolbarPlugin = () => {
89
104
  <Button
90
105
  variant="link"
91
106
  tabIndex={-1}
92
- altIcon={CoreIcons.caretDown}
107
+ altIcon="icon-[mdi--menu-down]"
93
108
  icon={blockTypeToBlockIcon[watch.blockType]}
94
109
  >
95
110
  {blockTypeToBlockName[watch.blockType]}
@@ -140,7 +155,7 @@ export const ToolbarPlugin = () => {
140
155
  <Divider vertical />
141
156
  <div>
142
157
  <Dropdown>
143
- <Button variant="link" altIcon={CoreIcons.caretDown}>
158
+ <Button variant="link" altIcon="icon-[mdi--menu-down]" tabIndex={-1}>
144
159
  {getValue(watch.fontSize + "", "16")}
145
160
  </Button>
146
161
  <Menu className="hide-icons">
@@ -159,9 +174,10 @@ export const ToolbarPlugin = () => {
159
174
  <ButtonGroup variant="link">
160
175
  <ButtonWrapper
161
176
  value="start"
162
- rtlFlip
163
177
  label={t("tool.alignStart")}
164
- icon={CoreIcons.alignLeft}
178
+ variant={watch.align === "start" ? "soft" : "link"}
179
+ color={watch.align === "start" ? "primary" : "default"}
180
+ icon={{ icon: "icon-[mdi--format-align-left]", rtlFlip: true }}
165
181
  onClick={() =>
166
182
  watch.activeEditor.dispatchCommand(FORMAT_ELEMENT_COMMAND, "start")
167
183
  }
@@ -169,25 +185,29 @@ export const ToolbarPlugin = () => {
169
185
  <ButtonWrapper
170
186
  value="center"
171
187
  label={t("tool.alignCenter")}
172
- icon={CoreIcons.alignCenter}
188
+ variant={watch.align === "center" ? "soft" : "link"}
189
+ color={watch.align === "center" ? "primary" : "default"}
190
+ icon="icon-[mdi--format-align-center]"
173
191
  onClick={() =>
174
192
  watch.activeEditor.dispatchCommand(FORMAT_ELEMENT_COMMAND, "center")
175
193
  }
176
194
  />
177
195
  <ButtonWrapper
178
196
  value="end"
179
- rtlFlip
180
197
  label={t("tool.alignEnd")}
181
- icon={CoreIcons.alignRight}
198
+ variant={watch.align === "end" ? "soft" : "link"}
199
+ color={watch.align === "end" ? "primary" : "default"}
200
+ icon={{ icon: "icon-[mdi--format-align-right]", rtlFlip: true }}
182
201
  onClick={() =>
183
202
  watch.activeEditor.dispatchCommand(FORMAT_ELEMENT_COMMAND, "end")
184
203
  }
185
204
  />
186
205
  <ButtonWrapper
187
206
  value="justify"
188
- rtlFlip
189
207
  label={t("tool.alignJustify")}
190
- icon={CoreIcons.alignJustify}
208
+ variant={watch.align === "justify" ? "soft" : "link"}
209
+ color={watch.align === "justify" ? "primary" : "default"}
210
+ icon={{ icon: "icon-[mdi--format-align-justify]", rtlFlip: true }}
191
211
  onClick={() =>
192
212
  watch.activeEditor.dispatchCommand(
193
213
  FORMAT_ELEMENT_COMMAND,
@@ -197,16 +217,14 @@ export const ToolbarPlugin = () => {
197
217
  />
198
218
  <ButtonWrapper
199
219
  value="justify"
200
- rtlFlip
201
220
  label={t("tool.indentOut")}
202
- icon={CoreIcons.formatIndentDecrease}
221
+ icon={{ icon: "icon-[mdi--format-indent-decrease]", rtlFlip: true }}
203
222
  onClick={() => watch.outdent()}
204
223
  />
205
224
  <ButtonWrapper
206
225
  value="justify"
207
- rtlFlip
208
- label={t("tool.identIn")}
209
- icon={CoreIcons.formatIndentIncrease}
226
+ label={t("tool.indentIn")}
227
+ icon={{ icon: "icon-[mdi--format-indent-increase]", rtlFlip: true }}
210
228
  onClick={() => watch.indent()}
211
229
  />
212
230
  </ButtonGroup>
@@ -215,7 +233,8 @@ export const ToolbarPlugin = () => {
215
233
  <ButtonWrapper
216
234
  value="bold"
217
235
  label={t("tool.bold")}
218
- icon={CoreIcons.formatBold}
236
+ icon="icon-[mdi--format-bold]"
237
+ color={textFormat.includes("bold") ? "primary" : "default"}
219
238
  onClick={() =>
220
239
  watch.activeEditor.dispatchCommand(FORMAT_TEXT_COMMAND, "bold")
221
240
  }
@@ -223,7 +242,8 @@ export const ToolbarPlugin = () => {
223
242
  <ButtonWrapper
224
243
  value="italic"
225
244
  label={t("tool.italic")}
226
- icon={CoreIcons.formatItalic}
245
+ icon="icon-[mdi--format-italic]"
246
+ color={textFormat.includes("italic") ? "primary" : "default"}
227
247
  onClick={() =>
228
248
  watch.activeEditor.dispatchCommand(FORMAT_TEXT_COMMAND, "italic")
229
249
  }
@@ -231,7 +251,8 @@ export const ToolbarPlugin = () => {
231
251
  <ButtonWrapper
232
252
  value="underline"
233
253
  label={t("tool.underline")}
234
- icon={CoreIcons.formatUnderline}
254
+ icon="icon-[mdi--format-underline]"
255
+ color={textFormat.includes("underline") ? "primary" : "default"}
235
256
  onClick={() =>
236
257
  watch.activeEditor.dispatchCommand(FORMAT_TEXT_COMMAND, "underline")
237
258
  }
@@ -239,7 +260,8 @@ export const ToolbarPlugin = () => {
239
260
  <ButtonWrapper
240
261
  value="strikethrough"
241
262
  label={t("tool.strikethrough")}
242
- icon={CoreIcons.formatStrikethrough}
263
+ icon="icon-[mdi--format-strikethrough-variant]"
264
+ color={textFormat.includes("strikethrough") ? "primary" : "default"}
243
265
  onClick={() =>
244
266
  watch.activeEditor.dispatchCommand(
245
267
  FORMAT_TEXT_COMMAND,
@@ -252,28 +274,27 @@ export const ToolbarPlugin = () => {
252
274
  <ColorInput
253
275
  {...{ noOutline: true }}
254
276
  value={watch.fontColor}
255
- onChange={(v = "#000") => watch.onFontColorSelect(v)}
256
- decorateStart={<Icon icon={CoreIcons.formatText} />}
277
+ onChange={(v) => watch.onFontColorSelect(v ?? undefined)}
278
+ decorateStart={<Icon icon="icon-[mdi--format-text]" />}
257
279
  />
258
280
  <ColorInput
259
281
  {...{ noOutline: true }}
260
282
  value={watch.bgColor}
261
- onChange={(v = "#fff") => watch.onBgColorSelect(v)}
262
- decorateStart={<Icon icon={CoreIcons.formatFill} />}
283
+ onChange={(v) => watch.onBgColorSelect(v ?? undefined)}
284
+ decorateStart={<Icon icon="icon-[mdi--format-color-fill]" />}
263
285
  />
264
286
  <ButtonWrapper
265
287
  value="hilight"
266
288
  label={t("tool.hilight")}
267
- icon={CoreIcons.formatHilight}
289
+ icon="icon-[mdi--format-color-highlight]"
268
290
  onClick={() => watch.onBgColorSelect("#fde68a")}
269
291
  />
270
292
  <ButtonWrapper
271
293
  value="hilight"
272
294
  label={t("tool.clear")}
273
- icon={CoreIcons.formatClear}
295
+ icon="icon-[mdi--format-clear]"
274
296
  onClick={() => watch.clearFormatting()}
275
297
  />
276
- <Divider />
277
298
  </div>
278
299
  );
279
300
  };
@@ -1,5 +0,0 @@
1
- 'use strict';
2
-
3
- var prism = {exports: {}};
4
-
5
- exports.__module = prism;
@@ -1 +0,0 @@
1
- @layer util{.lexicalEditor,.lexicalToolbar{margin:0 auto;width:21cm}.lexicalEditor :global{.editor-container.editor-container.editor-container{background-color:#fff;color:#0f172a;font-family:Sakkal Majalla;font-size:18px}.editor-heading-h1{font-size:1.5em;margin-bottom:1.5em;text-transform:capitalize}.editor-heading-h1,.editor-heading-h2{font-weight:600;line-height:1.5;margin-top:1.5em;padding:0 4px}.editor-heading-h2{font-size:1.25em;margin-bottom:1em}.editor-heading-h6{color:#b45309;font-size:.875em;font-weight:600;line-height:1.25;margin-bottom:1.5em;margin-top:1.5em}.editor-paragraph{font-size:1em}.editor-paragraph,.editor-quote{line-height:1.5;margin-bottom:1.5em;margin-top:1.5em}.editor-quote{border-color:#64748b;padding-inline-start:1em}.editor-code,.editor-quote{border-inline-start-width:4px;color:#1e293b;display:block;font-size:1.125em}.editor-code{background-color:#e2e8f0;line-height:1.5;margin-bottom:1.5em;margin-top:1.5em;padding:1em}.editor-textUnderline{text-decoration:underline}.editor-textStrikethrough{text-decoration:line-through}.editor-textUnderlineStrikethrough{text-decoration:underline line-through}.editor-page-break{page-break-after:always}.editor-no-break{page-break-inside:avoid}.editor-textSmall{font-size:.875em}.editor-textBold{font-weight:600}.editor-textItalic{font-style:italic}.editor-textMuted{color:#4b5563}.editor-list-ul{list-style:disc;padding-inline-start:.5em}.editor-list-ol{list-style:decimal;padding-inline-start:.5em}.editor-listItem{margin-inline-start:1em;text-align:start}@media print{body,html{margin:0;min-height:100vh}div,h1,h2,h3,h4,h5,h6,p,span{box-sizing:border-box}body.report-template{background-size:0;min-height:100vh}body:after{background-image:inherit;content:"";height:100vh;inset:0;margin:0 auto;max-width:21cm;position:fixed;-webkit-print-color-adjust:exact;print-color-adjust:exact;width:100vw;z-index:10}.editor-page-break>div,.sticky__container{display:none}.editor-container{position:relative}.editor-editor{box-sizing:border-box;padding:0 2cm}}}}