@react-fabric/lexical 1.0.0-beta.4 → 1.0.0-beta.41
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.
- package/{src/editor/Lexical.module.css → css/_lexical.css} +4 -4
- package/css/styles.css +24 -0
- package/dist/cjs/packages/lexical/src/editor/LexicalEditor.js +2 -3
- package/dist/cjs/packages/lexical/src/hooks/useFormatWatcher.js +81 -76
- package/dist/cjs/packages/lexical/src/plugins/ToolbarPlugin.js +4 -6
- package/dist/esm/packages/lexical/src/editor/LexicalEditor.js +2 -3
- package/dist/esm/packages/lexical/src/hooks/useFormatWatcher.js +82 -77
- package/dist/esm/packages/lexical/src/plugins/ToolbarPlugin.js +4 -6
- package/dist/types/hooks/useFormatWatcher.d.ts +2 -2
- package/package.json +9 -7
- package/src/editor/LexicalEditor.tsx +2 -3
- package/src/hooks/useFormatWatcher.ts +28 -27
- package/src/plugins/ToolbarPlugin.tsx +2 -2
- package/dist/cjs/editor/Lexical.module.css +0 -1
- package/dist/esm/editor/Lexical.module.css +0 -1
|
@@ -23,14 +23,14 @@
|
|
|
23
23
|
|
|
24
24
|
/* stylelint-disable custom-property-pattern */
|
|
25
25
|
|
|
26
|
-
@layer
|
|
27
|
-
.lexicalEditor,
|
|
28
|
-
.lexicalToolbar {
|
|
26
|
+
@layer utilities {
|
|
27
|
+
.fabric-lexicalEditor,
|
|
28
|
+
.fabric-lexicalToolbar {
|
|
29
29
|
width: 21cm;
|
|
30
30
|
margin: 0 auto;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
.lexicalEditor
|
|
33
|
+
.fabric-lexicalEditor {
|
|
34
34
|
.editor-container.editor-container.editor-container {
|
|
35
35
|
/* stylelint-disable-next-line font-family-no-missing-generic-family-keyword */
|
|
36
36
|
font-family: "Sakkal Majalla";
|
package/css/styles.css
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/*
|
|
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.
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
@import "./_lexical.css";
|
|
@@ -21,7 +21,6 @@ var react = require('react');
|
|
|
21
21
|
var StickyNode = require('../nodes/StickyNode.js');
|
|
22
22
|
var DraggableBlockPlugin = require('../plugins/DraggableBlockPlugin.js');
|
|
23
23
|
var StickyPlugin = require('../plugins/StickyPlugin.js');
|
|
24
|
-
var Lexical_module = require('./Lexical.module.css');
|
|
25
24
|
var theme = require('./theme.js');
|
|
26
25
|
var ToolbarPlugin = require('../plugins/ToolbarPlugin.js');
|
|
27
26
|
var jsxRuntime = require('react/jsx-runtime');
|
|
@@ -108,7 +107,7 @@ var LexicalEditor = function LexicalEditor(_ref) {
|
|
|
108
107
|
return !publishMode ? /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
109
108
|
className: "lexical-scroller area-content overflow-auto",
|
|
110
109
|
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
111
|
-
className: classNames(
|
|
110
|
+
className: classNames("fabric-lexicalToolbar", "sticky top-0 z-1"),
|
|
112
111
|
children: /*#__PURE__*/jsxRuntime.jsx(core.Header, {
|
|
113
112
|
className: "bg-base",
|
|
114
113
|
children: /*#__PURE__*/jsxRuntime.jsx(ToolbarPlugin.ToolbarPlugin, {})
|
|
@@ -124,7 +123,7 @@ var LexicalEditor = function LexicalEditor(_ref) {
|
|
|
124
123
|
colorScheme: "light",
|
|
125
124
|
children: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
126
125
|
role: "none",
|
|
127
|
-
className: classNames(
|
|
126
|
+
className: classNames("fabric-lexicalEditor", "lexical-container relative bg-white min-h-full mx-auto shadow-md print:shadow-none"),
|
|
128
127
|
onDragOver: function onDragOver(e) {
|
|
129
128
|
return e.stopPropagation();
|
|
130
129
|
},
|
|
@@ -11,6 +11,7 @@ var LexicalRichText = require('../../../../node_modules/@lexical/rich-text/Lexic
|
|
|
11
11
|
var LexicalSelection = require('../../../../node_modules/@lexical/selection/LexicalSelection.js');
|
|
12
12
|
var LexicalTable = require('../../../../node_modules/@lexical/table/LexicalTable.js');
|
|
13
13
|
var LexicalUtils = require('../../../../node_modules/@lexical/utils/LexicalUtils.js');
|
|
14
|
+
var utilities = require('@react-fabric/utilities');
|
|
14
15
|
var lexical = require('lexical');
|
|
15
16
|
var react = require('react');
|
|
16
17
|
|
|
@@ -54,88 +55,92 @@ var useFormatWatcher = function useFormatWatcher() {
|
|
|
54
55
|
_useState2 = _slicedToArray(_useState, 2),
|
|
55
56
|
activeEditor = _useState2[0],
|
|
56
57
|
setActiveEditor = _useState2[1];
|
|
57
|
-
var _useState3 = react.useState(
|
|
58
|
+
var _useState3 = react.useState(),
|
|
58
59
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
var _useState5 = react.useState("
|
|
60
|
+
currentSelection = _useState4[0],
|
|
61
|
+
setCurrentSelection = _useState4[1];
|
|
62
|
+
var _useState5 = react.useState("paragraph"),
|
|
62
63
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
var _useState7 = react.useState(
|
|
64
|
+
blockType = _useState6[0],
|
|
65
|
+
setBlockType = _useState6[1];
|
|
66
|
+
var _useState7 = react.useState("root"),
|
|
66
67
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
var _useState9 = react.useState(
|
|
68
|
+
rootType = _useState8[0],
|
|
69
|
+
setRootType = _useState8[1];
|
|
70
|
+
var _useState9 = react.useState(null),
|
|
70
71
|
_useState10 = _slicedToArray(_useState9, 2),
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
var _useState11 = react.useState("
|
|
72
|
+
selectedElementKey = _useState10[0],
|
|
73
|
+
setSelectedElementKey = _useState10[1];
|
|
74
|
+
var _useState11 = react.useState("16"),
|
|
74
75
|
_useState12 = _slicedToArray(_useState11, 2),
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
var _useState13 = react.useState("#
|
|
76
|
+
fontSize = _useState12[0],
|
|
77
|
+
setFontSize = _useState12[1];
|
|
78
|
+
var _useState13 = react.useState("#000"),
|
|
78
79
|
_useState14 = _slicedToArray(_useState13, 2),
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
var _useState15 = react.useState("
|
|
80
|
+
fontColor = _useState14[0],
|
|
81
|
+
setFontColor = _useState14[1];
|
|
82
|
+
var _useState15 = react.useState("#fff"),
|
|
82
83
|
_useState16 = _slicedToArray(_useState15, 2),
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
var _useState17 = react.useState(
|
|
84
|
+
bgColor = _useState16[0],
|
|
85
|
+
setBgColor = _useState16[1];
|
|
86
|
+
var _useState17 = react.useState("Arial"),
|
|
86
87
|
_useState18 = _slicedToArray(_useState17, 2),
|
|
87
|
-
|
|
88
|
-
|
|
88
|
+
fontFamily = _useState18[0],
|
|
89
|
+
setFontFamily = _useState18[1];
|
|
89
90
|
var _useState19 = react.useState(false),
|
|
90
91
|
_useState20 = _slicedToArray(_useState19, 2),
|
|
91
|
-
|
|
92
|
-
|
|
92
|
+
isLink = _useState20[0],
|
|
93
|
+
setIsLink = _useState20[1];
|
|
93
94
|
var _useState21 = react.useState(false),
|
|
94
95
|
_useState22 = _slicedToArray(_useState21, 2),
|
|
95
|
-
|
|
96
|
-
|
|
96
|
+
isBold = _useState22[0],
|
|
97
|
+
setIsBold = _useState22[1];
|
|
97
98
|
var _useState23 = react.useState(false),
|
|
98
99
|
_useState24 = _slicedToArray(_useState23, 2),
|
|
99
|
-
|
|
100
|
-
|
|
100
|
+
isItalic = _useState24[0],
|
|
101
|
+
setIsItalic = _useState24[1];
|
|
101
102
|
var _useState25 = react.useState(false),
|
|
102
103
|
_useState26 = _slicedToArray(_useState25, 2),
|
|
103
|
-
|
|
104
|
-
|
|
104
|
+
isUnderline = _useState26[0],
|
|
105
|
+
setIsUnderline = _useState26[1];
|
|
105
106
|
var _useState27 = react.useState(false),
|
|
106
107
|
_useState28 = _slicedToArray(_useState27, 2),
|
|
107
|
-
|
|
108
|
-
|
|
108
|
+
isStrikethrough = _useState28[0],
|
|
109
|
+
setIsStrikethrough = _useState28[1];
|
|
109
110
|
var _useState29 = react.useState(false),
|
|
110
111
|
_useState30 = _slicedToArray(_useState29, 2),
|
|
111
|
-
|
|
112
|
-
|
|
112
|
+
isSubscript = _useState30[0],
|
|
113
|
+
setIsSubscript = _useState30[1];
|
|
113
114
|
var _useState31 = react.useState(false),
|
|
114
115
|
_useState32 = _slicedToArray(_useState31, 2),
|
|
115
|
-
|
|
116
|
-
|
|
116
|
+
isSuperscript = _useState32[0],
|
|
117
|
+
setIsSuperscript = _useState32[1];
|
|
117
118
|
var _useState33 = react.useState(false),
|
|
118
119
|
_useState34 = _slicedToArray(_useState33, 2),
|
|
119
|
-
|
|
120
|
-
|
|
120
|
+
isCode = _useState34[0],
|
|
121
|
+
setIsCode = _useState34[1];
|
|
121
122
|
var _useState35 = react.useState(false),
|
|
122
123
|
_useState36 = _slicedToArray(_useState35, 2),
|
|
123
|
-
|
|
124
|
-
|
|
124
|
+
canUndo = _useState36[0],
|
|
125
|
+
setCanUndo = _useState36[1];
|
|
125
126
|
var _useState37 = react.useState(false),
|
|
126
127
|
_useState38 = _slicedToArray(_useState37, 2),
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
var _useState39 = react.useState(
|
|
128
|
+
canRedo = _useState38[0],
|
|
129
|
+
setCanRedo = _useState38[1];
|
|
130
|
+
var _useState39 = react.useState(false),
|
|
130
131
|
_useState40 = _slicedToArray(_useState39, 2),
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
var _useState41 = react.useState(
|
|
132
|
+
isRTL = _useState40[0],
|
|
133
|
+
setIsRTL = _useState40[1];
|
|
134
|
+
var _useState41 = react.useState(""),
|
|
135
|
+
_useState42 = _slicedToArray(_useState41, 2),
|
|
136
|
+
codeLanguage = _useState42[0],
|
|
137
|
+
setCodeLanguage = _useState42[1];
|
|
138
|
+
var _useState43 = react.useState(function () {
|
|
134
139
|
return editor.isEditable();
|
|
135
140
|
}),
|
|
136
|
-
|
|
137
|
-
isEditable =
|
|
138
|
-
setIsEditable =
|
|
141
|
+
_useState44 = _slicedToArray(_useState43, 2),
|
|
142
|
+
isEditable = _useState44[0],
|
|
143
|
+
setIsEditable = _useState44[1];
|
|
139
144
|
var $updateToolbar = react.useCallback(function () {
|
|
140
145
|
var selection = lexical.$getSelection();
|
|
141
146
|
if (lexical.$isRangeSelection(selection)) {
|
|
@@ -194,22 +199,29 @@ var useFormatWatcher = function useFormatWatcher() {
|
|
|
194
199
|
}
|
|
195
200
|
// Handle buttons
|
|
196
201
|
setFontSize(parseInt(LexicalSelection.$getSelectionStyleValueForProperty(selection, "font-size", "16")) + "");
|
|
197
|
-
setFontColor(LexicalSelection.$getSelectionStyleValueForProperty(selection, "color",
|
|
198
|
-
|
|
202
|
+
setFontColor(LexicalSelection.$getSelectionStyleValueForProperty(selection, "color",
|
|
203
|
+
// @ts-expect-error ignore
|
|
204
|
+
// eslint-disable-next-line no-new-wrappers
|
|
205
|
+
new String("#000")));
|
|
206
|
+
setBgColor(LexicalSelection.$getSelectionStyleValueForProperty(selection, "background-color",
|
|
207
|
+
// @ts-expect-error ignore
|
|
208
|
+
// eslint-disable-next-line no-new-wrappers
|
|
209
|
+
new String("#fff")));
|
|
199
210
|
setFontFamily(LexicalSelection.$getSelectionStyleValueForProperty(selection, "font-family", "inherit"));
|
|
200
211
|
}
|
|
201
|
-
}, [
|
|
212
|
+
}, []);
|
|
202
213
|
react.useEffect(function () {
|
|
203
|
-
return editor.registerCommand(lexical.
|
|
214
|
+
return editor.registerCommand(lexical.SELECTION_CHANGE_COMMAND, function (_payload, newEditor) {
|
|
204
215
|
setActiveEditor(newEditor);
|
|
216
|
+
setCurrentSelection(lexical.$getSelection());
|
|
217
|
+
$updateToolbar();
|
|
205
218
|
return false;
|
|
206
219
|
}, lexical.COMMAND_PRIORITY_CRITICAL);
|
|
207
|
-
}, [editor]);
|
|
220
|
+
}, [editor, $updateToolbar]);
|
|
208
221
|
react.useEffect(function () {
|
|
209
|
-
|
|
222
|
+
activeEditor.getEditorState().read(function () {
|
|
210
223
|
$updateToolbar();
|
|
211
|
-
|
|
212
|
-
}, lexical.COMMAND_PRIORITY_CRITICAL);
|
|
224
|
+
});
|
|
213
225
|
}, [activeEditor, $updateToolbar]);
|
|
214
226
|
react.useEffect(function () {
|
|
215
227
|
return LexicalUtils.mergeRegister(editor.registerEditableListener(function (editable) {
|
|
@@ -228,15 +240,12 @@ var useFormatWatcher = function useFormatWatcher() {
|
|
|
228
240
|
}, lexical.COMMAND_PRIORITY_CRITICAL));
|
|
229
241
|
}, [$updateToolbar, activeEditor, editor]);
|
|
230
242
|
var applyStyleText = react.useCallback(function (styles) {
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
});
|
|
238
|
-
}, 100);
|
|
239
|
-
}, [editor]);
|
|
243
|
+
activeEditor.update(function () {
|
|
244
|
+
if (!utilities.isNil(currentSelection)) {
|
|
245
|
+
LexicalSelection.$patchStyleText(currentSelection, styles);
|
|
246
|
+
}
|
|
247
|
+
});
|
|
248
|
+
}, [activeEditor, currentSelection]);
|
|
240
249
|
var formatBulletList = function formatBulletList() {
|
|
241
250
|
setTimeout(function () {
|
|
242
251
|
if (blockType !== "bullet") {
|
|
@@ -371,18 +380,14 @@ var useFormatWatcher = function useFormatWatcher() {
|
|
|
371
380
|
"font-size": +value + "px"
|
|
372
381
|
});
|
|
373
382
|
}, [applyStyleText]);
|
|
374
|
-
var onFontColorSelect = react.useCallback(function (
|
|
375
|
-
|
|
376
|
-
return setFontColor(value);
|
|
377
|
-
});
|
|
383
|
+
var onFontColorSelect = react.useCallback(function () {
|
|
384
|
+
var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "#000000";
|
|
378
385
|
applyStyleText({
|
|
379
386
|
color: value
|
|
380
387
|
});
|
|
381
388
|
}, [applyStyleText]);
|
|
382
|
-
var onBgColorSelect = react.useCallback(function (
|
|
383
|
-
|
|
384
|
-
return setBgColor(value);
|
|
385
|
-
});
|
|
389
|
+
var onBgColorSelect = react.useCallback(function () {
|
|
390
|
+
var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "#ffffff";
|
|
386
391
|
applyStyleText({
|
|
387
392
|
"background-color": value
|
|
388
393
|
});
|
|
@@ -220,9 +220,8 @@ var ToolbarPlugin = function ToolbarPlugin() {
|
|
|
220
220
|
}), /*#__PURE__*/jsxRuntime.jsx(form.ColorInput, {
|
|
221
221
|
noOutline: true,
|
|
222
222
|
value: watch.fontColor,
|
|
223
|
-
onChange: function onChange() {
|
|
224
|
-
|
|
225
|
-
return watch.onFontColorSelect(v);
|
|
223
|
+
onChange: function onChange(v) {
|
|
224
|
+
return watch.onFontColorSelect(v !== null && v !== void 0 ? v : undefined);
|
|
226
225
|
},
|
|
227
226
|
decorateStart: /*#__PURE__*/jsxRuntime.jsx(core.Icon, {
|
|
228
227
|
icon: core.CoreIcons.formatText
|
|
@@ -230,9 +229,8 @@ var ToolbarPlugin = function ToolbarPlugin() {
|
|
|
230
229
|
}), /*#__PURE__*/jsxRuntime.jsx(form.ColorInput, {
|
|
231
230
|
noOutline: true,
|
|
232
231
|
value: watch.bgColor,
|
|
233
|
-
onChange: function onChange() {
|
|
234
|
-
|
|
235
|
-
return watch.onBgColorSelect(v);
|
|
232
|
+
onChange: function onChange(v) {
|
|
233
|
+
return watch.onBgColorSelect(v !== null && v !== void 0 ? v : undefined);
|
|
236
234
|
},
|
|
237
235
|
decorateStart: /*#__PURE__*/jsxRuntime.jsx(core.Icon, {
|
|
238
236
|
icon: core.CoreIcons.formatFill
|
|
@@ -21,7 +21,6 @@ import { useRef, useState, useCallback, useEffect, useMemo } from 'react';
|
|
|
21
21
|
import { StickyNode } from '../nodes/StickyNode.js';
|
|
22
22
|
import { DraggableBlockPlugin } from '../plugins/DraggableBlockPlugin.js';
|
|
23
23
|
import { StickyPlugin } from '../plugins/StickyPlugin.js';
|
|
24
|
-
import classes from './Lexical.module.css';
|
|
25
24
|
import { LexicalTheme } from './theme.js';
|
|
26
25
|
import { ToolbarPlugin } from '../plugins/ToolbarPlugin.js';
|
|
27
26
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
@@ -108,7 +107,7 @@ var LexicalEditor = function LexicalEditor(_ref) {
|
|
|
108
107
|
return !publishMode ? /*#__PURE__*/jsxs("div", {
|
|
109
108
|
className: "lexical-scroller area-content overflow-auto",
|
|
110
109
|
children: [/*#__PURE__*/jsx("div", {
|
|
111
|
-
className: classNames(
|
|
110
|
+
className: classNames("fabric-lexicalToolbar", "sticky top-0 z-1"),
|
|
112
111
|
children: /*#__PURE__*/jsx(Header, {
|
|
113
112
|
className: "bg-base",
|
|
114
113
|
children: /*#__PURE__*/jsx(ToolbarPlugin, {})
|
|
@@ -124,7 +123,7 @@ var LexicalEditor = function LexicalEditor(_ref) {
|
|
|
124
123
|
colorScheme: "light",
|
|
125
124
|
children: /*#__PURE__*/jsxs("div", {
|
|
126
125
|
role: "none",
|
|
127
|
-
className: classNames(
|
|
126
|
+
className: classNames("fabric-lexicalEditor", "lexical-container relative bg-white min-h-full mx-auto shadow-md print:shadow-none"),
|
|
128
127
|
onDragOver: function onDragOver(e) {
|
|
129
128
|
return e.stopPropagation();
|
|
130
129
|
},
|
|
@@ -11,7 +11,8 @@ import { $isHeadingNode, $createQuoteNode, $createHeadingNode, $isQuoteNode } fr
|
|
|
11
11
|
import { $isParentElementRTL, $getSelectionStyleValueForProperty, $patchStyleText, $setBlocksType, $isAtNodeEnd } from '../../../../node_modules/@lexical/selection/LexicalSelection.js';
|
|
12
12
|
import { $isTableNode } from '../../../../node_modules/@lexical/table/LexicalTable.js';
|
|
13
13
|
import { $findMatchingParent, $getNearestNodeOfType, mergeRegister, $getNearestBlockElementAncestorOrThrow } from '../../../../node_modules/@lexical/utils/LexicalUtils.js';
|
|
14
|
-
import {
|
|
14
|
+
import { isNil } from '@react-fabric/utilities';
|
|
15
|
+
import { $getSelection, $isRangeSelection, $isRootOrShadowRoot, SELECTION_CHANGE_COMMAND, COMMAND_PRIORITY_CRITICAL, CAN_UNDO_COMMAND, CAN_REDO_COMMAND, $createParagraphNode, INDENT_CONTENT_COMMAND, OUTDENT_CONTENT_COMMAND, $isTextNode } from 'lexical';
|
|
15
16
|
import { useTransition, useState, useCallback, useEffect } from 'react';
|
|
16
17
|
|
|
17
18
|
var blockTypeToBlockName = {
|
|
@@ -54,88 +55,92 @@ var useFormatWatcher = function useFormatWatcher() {
|
|
|
54
55
|
_useState2 = _slicedToArray(_useState, 2),
|
|
55
56
|
activeEditor = _useState2[0],
|
|
56
57
|
setActiveEditor = _useState2[1];
|
|
57
|
-
var _useState3 = useState(
|
|
58
|
+
var _useState3 = useState(),
|
|
58
59
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
var _useState5 = useState("
|
|
60
|
+
currentSelection = _useState4[0],
|
|
61
|
+
setCurrentSelection = _useState4[1];
|
|
62
|
+
var _useState5 = useState("paragraph"),
|
|
62
63
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
var _useState7 = useState(
|
|
64
|
+
blockType = _useState6[0],
|
|
65
|
+
setBlockType = _useState6[1];
|
|
66
|
+
var _useState7 = useState("root"),
|
|
66
67
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
var _useState9 = useState(
|
|
68
|
+
rootType = _useState8[0],
|
|
69
|
+
setRootType = _useState8[1];
|
|
70
|
+
var _useState9 = useState(null),
|
|
70
71
|
_useState10 = _slicedToArray(_useState9, 2),
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
var _useState11 = useState("
|
|
72
|
+
selectedElementKey = _useState10[0],
|
|
73
|
+
setSelectedElementKey = _useState10[1];
|
|
74
|
+
var _useState11 = useState("16"),
|
|
74
75
|
_useState12 = _slicedToArray(_useState11, 2),
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
var _useState13 = useState("#
|
|
76
|
+
fontSize = _useState12[0],
|
|
77
|
+
setFontSize = _useState12[1];
|
|
78
|
+
var _useState13 = useState("#000"),
|
|
78
79
|
_useState14 = _slicedToArray(_useState13, 2),
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
var _useState15 = useState("
|
|
80
|
+
fontColor = _useState14[0],
|
|
81
|
+
setFontColor = _useState14[1];
|
|
82
|
+
var _useState15 = useState("#fff"),
|
|
82
83
|
_useState16 = _slicedToArray(_useState15, 2),
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
var _useState17 = useState(
|
|
84
|
+
bgColor = _useState16[0],
|
|
85
|
+
setBgColor = _useState16[1];
|
|
86
|
+
var _useState17 = useState("Arial"),
|
|
86
87
|
_useState18 = _slicedToArray(_useState17, 2),
|
|
87
|
-
|
|
88
|
-
|
|
88
|
+
fontFamily = _useState18[0],
|
|
89
|
+
setFontFamily = _useState18[1];
|
|
89
90
|
var _useState19 = useState(false),
|
|
90
91
|
_useState20 = _slicedToArray(_useState19, 2),
|
|
91
|
-
|
|
92
|
-
|
|
92
|
+
isLink = _useState20[0],
|
|
93
|
+
setIsLink = _useState20[1];
|
|
93
94
|
var _useState21 = useState(false),
|
|
94
95
|
_useState22 = _slicedToArray(_useState21, 2),
|
|
95
|
-
|
|
96
|
-
|
|
96
|
+
isBold = _useState22[0],
|
|
97
|
+
setIsBold = _useState22[1];
|
|
97
98
|
var _useState23 = useState(false),
|
|
98
99
|
_useState24 = _slicedToArray(_useState23, 2),
|
|
99
|
-
|
|
100
|
-
|
|
100
|
+
isItalic = _useState24[0],
|
|
101
|
+
setIsItalic = _useState24[1];
|
|
101
102
|
var _useState25 = useState(false),
|
|
102
103
|
_useState26 = _slicedToArray(_useState25, 2),
|
|
103
|
-
|
|
104
|
-
|
|
104
|
+
isUnderline = _useState26[0],
|
|
105
|
+
setIsUnderline = _useState26[1];
|
|
105
106
|
var _useState27 = useState(false),
|
|
106
107
|
_useState28 = _slicedToArray(_useState27, 2),
|
|
107
|
-
|
|
108
|
-
|
|
108
|
+
isStrikethrough = _useState28[0],
|
|
109
|
+
setIsStrikethrough = _useState28[1];
|
|
109
110
|
var _useState29 = useState(false),
|
|
110
111
|
_useState30 = _slicedToArray(_useState29, 2),
|
|
111
|
-
|
|
112
|
-
|
|
112
|
+
isSubscript = _useState30[0],
|
|
113
|
+
setIsSubscript = _useState30[1];
|
|
113
114
|
var _useState31 = useState(false),
|
|
114
115
|
_useState32 = _slicedToArray(_useState31, 2),
|
|
115
|
-
|
|
116
|
-
|
|
116
|
+
isSuperscript = _useState32[0],
|
|
117
|
+
setIsSuperscript = _useState32[1];
|
|
117
118
|
var _useState33 = useState(false),
|
|
118
119
|
_useState34 = _slicedToArray(_useState33, 2),
|
|
119
|
-
|
|
120
|
-
|
|
120
|
+
isCode = _useState34[0],
|
|
121
|
+
setIsCode = _useState34[1];
|
|
121
122
|
var _useState35 = useState(false),
|
|
122
123
|
_useState36 = _slicedToArray(_useState35, 2),
|
|
123
|
-
|
|
124
|
-
|
|
124
|
+
canUndo = _useState36[0],
|
|
125
|
+
setCanUndo = _useState36[1];
|
|
125
126
|
var _useState37 = useState(false),
|
|
126
127
|
_useState38 = _slicedToArray(_useState37, 2),
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
var _useState39 = useState(
|
|
128
|
+
canRedo = _useState38[0],
|
|
129
|
+
setCanRedo = _useState38[1];
|
|
130
|
+
var _useState39 = useState(false),
|
|
130
131
|
_useState40 = _slicedToArray(_useState39, 2),
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
var _useState41 = useState(
|
|
132
|
+
isRTL = _useState40[0],
|
|
133
|
+
setIsRTL = _useState40[1];
|
|
134
|
+
var _useState41 = useState(""),
|
|
135
|
+
_useState42 = _slicedToArray(_useState41, 2),
|
|
136
|
+
codeLanguage = _useState42[0],
|
|
137
|
+
setCodeLanguage = _useState42[1];
|
|
138
|
+
var _useState43 = useState(function () {
|
|
134
139
|
return editor.isEditable();
|
|
135
140
|
}),
|
|
136
|
-
|
|
137
|
-
isEditable =
|
|
138
|
-
setIsEditable =
|
|
141
|
+
_useState44 = _slicedToArray(_useState43, 2),
|
|
142
|
+
isEditable = _useState44[0],
|
|
143
|
+
setIsEditable = _useState44[1];
|
|
139
144
|
var $updateToolbar = useCallback(function () {
|
|
140
145
|
var selection = $getSelection();
|
|
141
146
|
if ($isRangeSelection(selection)) {
|
|
@@ -194,22 +199,29 @@ var useFormatWatcher = function useFormatWatcher() {
|
|
|
194
199
|
}
|
|
195
200
|
// Handle buttons
|
|
196
201
|
setFontSize(parseInt($getSelectionStyleValueForProperty(selection, "font-size", "16")) + "");
|
|
197
|
-
setFontColor($getSelectionStyleValueForProperty(selection, "color",
|
|
198
|
-
|
|
202
|
+
setFontColor($getSelectionStyleValueForProperty(selection, "color",
|
|
203
|
+
// @ts-expect-error ignore
|
|
204
|
+
// eslint-disable-next-line no-new-wrappers
|
|
205
|
+
new String("#000")));
|
|
206
|
+
setBgColor($getSelectionStyleValueForProperty(selection, "background-color",
|
|
207
|
+
// @ts-expect-error ignore
|
|
208
|
+
// eslint-disable-next-line no-new-wrappers
|
|
209
|
+
new String("#fff")));
|
|
199
210
|
setFontFamily($getSelectionStyleValueForProperty(selection, "font-family", "inherit"));
|
|
200
211
|
}
|
|
201
|
-
}, [
|
|
212
|
+
}, []);
|
|
202
213
|
useEffect(function () {
|
|
203
|
-
return editor.registerCommand(
|
|
214
|
+
return editor.registerCommand(SELECTION_CHANGE_COMMAND, function (_payload, newEditor) {
|
|
204
215
|
setActiveEditor(newEditor);
|
|
216
|
+
setCurrentSelection($getSelection());
|
|
217
|
+
$updateToolbar();
|
|
205
218
|
return false;
|
|
206
219
|
}, COMMAND_PRIORITY_CRITICAL);
|
|
207
|
-
}, [editor]);
|
|
220
|
+
}, [editor, $updateToolbar]);
|
|
208
221
|
useEffect(function () {
|
|
209
|
-
|
|
222
|
+
activeEditor.getEditorState().read(function () {
|
|
210
223
|
$updateToolbar();
|
|
211
|
-
|
|
212
|
-
}, COMMAND_PRIORITY_CRITICAL);
|
|
224
|
+
});
|
|
213
225
|
}, [activeEditor, $updateToolbar]);
|
|
214
226
|
useEffect(function () {
|
|
215
227
|
return mergeRegister(editor.registerEditableListener(function (editable) {
|
|
@@ -228,15 +240,12 @@ var useFormatWatcher = function useFormatWatcher() {
|
|
|
228
240
|
}, COMMAND_PRIORITY_CRITICAL));
|
|
229
241
|
}, [$updateToolbar, activeEditor, editor]);
|
|
230
242
|
var applyStyleText = useCallback(function (styles) {
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
});
|
|
238
|
-
}, 100);
|
|
239
|
-
}, [editor]);
|
|
243
|
+
activeEditor.update(function () {
|
|
244
|
+
if (!isNil(currentSelection)) {
|
|
245
|
+
$patchStyleText(currentSelection, styles);
|
|
246
|
+
}
|
|
247
|
+
});
|
|
248
|
+
}, [activeEditor, currentSelection]);
|
|
240
249
|
var formatBulletList = function formatBulletList() {
|
|
241
250
|
setTimeout(function () {
|
|
242
251
|
if (blockType !== "bullet") {
|
|
@@ -371,18 +380,14 @@ var useFormatWatcher = function useFormatWatcher() {
|
|
|
371
380
|
"font-size": +value + "px"
|
|
372
381
|
});
|
|
373
382
|
}, [applyStyleText]);
|
|
374
|
-
var onFontColorSelect = useCallback(function (
|
|
375
|
-
|
|
376
|
-
return setFontColor(value);
|
|
377
|
-
});
|
|
383
|
+
var onFontColorSelect = useCallback(function () {
|
|
384
|
+
var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "#000000";
|
|
378
385
|
applyStyleText({
|
|
379
386
|
color: value
|
|
380
387
|
});
|
|
381
388
|
}, [applyStyleText]);
|
|
382
|
-
var onBgColorSelect = useCallback(function (
|
|
383
|
-
|
|
384
|
-
return setBgColor(value);
|
|
385
|
-
});
|
|
389
|
+
var onBgColorSelect = useCallback(function () {
|
|
390
|
+
var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "#ffffff";
|
|
386
391
|
applyStyleText({
|
|
387
392
|
"background-color": value
|
|
388
393
|
});
|
|
@@ -220,9 +220,8 @@ var ToolbarPlugin = function ToolbarPlugin() {
|
|
|
220
220
|
}), /*#__PURE__*/jsx(ColorInput, {
|
|
221
221
|
noOutline: true,
|
|
222
222
|
value: watch.fontColor,
|
|
223
|
-
onChange: function onChange() {
|
|
224
|
-
|
|
225
|
-
return watch.onFontColorSelect(v);
|
|
223
|
+
onChange: function onChange(v) {
|
|
224
|
+
return watch.onFontColorSelect(v !== null && v !== void 0 ? v : undefined);
|
|
226
225
|
},
|
|
227
226
|
decorateStart: /*#__PURE__*/jsx(Icon, {
|
|
228
227
|
icon: CoreIcons.formatText
|
|
@@ -230,9 +229,8 @@ var ToolbarPlugin = function ToolbarPlugin() {
|
|
|
230
229
|
}), /*#__PURE__*/jsx(ColorInput, {
|
|
231
230
|
noOutline: true,
|
|
232
231
|
value: watch.bgColor,
|
|
233
|
-
onChange: function onChange() {
|
|
234
|
-
|
|
235
|
-
return watch.onBgColorSelect(v);
|
|
232
|
+
onChange: function onChange(v) {
|
|
233
|
+
return watch.onBgColorSelect(v !== null && v !== void 0 ? v : undefined);
|
|
236
234
|
},
|
|
237
235
|
decorateStart: /*#__PURE__*/jsx(Icon, {
|
|
238
236
|
icon: CoreIcons.formatFill
|
|
@@ -27,8 +27,8 @@ export declare const useFormatWatcher: () => {
|
|
|
27
27
|
indent: () => void;
|
|
28
28
|
outdent: () => void;
|
|
29
29
|
clearFormatting: () => void;
|
|
30
|
-
onFontColorSelect: (value
|
|
31
|
-
onBgColorSelect: (value
|
|
30
|
+
onFontColorSelect: (value?: string) => void;
|
|
31
|
+
onBgColorSelect: (value?: string) => void;
|
|
32
32
|
formatQuote: () => void;
|
|
33
33
|
onSizeChange: (value: string) => void;
|
|
34
34
|
formatBlock: () => void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-fabric/lexical",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.41",
|
|
4
4
|
"description": "RUF: Lexical editor",
|
|
5
5
|
"author": "Adarsh Pastakia <adarshpastakia@outlook.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -11,9 +11,11 @@
|
|
|
11
11
|
"types": "dist/types/index.d.ts",
|
|
12
12
|
"directories": {
|
|
13
13
|
"src": "src",
|
|
14
|
+
"styles": "css",
|
|
14
15
|
"test": "tests"
|
|
15
16
|
},
|
|
16
17
|
"files": [
|
|
18
|
+
"css",
|
|
17
19
|
"src",
|
|
18
20
|
"dist"
|
|
19
21
|
],
|
|
@@ -35,21 +37,21 @@
|
|
|
35
37
|
"dependencies": {
|
|
36
38
|
"@lexical/headless": "^0.17.1",
|
|
37
39
|
"@lexical/react": "^0.17.1",
|
|
38
|
-
"@react-fabric/core": "^1.0.0-beta.
|
|
39
|
-
"@react-fabric/form": "^1.0.0-beta.
|
|
40
|
-
"@react-fabric/utilities": "^1.0.0-beta.
|
|
40
|
+
"@react-fabric/core": "^1.0.0-beta.41",
|
|
41
|
+
"@react-fabric/form": "^1.0.0-beta.41",
|
|
42
|
+
"@react-fabric/utilities": "^1.0.0-beta.41",
|
|
41
43
|
"classnames": "^2.5.1",
|
|
42
44
|
"lexical": "^0.17.1"
|
|
43
45
|
},
|
|
44
46
|
"peerDependencies": {
|
|
45
47
|
"i18next": "^23.15.1",
|
|
46
|
-
"react": "
|
|
47
|
-
"react-dom": "
|
|
48
|
+
"react": "^19.0.0",
|
|
49
|
+
"react-dom": "^19.0.0",
|
|
48
50
|
"react-i18next": "^15.0.2"
|
|
49
51
|
},
|
|
50
52
|
"engines": {
|
|
51
53
|
"node": ">=18.12.0",
|
|
52
54
|
"npm": ">=8.19.0"
|
|
53
55
|
},
|
|
54
|
-
"gitHead": "
|
|
56
|
+
"gitHead": "bc737416d3c6a217a6b8c47291c3975a22722d80"
|
|
55
57
|
}
|
|
@@ -42,7 +42,6 @@ import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
|
42
42
|
import { StickyNode } from "../nodes/StickyNode";
|
|
43
43
|
import { DraggableBlockPlugin } from "../plugins/DraggableBlockPlugin";
|
|
44
44
|
import { StickyPlugin } from "../plugins/StickyPlugin";
|
|
45
|
-
import classes from "./Lexical.module.css";
|
|
46
45
|
import { LexicalTheme } from "./theme";
|
|
47
46
|
import { ToolbarPlugin } from "../plugins/ToolbarPlugin";
|
|
48
47
|
|
|
@@ -162,7 +161,7 @@ export const LexicalEditor = ({
|
|
|
162
161
|
return !publishMode ? (
|
|
163
162
|
<div className="lexical-scroller area-content overflow-auto">
|
|
164
163
|
<div
|
|
165
|
-
className={classNames(
|
|
164
|
+
className={classNames("fabric-lexicalToolbar", "sticky top-0 z-1")}
|
|
166
165
|
>
|
|
167
166
|
<Header className="bg-base">
|
|
168
167
|
<ToolbarPlugin />
|
|
@@ -185,7 +184,7 @@ export const LexicalEditor = ({
|
|
|
185
184
|
<div
|
|
186
185
|
role="none"
|
|
187
186
|
className={classNames(
|
|
188
|
-
|
|
187
|
+
"fabric-lexicalEditor",
|
|
189
188
|
"lexical-container relative bg-white min-h-full mx-auto shadow-md print:shadow-none",
|
|
190
189
|
)}
|
|
191
190
|
onDragOver={(e) => e.stopPropagation()}
|
|
@@ -53,6 +53,7 @@ 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,
|
|
@@ -62,7 +63,6 @@ import {
|
|
|
62
63
|
CAN_REDO_COMMAND,
|
|
63
64
|
CAN_UNDO_COMMAND,
|
|
64
65
|
COMMAND_PRIORITY_CRITICAL,
|
|
65
|
-
FOCUS_COMMAND,
|
|
66
66
|
INDENT_CONTENT_COMMAND,
|
|
67
67
|
OUTDENT_CONTENT_COMMAND,
|
|
68
68
|
SELECTION_CHANGE_COMMAND,
|
|
@@ -114,6 +114,7 @@ export const useFormatWatcher = () => {
|
|
|
114
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] =
|
|
@@ -218,41 +219,46 @@ export const useFormatWatcher = () => {
|
|
|
218
219
|
) + "",
|
|
219
220
|
);
|
|
220
221
|
setFontColor(
|
|
221
|
-
$getSelectionStyleValueForProperty(
|
|
222
|
+
$getSelectionStyleValueForProperty(
|
|
223
|
+
selection,
|
|
224
|
+
"color",
|
|
225
|
+
// @ts-expect-error ignore
|
|
226
|
+
// eslint-disable-next-line no-new-wrappers
|
|
227
|
+
new String("#000"),
|
|
228
|
+
),
|
|
222
229
|
);
|
|
223
230
|
setBgColor(
|
|
224
231
|
$getSelectionStyleValueForProperty(
|
|
225
232
|
selection,
|
|
226
233
|
"background-color",
|
|
227
|
-
|
|
234
|
+
// @ts-expect-error ignore
|
|
235
|
+
// eslint-disable-next-line no-new-wrappers
|
|
236
|
+
new String("#fff"),
|
|
228
237
|
),
|
|
229
238
|
);
|
|
230
239
|
setFontFamily(
|
|
231
240
|
$getSelectionStyleValueForProperty(selection, "font-family", "inherit"),
|
|
232
241
|
);
|
|
233
242
|
}
|
|
234
|
-
}, [
|
|
243
|
+
}, []);
|
|
235
244
|
|
|
236
245
|
useEffect(() => {
|
|
237
246
|
return editor.registerCommand(
|
|
238
|
-
|
|
247
|
+
SELECTION_CHANGE_COMMAND,
|
|
239
248
|
(_payload, newEditor) => {
|
|
240
249
|
setActiveEditor(newEditor);
|
|
250
|
+
setCurrentSelection($getSelection());
|
|
251
|
+
$updateToolbar();
|
|
241
252
|
return false;
|
|
242
253
|
},
|
|
243
254
|
COMMAND_PRIORITY_CRITICAL,
|
|
244
255
|
);
|
|
245
|
-
}, [editor]);
|
|
256
|
+
}, [editor, $updateToolbar]);
|
|
246
257
|
|
|
247
258
|
useEffect(() => {
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
$updateToolbar();
|
|
252
|
-
return false;
|
|
253
|
-
},
|
|
254
|
-
COMMAND_PRIORITY_CRITICAL,
|
|
255
|
-
);
|
|
259
|
+
activeEditor.getEditorState().read(() => {
|
|
260
|
+
$updateToolbar();
|
|
261
|
+
});
|
|
256
262
|
}, [activeEditor, $updateToolbar]);
|
|
257
263
|
|
|
258
264
|
useEffect(() => {
|
|
@@ -286,16 +292,13 @@ export const useFormatWatcher = () => {
|
|
|
286
292
|
|
|
287
293
|
const applyStyleText = useCallback(
|
|
288
294
|
(styles: Record<string, string>) => {
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
}
|
|
295
|
-
});
|
|
296
|
-
}, 100);
|
|
295
|
+
activeEditor.update(() => {
|
|
296
|
+
if (!isNil(currentSelection)) {
|
|
297
|
+
$patchStyleText(currentSelection, styles);
|
|
298
|
+
}
|
|
299
|
+
});
|
|
297
300
|
},
|
|
298
|
-
[
|
|
301
|
+
[activeEditor, currentSelection],
|
|
299
302
|
);
|
|
300
303
|
|
|
301
304
|
const formatBulletList = () => {
|
|
@@ -439,16 +442,14 @@ export const useFormatWatcher = () => {
|
|
|
439
442
|
);
|
|
440
443
|
|
|
441
444
|
const onFontColorSelect = useCallback(
|
|
442
|
-
(value: string) => {
|
|
443
|
-
startTransition(() => setFontColor(value));
|
|
445
|
+
(value: string = "#000000") => {
|
|
444
446
|
applyStyleText({ color: value });
|
|
445
447
|
},
|
|
446
448
|
[applyStyleText],
|
|
447
449
|
);
|
|
448
450
|
|
|
449
451
|
const onBgColorSelect = useCallback(
|
|
450
|
-
(value: string) => {
|
|
451
|
-
startTransition(() => setBgColor(value));
|
|
452
|
+
(value: string = "#ffffff") => {
|
|
452
453
|
applyStyleText({ "background-color": value });
|
|
453
454
|
},
|
|
454
455
|
[applyStyleText],
|
|
@@ -252,13 +252,13 @@ export const ToolbarPlugin = () => {
|
|
|
252
252
|
<ColorInput
|
|
253
253
|
{...{ noOutline: true }}
|
|
254
254
|
value={watch.fontColor}
|
|
255
|
-
onChange={(v
|
|
255
|
+
onChange={(v) => watch.onFontColorSelect(v ?? undefined)}
|
|
256
256
|
decorateStart={<Icon icon={CoreIcons.formatText} />}
|
|
257
257
|
/>
|
|
258
258
|
<ColorInput
|
|
259
259
|
{...{ noOutline: true }}
|
|
260
260
|
value={watch.bgColor}
|
|
261
|
-
onChange={(v
|
|
261
|
+
onChange={(v) => watch.onBgColorSelect(v ?? undefined)}
|
|
262
262
|
decorateStart={<Icon icon={CoreIcons.formatFill} />}
|
|
263
263
|
/>
|
|
264
264
|
<ButtonWrapper
|
|
@@ -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}}}}
|
|
@@ -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}}}}
|