@crystallize/design-system 1.11.7 → 1.13.0
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/CHANGELOG.md +17 -0
- package/dist/draggable-block-menu-KKHDNKJA.svg +1 -0
- package/dist/index.css +565 -1025
- package/dist/index.d.ts +1 -0
- package/dist/index.js +538 -517
- package/dist/index.mjs +419 -398
- package/package.json +22 -23
- package/src/button/Button.stories.tsx +1 -0
- package/src/card/card.stories.tsx +1 -0
- package/src/checkbox/checkbox.stories.tsx +1 -1
- package/src/checkbox/checkbox.tsx +1 -1
- package/src/colors/Colors.stories.tsx +3 -3
- package/src/dialog/config.tsx +1 -1
- package/src/dialog/index.tsx +1 -1
- package/src/dropdown-menu/dropdown-menu-item.tsx +2 -2
- package/src/dropdown-menu/dropdown-menu-label.tsx +1 -1
- package/src/icon-button/IconButton.stories.tsx +1 -0
- package/src/iconography/Icon.stories.tsx +1 -0
- package/src/inline-radio/inline-radio.stories.tsx +3 -3
- package/src/inline-radio/inline-radio.tsx +2 -2
- package/src/input/input.tsx +1 -1
- package/src/input-with-label/input-with-label.tsx +1 -1
- package/src/label/label.stories.tsx +1 -0
- package/src/progress/Progress.stories.tsx +2 -1
- package/src/progress/progress.tsx +1 -1
- package/src/radio/radio.stories.tsx +1 -1
- package/src/radio/radio.tsx +1 -1
- package/src/rich-text-editor/model/crystallize-to-lexical.ts +4 -3
- package/src/rich-text-editor/model/parse-initial-state.test.ts +48 -0
- package/src/rich-text-editor/model/parse-initial-state.ts +20 -0
- package/src/rich-text-editor/plugins/ActionsPlugin/index.css +3 -0
- package/src/rich-text-editor/plugins/ActionsPlugin/index.tsx +1 -2
- package/src/rich-text-editor/plugins/AutoLinkPlugin/index.tsx +1 -1
- package/src/rich-text-editor/plugins/CodeActionMenuPlugin/components/CopyButton/index.tsx +6 -2
- package/src/rich-text-editor/plugins/CodeActionMenuPlugin/components/PrettierButton/index.tsx +10 -6
- package/src/rich-text-editor/plugins/CodeActionMenuPlugin/index.css +32 -17
- package/src/rich-text-editor/plugins/CodeActionMenuPlugin/index.tsx +3 -4
- package/src/rich-text-editor/plugins/DimensionsDetectorPlugin/index.tsx +49 -0
- package/src/rich-text-editor/plugins/DraggableBlockPlugin/index.css +14 -14
- package/src/rich-text-editor/plugins/DraggableBlockPlugin/index.tsx +4 -4
- package/src/rich-text-editor/plugins/FloatingLinkEditorPlugin/index.css +87 -21
- package/src/rich-text-editor/plugins/FloatingLinkEditorPlugin/index.tsx +11 -17
- package/src/rich-text-editor/plugins/FloatingTextFormatToolbarPlugin/index.css +10 -2
- package/src/rich-text-editor/plugins/FloatingTextFormatToolbarPlugin/index.tsx +17 -17
- package/src/rich-text-editor/plugins/LinkPlugin/index.tsx +1 -1
- package/src/rich-text-editor/plugins/ListMaxIndentLevelPlugin/index.ts +10 -21
- package/src/rich-text-editor/plugins/TableActionMenuPlugin/index.css +6 -0
- package/src/rich-text-editor/plugins/TableActionMenuPlugin/index.tsx +2 -2
- package/src/rich-text-editor/plugins/ToolbarPlugin/index.css +115 -0
- package/src/rich-text-editor/plugins/ToolbarPlugin/index.tsx +57 -78
- package/src/rich-text-editor/plugins/ToolbarPlugin/insert-table.tsx +5 -5
- package/src/rich-text-editor/rich-text-editor-icons.css +213 -0
- package/src/rich-text-editor/rich-text-editor.css +33 -913
- package/src/rich-text-editor/rich-text-editor.stories.tsx +24 -0
- package/src/rich-text-editor/rich-text-editor.tsx +13 -27
- package/src/rich-text-editor/themes/CrystallizeRTEditorTheme.ts +1 -1
- package/src/rich-text-editor/ui/LinkPreview.tsx +7 -8
- package/src/rich-text-editor/utils/getSelectedNode.ts +4 -5
- package/src/rich-text-editor/utils/point.ts +4 -7
- package/src/rich-text-editor/utils/rect.ts +18 -41
- package/src/rich-text-editor/utils/url.ts +1 -2
- package/src/select/select-root.tsx +1 -1
- package/src/select/select.stories.tsx +1 -1
- package/src/select/select.ts +0 -1
- package/src/slider/Slider.stories.tsx +2 -1
- package/src/slider/slider.tsx +2 -2
- package/src/spinner/Spinner.stories.tsx +1 -0
- package/src/spinner/index.tsx +1 -1
- package/src/tag/Tag.stories.tsx +1 -0
- package/dist/camera-CR7D2PNH.svg +0 -1
- package/dist/clipboard-OSEFDF25.svg +0 -1
- package/dist/gear-ICMT4NTP.svg +0 -1
- package/dist/journal-code-XUT44HDV.svg +0 -1
- package/dist/lock-WCYOZOHW.svg +0 -1
- package/dist/lock-fill-JZSKOSHK.svg +0 -1
- package/dist/pencil-fill-STFSC26F.svg +0 -1
- package/dist/plug-HGGGEVS3.svg +0 -1
- package/dist/plug-fill-OTG3U4TN.svg +0 -1
- package/src/rich-text-editor/hooks/useReport.ts +0 -64
- package/src/rich-text-editor/plugins/CodeActionMenuPlugin/components/PrettierButton/index.css +0 -14
- package/src/rich-text-editor/ui/LinkPreview.css +0 -57
- package/src/rich-text-editor/utils/isMobileWidth.ts +0 -7
- package/src/rich-text-editor/utils/joinClasses.ts +0 -13
- package/src/rich-text-editor/utils/swipe.ts +0 -127
package/dist/index.js
CHANGED
|
@@ -63,8 +63,8 @@ var import_react2 = require("react");
|
|
|
63
63
|
var import_class_variance_authority2 = require("class-variance-authority");
|
|
64
64
|
|
|
65
65
|
// src/spinner/index.tsx
|
|
66
|
-
var import_class_variance_authority = require("class-variance-authority");
|
|
67
66
|
var import_react = require("react");
|
|
67
|
+
var import_class_variance_authority = require("class-variance-authority");
|
|
68
68
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
69
69
|
var realSize = 40;
|
|
70
70
|
var Spinner = (0, import_react.forwardRef)(
|
|
@@ -233,8 +233,8 @@ var import_class_variance_authority7 = require("class-variance-authority");
|
|
|
233
233
|
var import_react_dropdown_menu = require("@radix-ui/react-dropdown-menu");
|
|
234
234
|
|
|
235
235
|
// src/dropdown-menu/dropdown-menu-item.tsx
|
|
236
|
-
var DropdownMenuPrimitive = __toESM(require("@radix-ui/react-dropdown-menu"));
|
|
237
236
|
var import_class_variance_authority4 = require("class-variance-authority");
|
|
237
|
+
var DropdownMenuPrimitive = __toESM(require("@radix-ui/react-dropdown-menu"));
|
|
238
238
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
239
239
|
function DropdownMenuItem({ children, className, ...delegated }) {
|
|
240
240
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(DropdownMenuPrimitive.Item, { ...delegated, className: (0, import_class_variance_authority4.cx)("c-dropdown-menu-item", className), children });
|
|
@@ -363,8 +363,8 @@ var Avatar = (0, import_react3.forwardRef)(({ name, size, className, ...delegate
|
|
|
363
363
|
Avatar.displayName = "Avatar";
|
|
364
364
|
|
|
365
365
|
// src/checkbox/checkbox.tsx
|
|
366
|
-
var CheckboxPrimitive = __toESM(require("@radix-ui/react-checkbox"));
|
|
367
366
|
var import_react4 = require("react");
|
|
367
|
+
var CheckboxPrimitive = __toESM(require("@radix-ui/react-checkbox"));
|
|
368
368
|
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
369
369
|
var Checkbox = (0, import_react4.forwardRef)((props, ref) => {
|
|
370
370
|
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(CheckboxPrimitive.Root, { ...props, ref, className: "c-checkbox", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(CheckboxPrimitive.Indicator, { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("svg", { viewBox: "0 0 9 9", fill: "none", className: "c-checkbox__svg", children: [
|
|
@@ -386,8 +386,8 @@ var Checkbox = (0, import_react4.forwardRef)((props, ref) => {
|
|
|
386
386
|
});
|
|
387
387
|
Checkbox.displayName = "Checkbox";
|
|
388
388
|
|
|
389
|
-
// src/dialog/
|
|
390
|
-
var
|
|
389
|
+
// src/dialog/config.tsx
|
|
390
|
+
var import_react_dom = require("react-dom");
|
|
391
391
|
|
|
392
392
|
// src/dialog/dialog.tsx
|
|
393
393
|
var import_class_variance_authority9 = require("class-variance-authority");
|
|
@@ -3775,9 +3775,6 @@ DialogBase.Content = DialogContent;
|
|
|
3775
3775
|
DialogBase.Overlay = DialogPrimitive.Overlay;
|
|
3776
3776
|
DialogBase.Close = DialogPrimitive.Close;
|
|
3777
3777
|
|
|
3778
|
-
// src/dialog/config.tsx
|
|
3779
|
-
var import_react_dom = require("react-dom");
|
|
3780
|
-
|
|
3781
3778
|
// src/dialog/confirm-dialog.tsx
|
|
3782
3779
|
var import_jsx_runtime67 = require("react/jsx-runtime");
|
|
3783
3780
|
function ConfirmDialog({
|
|
@@ -3842,6 +3839,9 @@ function ConfirmDialog({
|
|
|
3842
3839
|
) });
|
|
3843
3840
|
}
|
|
3844
3841
|
|
|
3842
|
+
// src/dialog/destroyFns.ts
|
|
3843
|
+
var destroyFns = [];
|
|
3844
|
+
|
|
3845
3845
|
// src/dialog/config.tsx
|
|
3846
3846
|
var import_jsx_runtime68 = require("react/jsx-runtime");
|
|
3847
3847
|
function confirm(config) {
|
|
@@ -4013,8 +4013,8 @@ var IconButton = (0, import_react59.forwardRef)(
|
|
|
4013
4013
|
IconButton.displayName = "Button";
|
|
4014
4014
|
|
|
4015
4015
|
// src/inline-radio/inline-radio.tsx
|
|
4016
|
-
var RadioGroupPrimitive = __toESM(require("@radix-ui/react-radio-group"));
|
|
4017
4016
|
var import_class_variance_authority11 = require("class-variance-authority");
|
|
4017
|
+
var RadioGroupPrimitive = __toESM(require("@radix-ui/react-radio-group"));
|
|
4018
4018
|
var import_jsx_runtime70 = require("react/jsx-runtime");
|
|
4019
4019
|
var inlineRadioGroupStyles = (0, import_class_variance_authority11.cva)("c-inline-radio-group", {
|
|
4020
4020
|
variants: {
|
|
@@ -4044,34 +4044,12 @@ var InlineRadio = {
|
|
|
4044
4044
|
var import_react63 = require("react");
|
|
4045
4045
|
var import_class_variance_authority14 = require("class-variance-authority");
|
|
4046
4046
|
|
|
4047
|
-
// src/
|
|
4048
|
-
var import_class_variance_authority12 = require("class-variance-authority");
|
|
4047
|
+
// src/iconography/triangle.tsx
|
|
4049
4048
|
var import_react60 = require("react");
|
|
4050
4049
|
var import_jsx_runtime71 = require("react/jsx-runtime");
|
|
4051
|
-
var
|
|
4052
|
-
variants: {},
|
|
4053
|
-
defaultVariants: {}
|
|
4054
|
-
});
|
|
4055
|
-
var Input = (0, import_react60.forwardRef)(({ className, ...delegated }, ref) => {
|
|
4056
|
-
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("input", { ref, className: inputStyles({ className }), type: "text", ...delegated });
|
|
4057
|
-
});
|
|
4058
|
-
Input.displayName = "Input";
|
|
4059
|
-
|
|
4060
|
-
// src/label/label.tsx
|
|
4061
|
-
var import_react61 = require("react");
|
|
4062
|
-
var import_class_variance_authority13 = require("class-variance-authority");
|
|
4063
|
-
var import_jsx_runtime72 = require("react/jsx-runtime");
|
|
4064
|
-
var Label2 = (0, import_react61.forwardRef)(({ className, ...delegated }, ref) => {
|
|
4065
|
-
return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("label", { ref, className: (0, import_class_variance_authority13.cx)("c-label", className), ...delegated });
|
|
4066
|
-
});
|
|
4067
|
-
Label2.displayName = "Label";
|
|
4068
|
-
|
|
4069
|
-
// src/iconography/triangle.tsx
|
|
4070
|
-
var import_react62 = require("react");
|
|
4071
|
-
var import_jsx_runtime73 = require("react/jsx-runtime");
|
|
4072
|
-
var Triangle = (0, import_react62.forwardRef)((delegated, ref) => {
|
|
4050
|
+
var Triangle = (0, import_react60.forwardRef)((delegated, ref) => {
|
|
4073
4051
|
const { width = 20, height = 20, ...rest } = delegated;
|
|
4074
|
-
return /* @__PURE__ */ (0,
|
|
4052
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
4075
4053
|
"svg",
|
|
4076
4054
|
{
|
|
4077
4055
|
viewBox: "0 0 17 15",
|
|
@@ -4081,11 +4059,33 @@ var Triangle = (0, import_react62.forwardRef)((delegated, ref) => {
|
|
|
4081
4059
|
fill: "none",
|
|
4082
4060
|
xmlns: "http://www.w3.org/2000/svg",
|
|
4083
4061
|
...rest,
|
|
4084
|
-
children: /* @__PURE__ */ (0,
|
|
4062
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("path", { d: "M15.463 1.2L8.5 12.685 1.537 1.2h13.925zM1.353.896s0 0 0 0h0z", stroke: "currentColor", strokeWidth: 2.4 })
|
|
4085
4063
|
}
|
|
4086
4064
|
);
|
|
4087
4065
|
});
|
|
4088
4066
|
|
|
4067
|
+
// src/input/input.tsx
|
|
4068
|
+
var import_react61 = require("react");
|
|
4069
|
+
var import_class_variance_authority12 = require("class-variance-authority");
|
|
4070
|
+
var import_jsx_runtime72 = require("react/jsx-runtime");
|
|
4071
|
+
var inputStyles = (0, import_class_variance_authority12.cva)(["c-input"], {
|
|
4072
|
+
variants: {},
|
|
4073
|
+
defaultVariants: {}
|
|
4074
|
+
});
|
|
4075
|
+
var Input = (0, import_react61.forwardRef)(({ className, ...delegated }, ref) => {
|
|
4076
|
+
return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("input", { ref, className: inputStyles({ className }), type: "text", ...delegated });
|
|
4077
|
+
});
|
|
4078
|
+
Input.displayName = "Input";
|
|
4079
|
+
|
|
4080
|
+
// src/label/label.tsx
|
|
4081
|
+
var import_react62 = require("react");
|
|
4082
|
+
var import_class_variance_authority13 = require("class-variance-authority");
|
|
4083
|
+
var import_jsx_runtime73 = require("react/jsx-runtime");
|
|
4084
|
+
var Label2 = (0, import_react62.forwardRef)(({ className, ...delegated }, ref) => {
|
|
4085
|
+
return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("label", { ref, className: (0, import_class_variance_authority13.cx)("c-label", className), ...delegated });
|
|
4086
|
+
});
|
|
4087
|
+
Label2.displayName = "Label";
|
|
4088
|
+
|
|
4089
4089
|
// src/input-with-label/input-with-label.tsx
|
|
4090
4090
|
var import_jsx_runtime74 = require("react/jsx-runtime");
|
|
4091
4091
|
var inputWithLabelStyles = (0, import_class_variance_authority14.cva)(["c-input-with-label"], {
|
|
@@ -4124,8 +4124,8 @@ var InputWithLabel = (0, import_react63.forwardRef)(
|
|
|
4124
4124
|
InputWithLabel.displayName = "InputWithLabel";
|
|
4125
4125
|
|
|
4126
4126
|
// src/progress/progress.tsx
|
|
4127
|
-
var ProgressPrimitives = __toESM(require("@radix-ui/react-progress"));
|
|
4128
4127
|
var import_class_variance_authority15 = require("class-variance-authority");
|
|
4128
|
+
var ProgressPrimitives = __toESM(require("@radix-ui/react-progress"));
|
|
4129
4129
|
var import_jsx_runtime75 = require("react/jsx-runtime");
|
|
4130
4130
|
function Progress({ className, value }) {
|
|
4131
4131
|
return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(ProgressPrimitives.Root, { className: (0, import_class_variance_authority15.cx)(className, "c-progress-root"), value, children: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
@@ -4163,8 +4163,8 @@ SelectItem.displayName = "SelectItem";
|
|
|
4163
4163
|
|
|
4164
4164
|
// src/select/select-root.tsx
|
|
4165
4165
|
var import_react65 = require("react");
|
|
4166
|
-
var SelectPrimitives2 = __toESM(require("@radix-ui/react-select"));
|
|
4167
4166
|
var import_class_variance_authority16 = require("class-variance-authority");
|
|
4167
|
+
var SelectPrimitives2 = __toESM(require("@radix-ui/react-select"));
|
|
4168
4168
|
var import_jsx_runtime78 = require("react/jsx-runtime");
|
|
4169
4169
|
var selectTriggerStyles = (0, import_class_variance_authority16.cva)("c-select-trigger", {
|
|
4170
4170
|
variants: {
|
|
@@ -4203,9 +4203,9 @@ var Select = {
|
|
|
4203
4203
|
};
|
|
4204
4204
|
|
|
4205
4205
|
// src/slider/slider.tsx
|
|
4206
|
-
var SliderPrimitive = __toESM(require("@radix-ui/react-slider"));
|
|
4207
|
-
var import_class_variance_authority17 = require("class-variance-authority");
|
|
4208
4206
|
var import_react66 = require("react");
|
|
4207
|
+
var import_class_variance_authority17 = require("class-variance-authority");
|
|
4208
|
+
var SliderPrimitive = __toESM(require("@radix-ui/react-slider"));
|
|
4209
4209
|
var import_jsx_runtime79 = require("react/jsx-runtime");
|
|
4210
4210
|
var Slider = (0, import_react66.forwardRef)(({ className, transparentRange, ...delegated }, ref) => {
|
|
4211
4211
|
return /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)(SliderPrimitive.Root, { className: (0, import_class_variance_authority17.cx)("c-slider-root", className), ref, ...delegated, children: [
|
|
@@ -4258,7 +4258,7 @@ function Tag({ children, className, variant, size, prepend, onRemove, ...delegat
|
|
|
4258
4258
|
}
|
|
4259
4259
|
|
|
4260
4260
|
// src/rich-text-editor/rich-text-editor.tsx
|
|
4261
|
-
var
|
|
4261
|
+
var import_react84 = require("react");
|
|
4262
4262
|
var import_LexicalAutoFocusPlugin = require("@lexical/react/LexicalAutoFocusPlugin");
|
|
4263
4263
|
var import_LexicalClearEditorPlugin = require("@lexical/react/LexicalClearEditorPlugin");
|
|
4264
4264
|
var import_LexicalComposer = require("@lexical/react/LexicalComposer");
|
|
@@ -4390,10 +4390,27 @@ var import_list = require("@lexical/list");
|
|
|
4390
4390
|
var import_LexicalHorizontalRuleNode = require("@lexical/react/LexicalHorizontalRuleNode");
|
|
4391
4391
|
var import_rich_text = require("@lexical/rich-text");
|
|
4392
4392
|
var import_table = require("@lexical/table");
|
|
4393
|
+
|
|
4394
|
+
// src/rich-text-editor/model/parse-initial-state.ts
|
|
4395
|
+
function parseInitialState({ richText }) {
|
|
4396
|
+
let richTextArray = Array.isArray(richText) ? richText : [richText];
|
|
4397
|
+
richTextArray = richTextArray.map((rootNode) => {
|
|
4398
|
+
if (!rootNode.kind || rootNode.kind === "inline") {
|
|
4399
|
+
return {
|
|
4400
|
+
type: "paragraph",
|
|
4401
|
+
kind: "block",
|
|
4402
|
+
children: [rootNode]
|
|
4403
|
+
};
|
|
4404
|
+
}
|
|
4405
|
+
return rootNode;
|
|
4406
|
+
});
|
|
4407
|
+
return richTextArray;
|
|
4408
|
+
}
|
|
4409
|
+
|
|
4410
|
+
// src/rich-text-editor/model/crystallize-to-lexical.ts
|
|
4393
4411
|
function composeInitialState({ richText }) {
|
|
4394
4412
|
return function setLexicalState() {
|
|
4395
4413
|
const root = (0, import_lexical.$getRoot)();
|
|
4396
|
-
const richTextArray = Array.isArray(richText) ? richText : [richText];
|
|
4397
4414
|
function handleNode({
|
|
4398
4415
|
crystallizeContentNode,
|
|
4399
4416
|
lexicalParent
|
|
@@ -4535,7 +4552,9 @@ function composeInitialState({ richText }) {
|
|
|
4535
4552
|
lexicalParent.append(lexicalNode);
|
|
4536
4553
|
}
|
|
4537
4554
|
}
|
|
4538
|
-
|
|
4555
|
+
parseInitialState({ richText }).forEach(
|
|
4556
|
+
(crystallizeContentNode) => handleNode({ crystallizeContentNode, lexicalParent: root })
|
|
4557
|
+
);
|
|
4539
4558
|
};
|
|
4540
4559
|
}
|
|
4541
4560
|
function getLexicalTextFormat(node) {
|
|
@@ -4781,8 +4800,8 @@ var BaseNodes = [
|
|
|
4781
4800
|
];
|
|
4782
4801
|
|
|
4783
4802
|
// src/rich-text-editor/plugins/AutoLinkPlugin/index.tsx
|
|
4784
|
-
var import_LexicalAutoLinkPlugin = require("@lexical/react/LexicalAutoLinkPlugin");
|
|
4785
4803
|
var React = require("react");
|
|
4804
|
+
var import_LexicalAutoLinkPlugin = require("@lexical/react/LexicalAutoLinkPlugin");
|
|
4786
4805
|
var import_jsx_runtime83 = require("react/jsx-runtime");
|
|
4787
4806
|
var URL_MATCHER = /((https?:\/\/(www\.)?)|(www\.))[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)/;
|
|
4788
4807
|
var EMAIL_MATCHER = /(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))/;
|
|
@@ -4857,7 +4876,7 @@ function CopyButton({ editor, getCodeDOMNode }) {
|
|
|
4857
4876
|
console.error("Failed to copy: ", err);
|
|
4858
4877
|
}
|
|
4859
4878
|
}
|
|
4860
|
-
return /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("button", { className: "
|
|
4879
|
+
return /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("button", { className: "c-rte-code-button", onClick: handleClick, "aria-label": tr("actionCopyCode"), children: isCopyCompleted ? /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("i", { className: "c-rte-code-button__icon c-rte-icon-success" }) : /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("i", { className: "c-rte-code-button__icon c-rte-icon-copy" }) });
|
|
4861
4880
|
}
|
|
4862
4881
|
|
|
4863
4882
|
// src/rich-text-editor/plugins/CodeActionMenuPlugin/components/PrettierButton/index.tsx
|
|
@@ -4951,19 +4970,19 @@ function PrettierButton({ lang, editor, getCodeDOMNode }) {
|
|
|
4951
4970
|
setTipsVisible(false);
|
|
4952
4971
|
}
|
|
4953
4972
|
}
|
|
4954
|
-
return /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { className: "prettier-wrapper", children: [
|
|
4973
|
+
return /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { className: "c-rte-prettier-wrapper", children: [
|
|
4955
4974
|
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
4956
4975
|
"button",
|
|
4957
4976
|
{
|
|
4958
|
-
className: "
|
|
4977
|
+
className: "c-rte-code-button",
|
|
4959
4978
|
onClick: handleClick,
|
|
4960
4979
|
onMouseEnter: handleMouseEnter,
|
|
4961
4980
|
onMouseLeave: handleMouseLeave,
|
|
4962
4981
|
"aria-label": tr("actionFormatCode"),
|
|
4963
|
-
children: syntaxError ? /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("i", { className: "
|
|
4982
|
+
children: syntaxError ? /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("i", { className: "c-rte-code-button__icon c-rte-icon-prettier-error" }) : /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("i", { className: "c-rte-code-button__icon c-rte-icon-prettier" })
|
|
4964
4983
|
}
|
|
4965
4984
|
),
|
|
4966
|
-
tipsVisible ? /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("pre", { className: "code-error-tips", children: syntaxError }) : null
|
|
4985
|
+
tipsVisible ? /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("pre", { className: "c-rte-code-error-tips", children: syntaxError }) : null
|
|
4967
4986
|
] });
|
|
4968
4987
|
}
|
|
4969
4988
|
|
|
@@ -5045,8 +5064,8 @@ function CodeActionMenuContainer({ anchorElem }) {
|
|
|
5045
5064
|
});
|
|
5046
5065
|
const normalizedLang = (0, import_code6.normalizeCodeLang)(lang);
|
|
5047
5066
|
const codeFriendlyName = (0, import_code6.getLanguageFriendlyName)(lang);
|
|
5048
|
-
return /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(import_jsx_runtime86.Fragment, { children: isShown ? /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("div", { className: "code-action-menu-container", style: { ...position }, children: [
|
|
5049
|
-
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)("div", { className: "code-highlight-language", children: codeFriendlyName }),
|
|
5067
|
+
return /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(import_jsx_runtime86.Fragment, { children: isShown ? /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("div", { className: "c-rte-code-action-menu-container", style: { ...position }, children: [
|
|
5068
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)("div", { className: "c-rte-code-highlight-language", children: codeFriendlyName }),
|
|
5050
5069
|
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(CopyButton, { editor, getCodeDOMNode }),
|
|
5051
5070
|
canBePrettier(normalizedLang) ? /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(PrettierButton, { editor, getCodeDOMNode, lang: normalizedLang }) : null
|
|
5052
5071
|
] }) : null });
|
|
@@ -5055,7 +5074,7 @@ function getMouseInfo(event) {
|
|
|
5055
5074
|
const target = event.target;
|
|
5056
5075
|
if (target && target instanceof HTMLElement) {
|
|
5057
5076
|
const codeDOMNode = target.closest("code.CrystallizeRTEditorTheme__code");
|
|
5058
|
-
const isOutside = !(codeDOMNode || target.closest("div.code-action-menu-container"));
|
|
5077
|
+
const isOutside = !(codeDOMNode || target.closest("div.c-rte-code-action-menu-container"));
|
|
5059
5078
|
return { codeDOMNode, isOutside };
|
|
5060
5079
|
} else {
|
|
5061
5080
|
return { codeDOMNode: null, isOutside: true };
|
|
@@ -5079,20 +5098,54 @@ function CodeHighlightPlugin() {
|
|
|
5079
5098
|
return null;
|
|
5080
5099
|
}
|
|
5081
5100
|
|
|
5101
|
+
// src/rich-text-editor/plugins/DimensionsDetectorPlugin/index.tsx
|
|
5102
|
+
var import_react73 = require("react");
|
|
5103
|
+
var import_jsx_runtime87 = require("react/jsx-runtime");
|
|
5104
|
+
function DimensionDetectorPlugin({ onChange }) {
|
|
5105
|
+
const [dimensions, setDimensions] = (0, import_react73.useState)();
|
|
5106
|
+
const ref = (0, import_react73.useRef)(null);
|
|
5107
|
+
(0, import_react73.useEffect)(() => {
|
|
5108
|
+
if (ref.current) {
|
|
5109
|
+
const el = ref.current;
|
|
5110
|
+
const resizeObserver = new ResizeObserver((entries) => {
|
|
5111
|
+
const [first] = entries;
|
|
5112
|
+
if (first) {
|
|
5113
|
+
const [contentBox] = first.contentBoxSize;
|
|
5114
|
+
if (contentBox) {
|
|
5115
|
+
const width = contentBox.inlineSize;
|
|
5116
|
+
setDimensions({
|
|
5117
|
+
width,
|
|
5118
|
+
isSmallWidth: width < 600
|
|
5119
|
+
});
|
|
5120
|
+
}
|
|
5121
|
+
}
|
|
5122
|
+
});
|
|
5123
|
+
resizeObserver.observe(el);
|
|
5124
|
+
return () => resizeObserver.disconnect();
|
|
5125
|
+
}
|
|
5126
|
+
}, []);
|
|
5127
|
+
(0, import_react73.useEffect)(() => {
|
|
5128
|
+
if (dimensions) {
|
|
5129
|
+
onChange(dimensions);
|
|
5130
|
+
}
|
|
5131
|
+
}, [dimensions, onChange]);
|
|
5132
|
+
return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("div", { ref, style: { height: 1, marginTop: -1 } });
|
|
5133
|
+
}
|
|
5134
|
+
|
|
5082
5135
|
// src/rich-text-editor/plugins/FloatingLinkEditorPlugin/index.tsx
|
|
5083
|
-
var
|
|
5136
|
+
var import_react75 = require("react");
|
|
5084
5137
|
var React4 = require("react");
|
|
5085
|
-
var
|
|
5138
|
+
var import_lexical8 = require("lexical");
|
|
5086
5139
|
var import_react_dom3 = require("react-dom");
|
|
5087
5140
|
var import_link4 = require("@lexical/link");
|
|
5088
5141
|
var import_LexicalComposerContext4 = require("@lexical/react/LexicalComposerContext");
|
|
5089
5142
|
var import_utils = require("@lexical/utils");
|
|
5090
5143
|
|
|
5091
5144
|
// src/rich-text-editor/ui/LinkPreview.tsx
|
|
5092
|
-
var
|
|
5145
|
+
var import_react74 = require("react");
|
|
5093
5146
|
var import_lexical7 = require("lexical");
|
|
5094
5147
|
var import_LexicalComposerContext3 = require("@lexical/react/LexicalComposerContext");
|
|
5095
|
-
var
|
|
5148
|
+
var import_jsx_runtime88 = require("react/jsx-runtime");
|
|
5096
5149
|
var PREVIEW_CACHE = {};
|
|
5097
5150
|
var URL_MATCHER2 = /((https?:\/\/(www\.)?)|(www\.))[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)/;
|
|
5098
5151
|
function useSuspenseRequest(url) {
|
|
@@ -5116,12 +5169,12 @@ function useSuspenseRequest(url) {
|
|
|
5116
5169
|
function LinkPreviewContent({
|
|
5117
5170
|
url
|
|
5118
5171
|
}) {
|
|
5119
|
-
const [textContent, setTextContent] = (0,
|
|
5172
|
+
const [textContent, setTextContent] = (0, import_react74.useState)("");
|
|
5120
5173
|
const { preview } = useSuspenseRequest(url);
|
|
5121
5174
|
const [editor] = (0, import_LexicalComposerContext3.useLexicalComposerContext)();
|
|
5122
5175
|
const tr = useTr();
|
|
5123
5176
|
const hasPreview = preview !== null && preview.google?.title;
|
|
5124
|
-
(0,
|
|
5177
|
+
(0, import_react74.useEffect)(() => {
|
|
5125
5178
|
editor.update(() => {
|
|
5126
5179
|
const sel = (0, import_lexical7.$getSelection)();
|
|
5127
5180
|
const nodes = sel?.getNodes();
|
|
@@ -5149,18 +5202,18 @@ function LinkPreviewContent({
|
|
|
5149
5202
|
if (!hasPreview) {
|
|
5150
5203
|
return null;
|
|
5151
5204
|
}
|
|
5152
|
-
return /* @__PURE__ */ (0,
|
|
5153
|
-
preview.google.image && /* @__PURE__ */ (0,
|
|
5154
|
-
preview.google.title && /* @__PURE__ */ (0,
|
|
5155
|
-
preview.google.description && /* @__PURE__ */ (0,
|
|
5156
|
-
textContent && textContent !== preview.google.title ? /* @__PURE__ */ (0,
|
|
5205
|
+
return /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("div", { className: "c-rte-link-preview", children: [
|
|
5206
|
+
preview.google.image && /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("div", { className: "c-rte-link-preview-image-wrapper", children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("img", { src: preview.google.image, alt: preview.google.title, className: "c-rte-link-preview-image" }) }),
|
|
5207
|
+
preview.google.title && /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("div", { className: "c-rte-link-preview-title", children: preview.google.title }),
|
|
5208
|
+
preview.google.description && /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("div", { className: "c-rte-link-preview-description", children: preview.google.description }),
|
|
5209
|
+
textContent && textContent !== preview.google.title ? /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(Button, { className: "c-rte-link-preview__replace-text-btn", onClick: useTitleForText, children: tr("linkPreviewReplaceTextWithTitle") }) : null
|
|
5157
5210
|
] });
|
|
5158
5211
|
}
|
|
5159
5212
|
function Glimmer(props) {
|
|
5160
|
-
return /* @__PURE__ */ (0,
|
|
5213
|
+
return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
|
|
5161
5214
|
"div",
|
|
5162
5215
|
{
|
|
5163
|
-
className: "
|
|
5216
|
+
className: "c-rte-link-preview-glimmer",
|
|
5164
5217
|
...props,
|
|
5165
5218
|
style: {
|
|
5166
5219
|
animationDelay: String((props.index || 0) * 300),
|
|
@@ -5172,22 +5225,21 @@ function Glimmer(props) {
|
|
|
5172
5225
|
function LinkPreview({
|
|
5173
5226
|
url
|
|
5174
5227
|
}) {
|
|
5175
|
-
return /* @__PURE__ */ (0,
|
|
5176
|
-
|
|
5228
|
+
return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
|
|
5229
|
+
import_react74.Suspense,
|
|
5177
5230
|
{
|
|
5178
|
-
fallback: /* @__PURE__ */ (0,
|
|
5179
|
-
/* @__PURE__ */ (0,
|
|
5180
|
-
/* @__PURE__ */ (0,
|
|
5181
|
-
/* @__PURE__ */ (0,
|
|
5231
|
+
fallback: /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)(import_jsx_runtime88.Fragment, { children: [
|
|
5232
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)(Glimmer, { style: { height: "80px" }, index: 0 }),
|
|
5233
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)(Glimmer, { style: { width: "60%" }, index: 1 }),
|
|
5234
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)(Glimmer, { style: { width: "80%" }, index: 2 })
|
|
5182
5235
|
] }),
|
|
5183
|
-
children: /* @__PURE__ */ (0,
|
|
5236
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(LinkPreviewContent, { url })
|
|
5184
5237
|
}
|
|
5185
5238
|
);
|
|
5186
5239
|
}
|
|
5187
5240
|
|
|
5188
5241
|
// src/rich-text-editor/utils/getSelectedNode.ts
|
|
5189
5242
|
var import_selection = require("@lexical/selection");
|
|
5190
|
-
var import_lexical8 = require("lexical");
|
|
5191
5243
|
function getSelectedNode(selection) {
|
|
5192
5244
|
const anchor = selection.anchor;
|
|
5193
5245
|
const focus = selection.focus;
|
|
@@ -5248,24 +5300,24 @@ function validateUrl(url) {
|
|
|
5248
5300
|
}
|
|
5249
5301
|
|
|
5250
5302
|
// src/rich-text-editor/plugins/FloatingLinkEditorPlugin/index.tsx
|
|
5251
|
-
var
|
|
5303
|
+
var import_jsx_runtime89 = require("react/jsx-runtime");
|
|
5252
5304
|
function FloatingLinkEditor({
|
|
5253
5305
|
editor,
|
|
5254
5306
|
isLink,
|
|
5255
5307
|
setIsLink,
|
|
5256
5308
|
anchorElem
|
|
5257
5309
|
}) {
|
|
5258
|
-
const editorRef = (0,
|
|
5259
|
-
const inputRef = (0,
|
|
5260
|
-
const [linkUrl, setLinkUrl] = (0,
|
|
5261
|
-
const [rel, setRel] = (0,
|
|
5262
|
-
const [target, setTarget] = (0,
|
|
5263
|
-
const [isEditMode, setEditMode] = (0,
|
|
5264
|
-
const [lastSelection, setLastSelection] = (0,
|
|
5310
|
+
const editorRef = (0, import_react75.useRef)(null);
|
|
5311
|
+
const inputRef = (0, import_react75.useRef)(null);
|
|
5312
|
+
const [linkUrl, setLinkUrl] = (0, import_react75.useState)("");
|
|
5313
|
+
const [rel, setRel] = (0, import_react75.useState)(null);
|
|
5314
|
+
const [target, setTarget] = (0, import_react75.useState)(null);
|
|
5315
|
+
const [isEditMode, setEditMode] = (0, import_react75.useState)(false);
|
|
5316
|
+
const [lastSelection, setLastSelection] = (0, import_react75.useState)(null);
|
|
5265
5317
|
const tr = useTr();
|
|
5266
|
-
const updateLinkEditor = (0,
|
|
5267
|
-
const selection = (0,
|
|
5268
|
-
if ((0,
|
|
5318
|
+
const updateLinkEditor = (0, import_react75.useCallback)(() => {
|
|
5319
|
+
const selection = (0, import_lexical8.$getSelection)();
|
|
5320
|
+
if ((0, import_lexical8.$isRangeSelection)(selection)) {
|
|
5269
5321
|
const node = getSelectedNode(selection);
|
|
5270
5322
|
const parent2 = node.getParent();
|
|
5271
5323
|
if ((0, import_link4.$isLinkNode)(parent2)) {
|
|
@@ -5313,7 +5365,7 @@ function FloatingLinkEditor({
|
|
|
5313
5365
|
}
|
|
5314
5366
|
return true;
|
|
5315
5367
|
}, [anchorElem, editor]);
|
|
5316
|
-
(0,
|
|
5368
|
+
(0, import_react75.useEffect)(() => {
|
|
5317
5369
|
const scrollerElem = anchorElem.parentElement;
|
|
5318
5370
|
const update = () => {
|
|
5319
5371
|
editor.getEditorState().read(() => {
|
|
@@ -5331,7 +5383,7 @@ function FloatingLinkEditor({
|
|
|
5331
5383
|
}
|
|
5332
5384
|
};
|
|
5333
5385
|
}, [anchorElem.parentElement, editor, updateLinkEditor]);
|
|
5334
|
-
(0,
|
|
5386
|
+
(0, import_react75.useEffect)(() => {
|
|
5335
5387
|
return (0, import_utils.mergeRegister)(
|
|
5336
5388
|
editor.registerUpdateListener(({ editorState }) => {
|
|
5337
5389
|
editorState.read(() => {
|
|
@@ -5339,15 +5391,15 @@ function FloatingLinkEditor({
|
|
|
5339
5391
|
});
|
|
5340
5392
|
}),
|
|
5341
5393
|
editor.registerCommand(
|
|
5342
|
-
|
|
5394
|
+
import_lexical8.SELECTION_CHANGE_COMMAND,
|
|
5343
5395
|
() => {
|
|
5344
5396
|
updateLinkEditor();
|
|
5345
5397
|
return true;
|
|
5346
5398
|
},
|
|
5347
|
-
|
|
5399
|
+
import_lexical8.COMMAND_PRIORITY_LOW
|
|
5348
5400
|
),
|
|
5349
5401
|
editor.registerCommand(
|
|
5350
|
-
|
|
5402
|
+
import_lexical8.KEY_ESCAPE_COMMAND,
|
|
5351
5403
|
() => {
|
|
5352
5404
|
if (isLink) {
|
|
5353
5405
|
setIsLink(false);
|
|
@@ -5355,22 +5407,22 @@ function FloatingLinkEditor({
|
|
|
5355
5407
|
}
|
|
5356
5408
|
return false;
|
|
5357
5409
|
},
|
|
5358
|
-
|
|
5410
|
+
import_lexical8.COMMAND_PRIORITY_HIGH
|
|
5359
5411
|
)
|
|
5360
5412
|
);
|
|
5361
5413
|
}, [editor, updateLinkEditor, setIsLink, isLink]);
|
|
5362
|
-
(0,
|
|
5414
|
+
(0, import_react75.useEffect)(() => {
|
|
5363
5415
|
editor.getEditorState().read(() => {
|
|
5364
5416
|
updateLinkEditor();
|
|
5365
5417
|
});
|
|
5366
5418
|
}, [editor, updateLinkEditor]);
|
|
5367
|
-
(0,
|
|
5419
|
+
(0, import_react75.useEffect)(() => {
|
|
5368
5420
|
if (isEditMode && inputRef.current) {
|
|
5369
5421
|
inputRef.current.focus();
|
|
5370
5422
|
}
|
|
5371
5423
|
}, [isEditMode]);
|
|
5372
|
-
return /* @__PURE__ */ (0,
|
|
5373
|
-
/* @__PURE__ */ (0,
|
|
5424
|
+
return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("div", { ref: editorRef, className: "c-rte-link-editor", children: isEditMode ? /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("div", { children: [
|
|
5425
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)("div", { className: "c-rte-link-editor-input-group", children: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
|
|
5374
5426
|
InputWithLabel,
|
|
5375
5427
|
{
|
|
5376
5428
|
label: tr("linkEditorLink"),
|
|
@@ -5379,7 +5431,7 @@ function FloatingLinkEditor({
|
|
|
5379
5431
|
onChange: (e) => setLinkUrl(e.target.value)
|
|
5380
5432
|
}
|
|
5381
5433
|
) }),
|
|
5382
|
-
/* @__PURE__ */ (0,
|
|
5434
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)("div", { className: "c-rte-link-editor-input-group", children: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
|
|
5383
5435
|
InputWithLabel,
|
|
5384
5436
|
{
|
|
5385
5437
|
label: tr("linkEditorRel"),
|
|
@@ -5388,7 +5440,7 @@ function FloatingLinkEditor({
|
|
|
5388
5440
|
onChange: (e) => setRel(e.target.value)
|
|
5389
5441
|
}
|
|
5390
5442
|
) }),
|
|
5391
|
-
/* @__PURE__ */ (0,
|
|
5443
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)("div", { className: "c-rte-link-editor-input-group", children: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
|
|
5392
5444
|
InputWithLabel,
|
|
5393
5445
|
{
|
|
5394
5446
|
label: tr("linkEditorTarget"),
|
|
@@ -5397,7 +5449,7 @@ function FloatingLinkEditor({
|
|
|
5397
5449
|
onChange: (e) => setTarget(e.target.value)
|
|
5398
5450
|
}
|
|
5399
5451
|
) }),
|
|
5400
|
-
/* @__PURE__ */ (0,
|
|
5452
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)("div", { className: "c-rte-link-editor-button-wrap", children: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
|
|
5401
5453
|
Button,
|
|
5402
5454
|
{
|
|
5403
5455
|
onClick: () => {
|
|
@@ -5415,16 +5467,16 @@ function FloatingLinkEditor({
|
|
|
5415
5467
|
children: tr("linkEditorCommit")
|
|
5416
5468
|
}
|
|
5417
5469
|
) })
|
|
5418
|
-
] }) : /* @__PURE__ */ (0,
|
|
5419
|
-
/* @__PURE__ */ (0,
|
|
5420
|
-
/* @__PURE__ */ (0,
|
|
5421
|
-
/* @__PURE__ */ (0,
|
|
5422
|
-
rel || target ? /* @__PURE__ */ (0,
|
|
5423
|
-
rel && /* @__PURE__ */ (0,
|
|
5424
|
-
target && /* @__PURE__ */ (0,
|
|
5470
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)(import_jsx_runtime89.Fragment, { children: [
|
|
5471
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("div", { className: "c-rte-link-editor-link-input", children: [
|
|
5472
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("div", { className: "c-rte-link-editor-link-preview", children: [
|
|
5473
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)("a", { href: linkUrl, target: "_blank", rel: "noopener noreferrer", children: linkUrl }),
|
|
5474
|
+
rel || target ? /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("div", { className: "c-rte-link-editor-preview-attrs", children: [
|
|
5475
|
+
rel && /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("div", { className: "c-rte-link-editor-preview-attr", children: rel }),
|
|
5476
|
+
target && /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("div", { className: "c-rte-link-editor-preview-attr", children: target })
|
|
5425
5477
|
] }) : null
|
|
5426
5478
|
] }),
|
|
5427
|
-
/* @__PURE__ */ (0,
|
|
5479
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
|
|
5428
5480
|
IconButton,
|
|
5429
5481
|
{
|
|
5430
5482
|
size: "sm",
|
|
@@ -5432,19 +5484,19 @@ function FloatingLinkEditor({
|
|
|
5432
5484
|
onMouseDown: (event) => event.preventDefault(),
|
|
5433
5485
|
onClick: () => setEditMode(true),
|
|
5434
5486
|
"aria-label": tr("linkEditorEdit"),
|
|
5435
|
-
children: /* @__PURE__ */ (0,
|
|
5487
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(Icon.Edit, {})
|
|
5436
5488
|
}
|
|
5437
5489
|
) })
|
|
5438
5490
|
] }),
|
|
5439
|
-
/* @__PURE__ */ (0,
|
|
5491
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(LinkPreview, { url: linkUrl }) })
|
|
5440
5492
|
] }) });
|
|
5441
5493
|
}
|
|
5442
5494
|
function useFloatingLinkEditorToolbar(editor, anchorElem) {
|
|
5443
|
-
const [activeEditor, setActiveEditor] = (0,
|
|
5444
|
-
const [isLink, setIsLink] = (0,
|
|
5445
|
-
const updateToolbar = (0,
|
|
5446
|
-
const selection = (0,
|
|
5447
|
-
if ((0,
|
|
5495
|
+
const [activeEditor, setActiveEditor] = (0, import_react75.useState)(editor);
|
|
5496
|
+
const [isLink, setIsLink] = (0, import_react75.useState)(false);
|
|
5497
|
+
const updateToolbar = (0, import_react75.useCallback)(() => {
|
|
5498
|
+
const selection = (0, import_lexical8.$getSelection)();
|
|
5499
|
+
if ((0, import_lexical8.$isRangeSelection)(selection)) {
|
|
5448
5500
|
const node = getSelectedNode(selection);
|
|
5449
5501
|
const linkParent = (0, import_utils.$findMatchingParent)(node, import_link4.$isLinkNode);
|
|
5450
5502
|
const autoLinkParent = (0, import_utils.$findMatchingParent)(node, import_link4.$isAutoLinkNode);
|
|
@@ -5455,19 +5507,19 @@ function useFloatingLinkEditorToolbar(editor, anchorElem) {
|
|
|
5455
5507
|
}
|
|
5456
5508
|
}
|
|
5457
5509
|
}, []);
|
|
5458
|
-
(0,
|
|
5510
|
+
(0, import_react75.useEffect)(() => {
|
|
5459
5511
|
return editor.registerCommand(
|
|
5460
|
-
|
|
5512
|
+
import_lexical8.SELECTION_CHANGE_COMMAND,
|
|
5461
5513
|
(_payload, newEditor) => {
|
|
5462
5514
|
updateToolbar();
|
|
5463
5515
|
setActiveEditor(newEditor);
|
|
5464
5516
|
return false;
|
|
5465
5517
|
},
|
|
5466
|
-
|
|
5518
|
+
import_lexical8.COMMAND_PRIORITY_CRITICAL
|
|
5467
5519
|
);
|
|
5468
5520
|
}, [editor, updateToolbar]);
|
|
5469
5521
|
return isLink ? (0, import_react_dom3.createPortal)(
|
|
5470
|
-
/* @__PURE__ */ (0,
|
|
5522
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)(FloatingLinkEditor, { editor: activeEditor, isLink, anchorElem, setIsLink }),
|
|
5471
5523
|
anchorElem
|
|
5472
5524
|
) : null;
|
|
5473
5525
|
}
|
|
@@ -5479,9 +5531,9 @@ function FloatingLinkEditorPlugin({
|
|
|
5479
5531
|
}
|
|
5480
5532
|
|
|
5481
5533
|
// src/rich-text-editor/plugins/FloatingTextFormatToolbarPlugin/index.tsx
|
|
5482
|
-
var
|
|
5534
|
+
var import_react76 = require("react");
|
|
5483
5535
|
var React5 = require("react");
|
|
5484
|
-
var
|
|
5536
|
+
var import_lexical9 = require("lexical");
|
|
5485
5537
|
var import_react_dom4 = require("react-dom");
|
|
5486
5538
|
var import_code8 = require("@lexical/code");
|
|
5487
5539
|
var import_link5 = require("@lexical/link");
|
|
@@ -5521,7 +5573,7 @@ function getDOMRangeRect(nativeSelection, rootElement) {
|
|
|
5521
5573
|
}
|
|
5522
5574
|
|
|
5523
5575
|
// src/rich-text-editor/plugins/FloatingTextFormatToolbarPlugin/index.tsx
|
|
5524
|
-
var
|
|
5576
|
+
var import_jsx_runtime90 = require("react/jsx-runtime");
|
|
5525
5577
|
function TextFormatFloatingToolbar({
|
|
5526
5578
|
editor,
|
|
5527
5579
|
anchorElem,
|
|
@@ -5534,17 +5586,17 @@ function TextFormatFloatingToolbar({
|
|
|
5534
5586
|
isSubscript,
|
|
5535
5587
|
isSuperscript
|
|
5536
5588
|
}) {
|
|
5537
|
-
const popupCharStylesEditorRef = (0,
|
|
5589
|
+
const popupCharStylesEditorRef = (0, import_react76.useRef)(null);
|
|
5538
5590
|
const tr = useTr();
|
|
5539
|
-
const insertLink = (0,
|
|
5591
|
+
const insertLink = (0, import_react76.useCallback)(() => {
|
|
5540
5592
|
if (!isLink) {
|
|
5541
5593
|
editor.dispatchCommand(import_link5.TOGGLE_LINK_COMMAND, "https://");
|
|
5542
5594
|
} else {
|
|
5543
5595
|
editor.dispatchCommand(import_link5.TOGGLE_LINK_COMMAND, null);
|
|
5544
5596
|
}
|
|
5545
5597
|
}, [editor, isLink]);
|
|
5546
|
-
const updateTextFormatFloatingToolbar = (0,
|
|
5547
|
-
const selection = (0,
|
|
5598
|
+
const updateTextFormatFloatingToolbar = (0, import_react76.useCallback)(() => {
|
|
5599
|
+
const selection = (0, import_lexical9.$getSelection)();
|
|
5548
5600
|
const popupCharStylesEditorElem = popupCharStylesEditorRef.current;
|
|
5549
5601
|
const nativeSelection = window.getSelection();
|
|
5550
5602
|
if (popupCharStylesEditorElem === null) {
|
|
@@ -5556,7 +5608,7 @@ function TextFormatFloatingToolbar({
|
|
|
5556
5608
|
setFloatingElemPosition(rangeRect, popupCharStylesEditorElem, anchorElem);
|
|
5557
5609
|
}
|
|
5558
5610
|
}, [editor, anchorElem]);
|
|
5559
|
-
(0,
|
|
5611
|
+
(0, import_react76.useEffect)(() => {
|
|
5560
5612
|
const scrollerElem = anchorElem.parentElement;
|
|
5561
5613
|
const update = () => {
|
|
5562
5614
|
editor.getEditorState().read(() => {
|
|
@@ -5574,7 +5626,7 @@ function TextFormatFloatingToolbar({
|
|
|
5574
5626
|
}
|
|
5575
5627
|
};
|
|
5576
5628
|
}, [editor, updateTextFormatFloatingToolbar, anchorElem]);
|
|
5577
|
-
(0,
|
|
5629
|
+
(0, import_react76.useEffect)(() => {
|
|
5578
5630
|
editor.getEditorState().read(() => {
|
|
5579
5631
|
updateTextFormatFloatingToolbar();
|
|
5580
5632
|
});
|
|
@@ -5585,144 +5637,144 @@ function TextFormatFloatingToolbar({
|
|
|
5585
5637
|
});
|
|
5586
5638
|
}),
|
|
5587
5639
|
editor.registerCommand(
|
|
5588
|
-
|
|
5640
|
+
import_lexical9.SELECTION_CHANGE_COMMAND,
|
|
5589
5641
|
() => {
|
|
5590
5642
|
updateTextFormatFloatingToolbar();
|
|
5591
5643
|
return false;
|
|
5592
5644
|
},
|
|
5593
|
-
|
|
5645
|
+
import_lexical9.COMMAND_PRIORITY_LOW
|
|
5594
5646
|
)
|
|
5595
5647
|
);
|
|
5596
5648
|
}, [editor, updateTextFormatFloatingToolbar]);
|
|
5597
|
-
return /* @__PURE__ */ (0,
|
|
5598
|
-
/* @__PURE__ */ (0,
|
|
5649
|
+
return /* @__PURE__ */ (0, import_jsx_runtime90.jsx)("div", { ref: popupCharStylesEditorRef, className: "c-rte-floating-text-format-tb-plugin", children: editor.isEditable() && /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)(import_jsx_runtime90.Fragment, { children: [
|
|
5650
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
5599
5651
|
IconButton,
|
|
5600
5652
|
{
|
|
5601
5653
|
onClick: () => {
|
|
5602
|
-
editor.dispatchCommand(
|
|
5654
|
+
editor.dispatchCommand(import_lexical9.FORMAT_TEXT_COMMAND, "bold");
|
|
5603
5655
|
},
|
|
5604
5656
|
style: { padding: 0, overflow: "hidden" },
|
|
5605
5657
|
title: tr(IS_APPLE ? "actionFormatAsStrongTitleApple" : "actionFormatAsStrongTitle"),
|
|
5606
5658
|
"aria-label": tr("actionFormatAsStrongLabel"),
|
|
5607
|
-
children: /* @__PURE__ */ (0,
|
|
5659
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
5608
5660
|
"i",
|
|
5609
5661
|
{
|
|
5610
|
-
className: `
|
|
5662
|
+
className: `c-rte-icon-bold c-rte-floating-text-format-tb-plugin__format-icon ${isBold ? "selected" : ""}`
|
|
5611
5663
|
}
|
|
5612
5664
|
)
|
|
5613
5665
|
}
|
|
5614
5666
|
),
|
|
5615
|
-
/* @__PURE__ */ (0,
|
|
5667
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
5616
5668
|
IconButton,
|
|
5617
5669
|
{
|
|
5618
5670
|
style: { padding: 0, overflow: "hidden" },
|
|
5619
5671
|
onClick: () => {
|
|
5620
|
-
editor.dispatchCommand(
|
|
5672
|
+
editor.dispatchCommand(import_lexical9.FORMAT_TEXT_COMMAND, "italic");
|
|
5621
5673
|
},
|
|
5622
5674
|
title: tr("actionFormatAsEmphasizedTitle"),
|
|
5623
5675
|
"aria-label": tr("actionFormatAsEmphasizedLabel"),
|
|
5624
|
-
children: /* @__PURE__ */ (0,
|
|
5676
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
5625
5677
|
"i",
|
|
5626
5678
|
{
|
|
5627
|
-
className: `
|
|
5679
|
+
className: `c-rte-icon-italic c-rte-floating-text-format-tb-plugin__format-icon ${isItalic ? "selected" : ""}`
|
|
5628
5680
|
}
|
|
5629
5681
|
)
|
|
5630
5682
|
}
|
|
5631
5683
|
),
|
|
5632
|
-
/* @__PURE__ */ (0,
|
|
5684
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
5633
5685
|
IconButton,
|
|
5634
5686
|
{
|
|
5635
5687
|
style: { padding: 0, overflow: "hidden" },
|
|
5636
5688
|
onClick: () => {
|
|
5637
|
-
editor.dispatchCommand(
|
|
5689
|
+
editor.dispatchCommand(import_lexical9.FORMAT_TEXT_COMMAND, "underline");
|
|
5638
5690
|
},
|
|
5639
5691
|
title: tr("actionFormatAsUnderlinedTitle"),
|
|
5640
5692
|
"aria-label": tr("actionFormatAsUnderlinedLabel"),
|
|
5641
|
-
children: /* @__PURE__ */ (0,
|
|
5693
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
5642
5694
|
"i",
|
|
5643
5695
|
{
|
|
5644
|
-
className: `
|
|
5696
|
+
className: `c-rte-icon-underline c-rte-floating-text-format-tb-plugin__format-icon ${isUnderline ? "selected" : ""}`
|
|
5645
5697
|
}
|
|
5646
5698
|
)
|
|
5647
5699
|
}
|
|
5648
5700
|
),
|
|
5649
|
-
/* @__PURE__ */ (0,
|
|
5701
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
5650
5702
|
IconButton,
|
|
5651
5703
|
{
|
|
5652
5704
|
style: { padding: 0, overflow: "hidden" },
|
|
5653
5705
|
onClick: () => {
|
|
5654
|
-
editor.dispatchCommand(
|
|
5706
|
+
editor.dispatchCommand(import_lexical9.FORMAT_TEXT_COMMAND, "strikethrough");
|
|
5655
5707
|
},
|
|
5656
5708
|
title: tr("actionFormatWithStrikethroughTitle"),
|
|
5657
5709
|
"aria-label": tr("actionFormatWithStrikethroughLabel"),
|
|
5658
|
-
children: /* @__PURE__ */ (0,
|
|
5710
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
5659
5711
|
"i",
|
|
5660
5712
|
{
|
|
5661
|
-
className: `
|
|
5713
|
+
className: `c-rte-icon-strikethrough c-rte-floating-text-format-tb-plugin__format-icon ${isStrikethrough ? "selected" : ""}`
|
|
5662
5714
|
}
|
|
5663
5715
|
)
|
|
5664
5716
|
}
|
|
5665
5717
|
),
|
|
5666
|
-
/* @__PURE__ */ (0,
|
|
5718
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
5667
5719
|
IconButton,
|
|
5668
5720
|
{
|
|
5669
5721
|
style: { padding: 0, overflow: "hidden" },
|
|
5670
5722
|
onClick: () => {
|
|
5671
|
-
editor.dispatchCommand(
|
|
5723
|
+
editor.dispatchCommand(import_lexical9.FORMAT_TEXT_COMMAND, "subscript");
|
|
5672
5724
|
},
|
|
5673
5725
|
title: tr("actionFormatWithSubscriptTitle"),
|
|
5674
5726
|
"aria-label": tr("actionFormatWithSubscriptLabel"),
|
|
5675
|
-
children: /* @__PURE__ */ (0,
|
|
5727
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
5676
5728
|
"i",
|
|
5677
5729
|
{
|
|
5678
|
-
className: `
|
|
5730
|
+
className: `c-rte-icon-subscript c-rte-floating-text-format-tb-plugin__format-icon ${isSubscript ? "selected" : ""}`
|
|
5679
5731
|
}
|
|
5680
5732
|
)
|
|
5681
5733
|
}
|
|
5682
5734
|
),
|
|
5683
|
-
/* @__PURE__ */ (0,
|
|
5735
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
5684
5736
|
IconButton,
|
|
5685
5737
|
{
|
|
5686
5738
|
style: { padding: 0, overflow: "hidden" },
|
|
5687
5739
|
onClick: () => {
|
|
5688
|
-
editor.dispatchCommand(
|
|
5740
|
+
editor.dispatchCommand(import_lexical9.FORMAT_TEXT_COMMAND, "superscript");
|
|
5689
5741
|
},
|
|
5690
5742
|
title: tr("actionFormatWithSuperscriptTitle"),
|
|
5691
5743
|
"aria-label": tr("actionFormatWithSuperscriptLabel"),
|
|
5692
|
-
children: /* @__PURE__ */ (0,
|
|
5744
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
5693
5745
|
"i",
|
|
5694
5746
|
{
|
|
5695
|
-
className: `
|
|
5747
|
+
className: `c-rte-icon-superscript c-rte-floating-text-format-tb-plugin__format-icon ${isSuperscript ? "selected" : ""}`
|
|
5696
5748
|
}
|
|
5697
5749
|
)
|
|
5698
5750
|
}
|
|
5699
5751
|
),
|
|
5700
|
-
/* @__PURE__ */ (0,
|
|
5752
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
5701
5753
|
IconButton,
|
|
5702
5754
|
{
|
|
5703
5755
|
style: { padding: 0, overflow: "hidden" },
|
|
5704
5756
|
onClick: () => {
|
|
5705
|
-
editor.dispatchCommand(
|
|
5757
|
+
editor.dispatchCommand(import_lexical9.FORMAT_TEXT_COMMAND, "code");
|
|
5706
5758
|
},
|
|
5707
5759
|
"aria-label": tr("actionInsertCodeBlock"),
|
|
5708
|
-
children: /* @__PURE__ */ (0,
|
|
5760
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
5709
5761
|
"i",
|
|
5710
5762
|
{
|
|
5711
|
-
className: `
|
|
5763
|
+
className: `c-rte-icon-code c-rte-floating-text-format-tb-plugin__format-icon ${isCode ? "selected" : ""}`
|
|
5712
5764
|
}
|
|
5713
5765
|
)
|
|
5714
5766
|
}
|
|
5715
5767
|
),
|
|
5716
|
-
/* @__PURE__ */ (0,
|
|
5768
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
5717
5769
|
IconButton,
|
|
5718
5770
|
{
|
|
5719
5771
|
style: { padding: 0, overflow: "hidden" },
|
|
5720
5772
|
onClick: insertLink,
|
|
5721
5773
|
"aria-label": tr("actionInsertlink"),
|
|
5722
|
-
children: /* @__PURE__ */ (0,
|
|
5774
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
5723
5775
|
"i",
|
|
5724
5776
|
{
|
|
5725
|
-
className: `
|
|
5777
|
+
className: `c-rte-icon-link c-rte-floating-text-format-tb-plugin__format-icon ${isLink ? "selected" : ""}`
|
|
5726
5778
|
}
|
|
5727
5779
|
)
|
|
5728
5780
|
}
|
|
@@ -5730,28 +5782,28 @@ function TextFormatFloatingToolbar({
|
|
|
5730
5782
|
] }) });
|
|
5731
5783
|
}
|
|
5732
5784
|
function useFloatingTextFormatToolbar(editor, anchorElem) {
|
|
5733
|
-
const [isText, setIsText] = (0,
|
|
5734
|
-
const [isLink, setIsLink] = (0,
|
|
5735
|
-
const [isBold, setIsBold] = (0,
|
|
5736
|
-
const [isItalic, setIsItalic] = (0,
|
|
5737
|
-
const [isUnderline, setIsUnderline] = (0,
|
|
5738
|
-
const [isStrikethrough, setIsStrikethrough] = (0,
|
|
5739
|
-
const [isSubscript, setIsSubscript] = (0,
|
|
5740
|
-
const [isSuperscript, setIsSuperscript] = (0,
|
|
5741
|
-
const [isCode, setIsCode] = (0,
|
|
5742
|
-
const updatePopup = (0,
|
|
5785
|
+
const [isText, setIsText] = (0, import_react76.useState)(false);
|
|
5786
|
+
const [isLink, setIsLink] = (0, import_react76.useState)(false);
|
|
5787
|
+
const [isBold, setIsBold] = (0, import_react76.useState)(false);
|
|
5788
|
+
const [isItalic, setIsItalic] = (0, import_react76.useState)(false);
|
|
5789
|
+
const [isUnderline, setIsUnderline] = (0, import_react76.useState)(false);
|
|
5790
|
+
const [isStrikethrough, setIsStrikethrough] = (0, import_react76.useState)(false);
|
|
5791
|
+
const [isSubscript, setIsSubscript] = (0, import_react76.useState)(false);
|
|
5792
|
+
const [isSuperscript, setIsSuperscript] = (0, import_react76.useState)(false);
|
|
5793
|
+
const [isCode, setIsCode] = (0, import_react76.useState)(false);
|
|
5794
|
+
const updatePopup = (0, import_react76.useCallback)(() => {
|
|
5743
5795
|
editor.getEditorState().read(() => {
|
|
5744
5796
|
if (editor.isComposing()) {
|
|
5745
5797
|
return;
|
|
5746
5798
|
}
|
|
5747
|
-
const selection = (0,
|
|
5799
|
+
const selection = (0, import_lexical9.$getSelection)();
|
|
5748
5800
|
const nativeSelection = window.getSelection();
|
|
5749
5801
|
const rootElement = editor.getRootElement();
|
|
5750
|
-
if (nativeSelection !== null && (!(0,
|
|
5802
|
+
if (nativeSelection !== null && (!(0, import_lexical9.$isRangeSelection)(selection) || rootElement === null || !rootElement.contains(nativeSelection.anchorNode))) {
|
|
5751
5803
|
setIsText(false);
|
|
5752
5804
|
return;
|
|
5753
5805
|
}
|
|
5754
|
-
if (!(0,
|
|
5806
|
+
if (!(0, import_lexical9.$isRangeSelection)(selection)) {
|
|
5755
5807
|
return;
|
|
5756
5808
|
}
|
|
5757
5809
|
const node = getSelectedNode(selection);
|
|
@@ -5769,19 +5821,19 @@ function useFloatingTextFormatToolbar(editor, anchorElem) {
|
|
|
5769
5821
|
setIsLink(false);
|
|
5770
5822
|
}
|
|
5771
5823
|
if (!(0, import_code8.$isCodeHighlightNode)(selection.anchor.getNode()) && selection.getTextContent() !== "") {
|
|
5772
|
-
setIsText((0,
|
|
5824
|
+
setIsText((0, import_lexical9.$isTextNode)(node));
|
|
5773
5825
|
} else {
|
|
5774
5826
|
setIsText(false);
|
|
5775
5827
|
}
|
|
5776
5828
|
});
|
|
5777
5829
|
}, [editor]);
|
|
5778
|
-
(0,
|
|
5830
|
+
(0, import_react76.useEffect)(() => {
|
|
5779
5831
|
document.addEventListener("selectionchange", updatePopup);
|
|
5780
5832
|
return () => {
|
|
5781
5833
|
document.removeEventListener("selectionchange", updatePopup);
|
|
5782
5834
|
};
|
|
5783
5835
|
}, [updatePopup]);
|
|
5784
|
-
(0,
|
|
5836
|
+
(0, import_react76.useEffect)(() => {
|
|
5785
5837
|
return (0, import_utils2.mergeRegister)(
|
|
5786
5838
|
editor.registerUpdateListener(() => {
|
|
5787
5839
|
updatePopup();
|
|
@@ -5797,7 +5849,7 @@ function useFloatingTextFormatToolbar(editor, anchorElem) {
|
|
|
5797
5849
|
return null;
|
|
5798
5850
|
}
|
|
5799
5851
|
return (0, import_react_dom4.createPortal)(
|
|
5800
|
-
/* @__PURE__ */ (0,
|
|
5852
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
5801
5853
|
TextFormatFloatingToolbar,
|
|
5802
5854
|
{
|
|
5803
5855
|
editor,
|
|
@@ -5823,33 +5875,28 @@ function FloatingTextFormatToolbarPlugin({
|
|
|
5823
5875
|
}
|
|
5824
5876
|
|
|
5825
5877
|
// src/rich-text-editor/plugins/LinkPlugin/index.tsx
|
|
5826
|
-
var import_LexicalLinkPlugin = require("@lexical/react/LexicalLinkPlugin");
|
|
5827
5878
|
var React6 = require("react");
|
|
5828
|
-
var
|
|
5879
|
+
var import_LexicalLinkPlugin = require("@lexical/react/LexicalLinkPlugin");
|
|
5880
|
+
var import_jsx_runtime91 = require("react/jsx-runtime");
|
|
5829
5881
|
function LinkPlugin() {
|
|
5830
|
-
return /* @__PURE__ */ (0,
|
|
5882
|
+
return /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(import_LexicalLinkPlugin.LinkPlugin, { validateUrl });
|
|
5831
5883
|
}
|
|
5832
5884
|
|
|
5833
5885
|
// src/rich-text-editor/plugins/ListMaxIndentLevelPlugin/index.ts
|
|
5886
|
+
var import_react77 = require("react");
|
|
5887
|
+
var import_lexical10 = require("lexical");
|
|
5834
5888
|
var import_list4 = require("@lexical/list");
|
|
5835
5889
|
var import_LexicalComposerContext6 = require("@lexical/react/LexicalComposerContext");
|
|
5836
|
-
var import_lexical11 = require("lexical");
|
|
5837
|
-
var import_react76 = require("react");
|
|
5838
5890
|
function getElementNodesInSelection(selection) {
|
|
5839
5891
|
const nodesInSelection = selection.getNodes();
|
|
5840
5892
|
if (nodesInSelection.length === 0) {
|
|
5841
|
-
return /* @__PURE__ */ new Set([
|
|
5842
|
-
selection.anchor.getNode().getParentOrThrow(),
|
|
5843
|
-
selection.focus.getNode().getParentOrThrow()
|
|
5844
|
-
]);
|
|
5893
|
+
return /* @__PURE__ */ new Set([selection.anchor.getNode().getParentOrThrow(), selection.focus.getNode().getParentOrThrow()]);
|
|
5845
5894
|
}
|
|
5846
|
-
return new Set(
|
|
5847
|
-
nodesInSelection.map((n) => (0, import_lexical11.$isElementNode)(n) ? n : n.getParentOrThrow())
|
|
5848
|
-
);
|
|
5895
|
+
return new Set(nodesInSelection.map((n) => (0, import_lexical10.$isElementNode)(n) ? n : n.getParentOrThrow()));
|
|
5849
5896
|
}
|
|
5850
5897
|
function isIndentPermitted(maxDepth) {
|
|
5851
|
-
const selection = (0,
|
|
5852
|
-
if (!(0,
|
|
5898
|
+
const selection = (0, import_lexical10.$getSelection)();
|
|
5899
|
+
if (!(0, import_lexical10.$isRangeSelection)(selection)) {
|
|
5853
5900
|
return false;
|
|
5854
5901
|
}
|
|
5855
5902
|
const elementNodesInSelection = getElementNodesInSelection(selection);
|
|
@@ -5860,9 +5907,7 @@ function isIndentPermitted(maxDepth) {
|
|
|
5860
5907
|
} else if ((0, import_list4.$isListItemNode)(elementNode)) {
|
|
5861
5908
|
const parent2 = elementNode.getParent();
|
|
5862
5909
|
if (!(0, import_list4.$isListNode)(parent2)) {
|
|
5863
|
-
throw new Error(
|
|
5864
|
-
"ListMaxIndentLevelPlugin: A ListItemNode must have a ListNode for a parent."
|
|
5865
|
-
);
|
|
5910
|
+
throw new Error("ListMaxIndentLevelPlugin: A ListItemNode must have a ListNode for a parent.");
|
|
5866
5911
|
}
|
|
5867
5912
|
totalDepth = Math.max((0, import_list4.$getListDepth)(parent2) + 1, totalDepth);
|
|
5868
5913
|
}
|
|
@@ -5871,19 +5916,19 @@ function isIndentPermitted(maxDepth) {
|
|
|
5871
5916
|
}
|
|
5872
5917
|
function ListMaxIndentLevelPlugin({ maxDepth }) {
|
|
5873
5918
|
const [editor] = (0, import_LexicalComposerContext6.useLexicalComposerContext)();
|
|
5874
|
-
(0,
|
|
5919
|
+
(0, import_react77.useEffect)(() => {
|
|
5875
5920
|
return editor.registerCommand(
|
|
5876
|
-
|
|
5921
|
+
import_lexical10.INDENT_CONTENT_COMMAND,
|
|
5877
5922
|
() => !isIndentPermitted(maxDepth ?? 7),
|
|
5878
|
-
|
|
5923
|
+
import_lexical10.COMMAND_PRIORITY_CRITICAL
|
|
5879
5924
|
);
|
|
5880
5925
|
}, [editor, maxDepth]);
|
|
5881
5926
|
return null;
|
|
5882
5927
|
}
|
|
5883
5928
|
|
|
5884
5929
|
// src/rich-text-editor/plugins/MaxLengthPlugin/index.tsx
|
|
5885
|
-
var
|
|
5886
|
-
var
|
|
5930
|
+
var import_react78 = require("react");
|
|
5931
|
+
var import_lexical11 = require("lexical");
|
|
5887
5932
|
var import_LexicalComposerContext7 = require("@lexical/react/LexicalComposerContext");
|
|
5888
5933
|
var import_selection2 = require("@lexical/selection");
|
|
5889
5934
|
var import_utils3 = require("@lexical/utils");
|
|
@@ -5924,12 +5969,12 @@ ${content}
|
|
|
5924
5969
|
// src/rich-text-editor/plugins/MaxLengthPlugin/index.tsx
|
|
5925
5970
|
function MaxLengthPlugin({ maxLength }) {
|
|
5926
5971
|
const [editor] = (0, import_LexicalComposerContext7.useLexicalComposerContext)();
|
|
5927
|
-
(0,
|
|
5972
|
+
(0, import_react78.useEffect)(() => {
|
|
5928
5973
|
let lastRestoredEditorState = null;
|
|
5929
5974
|
return editor.registerUpdateListener(({ editorState, prevEditorState }) => {
|
|
5930
5975
|
editor.update(() => {
|
|
5931
|
-
const selection = (0,
|
|
5932
|
-
if (!(0,
|
|
5976
|
+
const selection = (0, import_lexical11.$getSelection)();
|
|
5977
|
+
if (!(0, import_lexical11.$isRangeSelection)(selection) || !selection.isCollapsed()) {
|
|
5933
5978
|
return;
|
|
5934
5979
|
}
|
|
5935
5980
|
const prevTextContent = toText(lexicalToCrystallizeRichText({ editor, editorState: prevEditorState }));
|
|
@@ -5954,8 +5999,8 @@ function MaxLengthPlugin({ maxLength }) {
|
|
|
5954
5999
|
}
|
|
5955
6000
|
|
|
5956
6001
|
// src/rich-text-editor/plugins/TabFocusPlugin/index.tsx
|
|
5957
|
-
var
|
|
5958
|
-
var
|
|
6002
|
+
var import_react79 = require("react");
|
|
6003
|
+
var import_lexical12 = require("lexical");
|
|
5959
6004
|
var import_LexicalComposerContext8 = require("@lexical/react/LexicalComposerContext");
|
|
5960
6005
|
var COMMAND_PRIORITY_LOW3 = 1;
|
|
5961
6006
|
var TAB_TO_FOCUS_INTERVAL = 100;
|
|
@@ -5974,18 +6019,18 @@ function registerKeyTimeStampTracker() {
|
|
|
5974
6019
|
}
|
|
5975
6020
|
function TabFocusPlugin() {
|
|
5976
6021
|
const [editor] = (0, import_LexicalComposerContext8.useLexicalComposerContext)();
|
|
5977
|
-
(0,
|
|
6022
|
+
(0, import_react79.useEffect)(() => {
|
|
5978
6023
|
if (!hasRegisteredKeyDownListener) {
|
|
5979
6024
|
registerKeyTimeStampTracker();
|
|
5980
6025
|
hasRegisteredKeyDownListener = true;
|
|
5981
6026
|
}
|
|
5982
6027
|
return editor.registerCommand(
|
|
5983
|
-
|
|
6028
|
+
import_lexical12.FOCUS_COMMAND,
|
|
5984
6029
|
(event) => {
|
|
5985
|
-
const selection = (0,
|
|
5986
|
-
if ((0,
|
|
6030
|
+
const selection = (0, import_lexical12.$getSelection)();
|
|
6031
|
+
if ((0, import_lexical12.$isRangeSelection)(selection)) {
|
|
5987
6032
|
if (lastTabKeyDownTimestamp + TAB_TO_FOCUS_INTERVAL > event.timeStamp) {
|
|
5988
|
-
(0,
|
|
6033
|
+
(0, import_lexical12.$setSelection)(selection.clone());
|
|
5989
6034
|
}
|
|
5990
6035
|
}
|
|
5991
6036
|
return false;
|
|
@@ -5997,22 +6042,22 @@ function TabFocusPlugin() {
|
|
|
5997
6042
|
}
|
|
5998
6043
|
|
|
5999
6044
|
// src/rich-text-editor/plugins/TableActionMenuPlugin/index.tsx
|
|
6000
|
-
var
|
|
6001
|
-
var
|
|
6045
|
+
var import_react80 = require("react");
|
|
6046
|
+
var import_lexical13 = require("lexical");
|
|
6002
6047
|
var import_react_dom5 = require("react-dom");
|
|
6003
6048
|
var import_LexicalComposerContext9 = require("@lexical/react/LexicalComposerContext");
|
|
6004
6049
|
var import_useLexicalEditable = __toESM(require("@lexical/react/useLexicalEditable"));
|
|
6005
6050
|
var import_table4 = require("@lexical/table");
|
|
6006
|
-
var
|
|
6051
|
+
var import_jsx_runtime92 = require("react/jsx-runtime");
|
|
6007
6052
|
function TableActionMenu({ tableCellNode: _tableCellNode, tableStats }) {
|
|
6008
6053
|
const [editor] = (0, import_LexicalComposerContext9.useLexicalComposerContext)();
|
|
6009
|
-
const [tableCellNode, updateTableCellNode] = (0,
|
|
6010
|
-
const [selectionCounts, updateSelectionCounts] = (0,
|
|
6054
|
+
const [tableCellNode, updateTableCellNode] = (0, import_react80.useState)(_tableCellNode);
|
|
6055
|
+
const [selectionCounts, updateSelectionCounts] = (0, import_react80.useState)({
|
|
6011
6056
|
columns: 1,
|
|
6012
6057
|
rows: 1
|
|
6013
6058
|
});
|
|
6014
6059
|
const tr = useTr();
|
|
6015
|
-
(0,
|
|
6060
|
+
(0, import_react80.useEffect)(() => {
|
|
6016
6061
|
return editor.registerMutationListener(import_table4.TableCellNode, (nodeMutations) => {
|
|
6017
6062
|
const nodeUpdated = nodeMutations.get(tableCellNode.getKey()) === "updated";
|
|
6018
6063
|
if (nodeUpdated) {
|
|
@@ -6022,10 +6067,10 @@ function TableActionMenu({ tableCellNode: _tableCellNode, tableStats }) {
|
|
|
6022
6067
|
}
|
|
6023
6068
|
});
|
|
6024
6069
|
}, [editor, tableCellNode]);
|
|
6025
|
-
(0,
|
|
6070
|
+
(0, import_react80.useEffect)(() => {
|
|
6026
6071
|
editor.getEditorState().read(() => {
|
|
6027
|
-
const selection = (0,
|
|
6028
|
-
if ((0,
|
|
6072
|
+
const selection = (0, import_lexical13.$getSelection)();
|
|
6073
|
+
if ((0, import_lexical13.DEPRECATED_$isGridSelection)(selection)) {
|
|
6029
6074
|
const selectionShape = selection.getShape();
|
|
6030
6075
|
updateSelectionCounts({
|
|
6031
6076
|
columns: selectionShape.toX - selectionShape.fromX + 1,
|
|
@@ -6034,7 +6079,7 @@ function TableActionMenu({ tableCellNode: _tableCellNode, tableStats }) {
|
|
|
6034
6079
|
}
|
|
6035
6080
|
});
|
|
6036
6081
|
}, [editor]);
|
|
6037
|
-
const clearTableSelection = (0,
|
|
6082
|
+
const clearTableSelection = (0, import_react80.useCallback)(() => {
|
|
6038
6083
|
editor.update(() => {
|
|
6039
6084
|
if (tableCellNode.isAttached()) {
|
|
6040
6085
|
const tableNode = (0, import_table4.$getTableNodeFromLexicalNodeOrThrow)(tableCellNode);
|
|
@@ -6049,17 +6094,17 @@ function TableActionMenu({ tableCellNode: _tableCellNode, tableStats }) {
|
|
|
6049
6094
|
tableNode.markDirty();
|
|
6050
6095
|
updateTableCellNode(tableCellNode.getLatest());
|
|
6051
6096
|
}
|
|
6052
|
-
const rootNode = (0,
|
|
6097
|
+
const rootNode = (0, import_lexical13.$getRoot)();
|
|
6053
6098
|
rootNode.selectStart();
|
|
6054
6099
|
});
|
|
6055
6100
|
}, [editor, tableCellNode]);
|
|
6056
|
-
const insertTableRowAtSelection = (0,
|
|
6101
|
+
const insertTableRowAtSelection = (0, import_react80.useCallback)(
|
|
6057
6102
|
(shouldInsertAfter) => {
|
|
6058
6103
|
editor.update(() => {
|
|
6059
|
-
const selection = (0,
|
|
6104
|
+
const selection = (0, import_lexical13.$getSelection)();
|
|
6060
6105
|
const tableNode = (0, import_table4.$getTableNodeFromLexicalNodeOrThrow)(tableCellNode);
|
|
6061
6106
|
let tableRowIndex;
|
|
6062
|
-
if ((0,
|
|
6107
|
+
if ((0, import_lexical13.DEPRECATED_$isGridSelection)(selection)) {
|
|
6063
6108
|
const selectionShape = selection.getShape();
|
|
6064
6109
|
tableRowIndex = shouldInsertAfter ? selectionShape.toY : selectionShape.fromY;
|
|
6065
6110
|
} else {
|
|
@@ -6072,13 +6117,13 @@ function TableActionMenu({ tableCellNode: _tableCellNode, tableStats }) {
|
|
|
6072
6117
|
},
|
|
6073
6118
|
[editor, tableCellNode, selectionCounts.rows, clearTableSelection]
|
|
6074
6119
|
);
|
|
6075
|
-
const insertTableColumnAtSelection = (0,
|
|
6120
|
+
const insertTableColumnAtSelection = (0, import_react80.useCallback)(
|
|
6076
6121
|
(shouldInsertAfter) => {
|
|
6077
6122
|
editor.update(() => {
|
|
6078
|
-
const selection = (0,
|
|
6123
|
+
const selection = (0, import_lexical13.$getSelection)();
|
|
6079
6124
|
const tableNode = (0, import_table4.$getTableNodeFromLexicalNodeOrThrow)(tableCellNode);
|
|
6080
6125
|
let tableColumnIndex;
|
|
6081
|
-
if ((0,
|
|
6126
|
+
if ((0, import_lexical13.DEPRECATED_$isGridSelection)(selection)) {
|
|
6082
6127
|
const selectionShape = selection.getShape();
|
|
6083
6128
|
tableColumnIndex = shouldInsertAfter ? selectionShape.toX : selectionShape.fromX;
|
|
6084
6129
|
} else {
|
|
@@ -6091,7 +6136,7 @@ function TableActionMenu({ tableCellNode: _tableCellNode, tableStats }) {
|
|
|
6091
6136
|
},
|
|
6092
6137
|
[editor, tableCellNode, selectionCounts.columns, clearTableSelection]
|
|
6093
6138
|
);
|
|
6094
|
-
const deleteTableRowAtSelection = (0,
|
|
6139
|
+
const deleteTableRowAtSelection = (0, import_react80.useCallback)(() => {
|
|
6095
6140
|
editor.update(() => {
|
|
6096
6141
|
const tableNode = (0, import_table4.$getTableNodeFromLexicalNodeOrThrow)(tableCellNode);
|
|
6097
6142
|
const tableRowIndex = (0, import_table4.$getTableRowIndexFromTableCellNode)(tableCellNode);
|
|
@@ -6099,14 +6144,14 @@ function TableActionMenu({ tableCellNode: _tableCellNode, tableStats }) {
|
|
|
6099
6144
|
clearTableSelection();
|
|
6100
6145
|
});
|
|
6101
6146
|
}, [editor, tableCellNode, clearTableSelection]);
|
|
6102
|
-
const deleteTableAtSelection = (0,
|
|
6147
|
+
const deleteTableAtSelection = (0, import_react80.useCallback)(() => {
|
|
6103
6148
|
editor.update(() => {
|
|
6104
6149
|
const tableNode = (0, import_table4.$getTableNodeFromLexicalNodeOrThrow)(tableCellNode);
|
|
6105
6150
|
tableNode.remove();
|
|
6106
6151
|
clearTableSelection();
|
|
6107
6152
|
});
|
|
6108
6153
|
}, [editor, tableCellNode, clearTableSelection]);
|
|
6109
|
-
const deleteTableColumnAtSelection = (0,
|
|
6154
|
+
const deleteTableColumnAtSelection = (0, import_react80.useCallback)(() => {
|
|
6110
6155
|
editor.update(() => {
|
|
6111
6156
|
const tableNode = (0, import_table4.$getTableNodeFromLexicalNodeOrThrow)(tableCellNode);
|
|
6112
6157
|
const tableColumnIndex = (0, import_table4.$getTableColumnIndexFromTableCellNode)(tableCellNode);
|
|
@@ -6114,7 +6159,7 @@ function TableActionMenu({ tableCellNode: _tableCellNode, tableStats }) {
|
|
|
6114
6159
|
clearTableSelection();
|
|
6115
6160
|
});
|
|
6116
6161
|
}, [editor, tableCellNode, clearTableSelection]);
|
|
6117
|
-
const toggleTableRowIsHeader = (0,
|
|
6162
|
+
const toggleTableRowIsHeader = (0, import_react80.useCallback)(() => {
|
|
6118
6163
|
editor.update(() => {
|
|
6119
6164
|
const tableNode = (0, import_table4.$getTableNodeFromLexicalNodeOrThrow)(tableCellNode);
|
|
6120
6165
|
const tableRowIndex = (0, import_table4.$getTableRowIndexFromTableCellNode)(tableCellNode);
|
|
@@ -6135,7 +6180,7 @@ function TableActionMenu({ tableCellNode: _tableCellNode, tableStats }) {
|
|
|
6135
6180
|
clearTableSelection();
|
|
6136
6181
|
});
|
|
6137
6182
|
}, [editor, tableCellNode, clearTableSelection]);
|
|
6138
|
-
const toggleTableColumnIsHeader = (0,
|
|
6183
|
+
const toggleTableColumnIsHeader = (0, import_react80.useCallback)(() => {
|
|
6139
6184
|
editor.update(() => {
|
|
6140
6185
|
const tableNode = (0, import_table4.$getTableNodeFromLexicalNodeOrThrow)(tableCellNode);
|
|
6141
6186
|
const tableColumnIndex = (0, import_table4.$getTableColumnIndexFromTableCellNode)(tableCellNode);
|
|
@@ -6158,36 +6203,36 @@ function TableActionMenu({ tableCellNode: _tableCellNode, tableStats }) {
|
|
|
6158
6203
|
clearTableSelection();
|
|
6159
6204
|
});
|
|
6160
6205
|
}, [editor, tableCellNode, clearTableSelection]);
|
|
6161
|
-
return /* @__PURE__ */ (0,
|
|
6162
|
-
/* @__PURE__ */ (0,
|
|
6163
|
-
/* @__PURE__ */ (0,
|
|
6164
|
-
/* @__PURE__ */ (0,
|
|
6165
|
-
/* @__PURE__ */ (0,
|
|
6166
|
-
/* @__PURE__ */ (0,
|
|
6206
|
+
return /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)(import_jsx_runtime92.Fragment, { children: [
|
|
6207
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(DropdownMenu.Item, { onSelect: () => insertTableRowAtSelection(false), children: tr("actionTableInsertRowsAbove", selectionCounts.rows) }),
|
|
6208
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(DropdownMenu.Item, { onSelect: () => insertTableRowAtSelection(true), children: tr("actionTableInsertRowsBelow", selectionCounts.rows) }),
|
|
6209
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(DropdownMenu.Item, { onSelect: () => insertTableColumnAtSelection(false), children: tr("actionTableInsertColumnsBefore", selectionCounts.columns) }),
|
|
6210
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(DropdownMenu.Item, { onSelect: () => insertTableColumnAtSelection(true), children: tr("actionTableInsertColumnsAfter", selectionCounts.columns) }),
|
|
6211
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(DropdownMenu.Item, { onSelect: () => toggleTableRowIsHeader(), children: tr(
|
|
6167
6212
|
(tableCellNode.__headerState & import_table4.TableCellHeaderStates.ROW) === import_table4.TableCellHeaderStates.ROW ? "actionTableRemoveRowHeader" : "actionTableAddRowHeader"
|
|
6168
6213
|
) }),
|
|
6169
|
-
/* @__PURE__ */ (0,
|
|
6214
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(DropdownMenu.Item, { onSelect: () => toggleTableColumnIsHeader(), children: tr(
|
|
6170
6215
|
(tableCellNode.__headerState & import_table4.TableCellHeaderStates.COLUMN) === import_table4.TableCellHeaderStates.COLUMN ? "actionTableRemoveColumnHeader" : "actionTableAddColumnHeader"
|
|
6171
6216
|
) }),
|
|
6172
|
-
/* @__PURE__ */ (0,
|
|
6173
|
-
tableStats.columns > 1 && /* @__PURE__ */ (0,
|
|
6174
|
-
tableStats.rows > 1 && /* @__PURE__ */ (0,
|
|
6175
|
-
/* @__PURE__ */ (0,
|
|
6217
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(DropdownMenu.Separator, {}),
|
|
6218
|
+
tableStats.columns > 1 && /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(DropdownMenu.Item, { onSelect: () => deleteTableColumnAtSelection(), children: tr("actionTableDeleteColumn") }),
|
|
6219
|
+
tableStats.rows > 1 && /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(DropdownMenu.Item, { onSelect: () => deleteTableRowAtSelection(), children: tr("actionTableDeleteRow") }),
|
|
6220
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(DropdownMenu.Item, { onSelect: () => deleteTableAtSelection(), children: tr("actionTableDeleteTable") })
|
|
6176
6221
|
] });
|
|
6177
6222
|
}
|
|
6178
6223
|
function TableCellActionMenuContainer({ anchorElem }) {
|
|
6179
6224
|
const [editor] = (0, import_LexicalComposerContext9.useLexicalComposerContext)();
|
|
6180
6225
|
const tr = useTr();
|
|
6181
|
-
const menuButtonRef = (0,
|
|
6182
|
-
const [isMenuOpen, setIsMenuOpen] = (0,
|
|
6183
|
-
const [tableCellNode, setTableMenuCellNode] = (0,
|
|
6184
|
-
const [tableStats, setTablestats] = (0,
|
|
6185
|
-
const moveMenu = (0,
|
|
6226
|
+
const menuButtonRef = (0, import_react80.useRef)(null);
|
|
6227
|
+
const [isMenuOpen, setIsMenuOpen] = (0, import_react80.useState)(false);
|
|
6228
|
+
const [tableCellNode, setTableMenuCellNode] = (0, import_react80.useState)(null);
|
|
6229
|
+
const [tableStats, setTablestats] = (0, import_react80.useState)({ rows: 1, columns: 1 });
|
|
6230
|
+
const moveMenu = (0, import_react80.useCallback)(() => {
|
|
6186
6231
|
if (isMenuOpen) {
|
|
6187
6232
|
return;
|
|
6188
6233
|
}
|
|
6189
6234
|
const menu = menuButtonRef.current;
|
|
6190
|
-
const selection = (0,
|
|
6235
|
+
const selection = (0, import_lexical13.$getSelection)();
|
|
6191
6236
|
const nativeSelection = window.getSelection();
|
|
6192
6237
|
const activeElement = document.activeElement;
|
|
6193
6238
|
if (selection == null || menu == null) {
|
|
@@ -6195,7 +6240,7 @@ function TableCellActionMenuContainer({ anchorElem }) {
|
|
|
6195
6240
|
return;
|
|
6196
6241
|
}
|
|
6197
6242
|
const rootElement = editor.getRootElement();
|
|
6198
|
-
if ((0,
|
|
6243
|
+
if ((0, import_lexical13.$isRangeSelection)(selection) && rootElement !== null && nativeSelection !== null && rootElement.contains(nativeSelection.anchorNode)) {
|
|
6199
6244
|
const tableCellNodeFromSelection = (0, import_table4.$getTableCellNodeFromLexicalNode)(selection.anchor.getNode());
|
|
6200
6245
|
if (tableCellNodeFromSelection == null) {
|
|
6201
6246
|
setTableMenuCellNode(null);
|
|
@@ -6225,14 +6270,14 @@ function TableCellActionMenuContainer({ anchorElem }) {
|
|
|
6225
6270
|
setTableMenuCellNode(null);
|
|
6226
6271
|
}
|
|
6227
6272
|
}, [editor, isMenuOpen]);
|
|
6228
|
-
(0,
|
|
6273
|
+
(0, import_react80.useEffect)(() => {
|
|
6229
6274
|
return editor.registerUpdateListener(() => {
|
|
6230
6275
|
editor.getEditorState().read(() => {
|
|
6231
6276
|
moveMenu();
|
|
6232
6277
|
});
|
|
6233
6278
|
});
|
|
6234
6279
|
});
|
|
6235
|
-
(0,
|
|
6280
|
+
(0, import_react80.useEffect)(() => {
|
|
6236
6281
|
const menuButtonDOM = menuButtonRef.current;
|
|
6237
6282
|
if (menuButtonDOM != null && tableCellNode != null) {
|
|
6238
6283
|
const tableCellNodeDOM = editor.getElementByKey(tableCellNode.getKey());
|
|
@@ -6250,12 +6295,12 @@ function TableCellActionMenuContainer({ anchorElem }) {
|
|
|
6250
6295
|
}
|
|
6251
6296
|
}
|
|
6252
6297
|
}, [menuButtonRef, tableCellNode, editor, anchorElem]);
|
|
6253
|
-
return /* @__PURE__ */ (0,
|
|
6298
|
+
return /* @__PURE__ */ (0, import_jsx_runtime92.jsx)("div", { className: "c-rte-table-cell-action-button-container", ref: menuButtonRef, children: tableCellNode != null && /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
6254
6299
|
DropdownMenu.Root,
|
|
6255
6300
|
{
|
|
6256
6301
|
onOpenChange: (isOpen) => setIsMenuOpen(isOpen),
|
|
6257
|
-
content: /* @__PURE__ */ (0,
|
|
6258
|
-
children: /* @__PURE__ */ (0,
|
|
6302
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(TableActionMenu, { tableCellNode, tableStats }),
|
|
6303
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(IconButton, { size: "xs", "aria-label": tr("actionTableOpenOptions"), children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(Icon.Arrow, {}) })
|
|
6259
6304
|
}
|
|
6260
6305
|
) });
|
|
6261
6306
|
}
|
|
@@ -6263,12 +6308,12 @@ function TableActionMenuPlugin({
|
|
|
6263
6308
|
anchorElem = document.body
|
|
6264
6309
|
}) {
|
|
6265
6310
|
const isEditable = (0, import_useLexicalEditable.default)();
|
|
6266
|
-
return (0, import_react_dom5.createPortal)(isEditable ? /* @__PURE__ */ (0,
|
|
6311
|
+
return (0, import_react_dom5.createPortal)(isEditable ? /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(TableCellActionMenuContainer, { anchorElem }) : null, anchorElem);
|
|
6267
6312
|
}
|
|
6268
6313
|
|
|
6269
6314
|
// src/rich-text-editor/plugins/ToolbarPlugin/index.tsx
|
|
6270
|
-
var
|
|
6271
|
-
var
|
|
6315
|
+
var import_react83 = require("react");
|
|
6316
|
+
var import_lexical15 = require("lexical");
|
|
6272
6317
|
var import_code9 = require("@lexical/code");
|
|
6273
6318
|
var import_link6 = require("@lexical/link");
|
|
6274
6319
|
var import_list5 = require("@lexical/list");
|
|
@@ -6280,10 +6325,10 @@ var import_selection3 = require("@lexical/selection");
|
|
|
6280
6325
|
var import_utils4 = require("@lexical/utils");
|
|
6281
6326
|
|
|
6282
6327
|
// src/rich-text-editor/plugins/ActionsPlugin/index.tsx
|
|
6283
|
-
var
|
|
6284
|
-
var
|
|
6328
|
+
var import_react81 = require("react");
|
|
6329
|
+
var import_lexical14 = require("lexical");
|
|
6285
6330
|
var import_LexicalComposerContext10 = require("@lexical/react/LexicalComposerContext");
|
|
6286
|
-
var
|
|
6331
|
+
var import_jsx_runtime93 = require("react/jsx-runtime");
|
|
6287
6332
|
async function copyJson(editor) {
|
|
6288
6333
|
const json = lexicalToCrystallizeRichText({ editor, editorState: editor.getEditorState() });
|
|
6289
6334
|
try {
|
|
@@ -6298,51 +6343,48 @@ function ActionsPlugin({
|
|
|
6298
6343
|
}) {
|
|
6299
6344
|
const [editor] = (0, import_LexicalComposerContext10.useLexicalComposerContext)();
|
|
6300
6345
|
const tr = useTr();
|
|
6301
|
-
const actionMenuAnchorRef = (0,
|
|
6302
|
-
return /* @__PURE__ */ (0,
|
|
6303
|
-
/* @__PURE__ */ (0,
|
|
6304
|
-
|
|
6305
|
-
|
|
6306
|
-
|
|
6307
|
-
|
|
6308
|
-
|
|
6309
|
-
|
|
6310
|
-
|
|
6311
|
-
|
|
6312
|
-
|
|
6313
|
-
|
|
6314
|
-
|
|
6315
|
-
|
|
6316
|
-
|
|
6317
|
-
{
|
|
6318
|
-
|
|
6319
|
-
|
|
6320
|
-
editor.dispatchCommand(import_lexical15.CLEAR_EDITOR_COMMAND, void 0);
|
|
6321
|
-
editor.focus();
|
|
6322
|
-
},
|
|
6323
|
-
children: tr("actionClear")
|
|
6324
|
-
}
|
|
6325
|
-
),
|
|
6326
|
-
!append ? null : append.map((actionItem) => /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
6327
|
-
ActionMenu.Item,
|
|
6328
|
-
{
|
|
6329
|
-
onSelect: actionItem.action,
|
|
6330
|
-
className: actionItem.type === "danger" ? "danger" : "",
|
|
6331
|
-
children: actionItem.title
|
|
6346
|
+
const actionMenuAnchorRef = (0, import_react81.useRef)(null);
|
|
6347
|
+
return /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("div", { ref: actionMenuAnchorRef, className: "c-rte-actions-plugin", children: /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(ActionMenu, { container: actionMenuAnchorRef.current, children: [
|
|
6348
|
+
!prepend ? null : prepend.map((actionItem) => /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
6349
|
+
ActionMenu.Item,
|
|
6350
|
+
{
|
|
6351
|
+
onSelect: actionItem.action,
|
|
6352
|
+
className: actionItem.type === "danger" ? "danger" : "",
|
|
6353
|
+
children: actionItem.title
|
|
6354
|
+
},
|
|
6355
|
+
actionItem.title
|
|
6356
|
+
)),
|
|
6357
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(ActionMenu.Item, { onSelect: () => copyJson(editor), children: tr("actionCopyJSON") }),
|
|
6358
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
6359
|
+
ActionMenu.Item,
|
|
6360
|
+
{
|
|
6361
|
+
className: "danger",
|
|
6362
|
+
onSelect: () => {
|
|
6363
|
+
editor.dispatchCommand(import_lexical14.CLEAR_EDITOR_COMMAND, void 0);
|
|
6364
|
+
editor.focus();
|
|
6332
6365
|
},
|
|
6333
|
-
|
|
6334
|
-
|
|
6335
|
-
|
|
6336
|
-
|
|
6366
|
+
children: tr("actionClear")
|
|
6367
|
+
}
|
|
6368
|
+
),
|
|
6369
|
+
!append ? null : append.map((actionItem) => /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
6370
|
+
ActionMenu.Item,
|
|
6371
|
+
{
|
|
6372
|
+
onSelect: actionItem.action,
|
|
6373
|
+
className: actionItem.type === "danger" ? "danger" : "",
|
|
6374
|
+
children: actionItem.title
|
|
6375
|
+
},
|
|
6376
|
+
actionItem.title
|
|
6377
|
+
))
|
|
6378
|
+
] }) });
|
|
6337
6379
|
}
|
|
6338
6380
|
|
|
6339
6381
|
// src/rich-text-editor/plugins/ToolbarPlugin/insert-table.tsx
|
|
6340
|
-
var
|
|
6382
|
+
var import_react82 = require("react");
|
|
6341
6383
|
var import_table5 = require("@lexical/table");
|
|
6342
|
-
var
|
|
6384
|
+
var import_jsx_runtime94 = require("react/jsx-runtime");
|
|
6343
6385
|
function InsertTableDialog({ activeEditor }) {
|
|
6344
|
-
const [rows, setRows] = (0,
|
|
6345
|
-
const [columns, setColumns] = (0,
|
|
6386
|
+
const [rows, setRows] = (0, import_react82.useState)("5");
|
|
6387
|
+
const [columns, setColumns] = (0, import_react82.useState)("5");
|
|
6346
6388
|
const tr = useTr();
|
|
6347
6389
|
const onClick = () => {
|
|
6348
6390
|
if (parseInt(rows) < 1 || parseInt(columns) < 1) {
|
|
@@ -6357,9 +6399,9 @@ function InsertTableDialog({ activeEditor }) {
|
|
|
6357
6399
|
}
|
|
6358
6400
|
});
|
|
6359
6401
|
};
|
|
6360
|
-
return /* @__PURE__ */ (0,
|
|
6361
|
-
/* @__PURE__ */ (0,
|
|
6362
|
-
/* @__PURE__ */ (0,
|
|
6402
|
+
return /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("div", { className: "c-rte-insert-table", children: [
|
|
6403
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("div", { className: "c-rte-insert-table__dimensions", children: [
|
|
6404
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
6363
6405
|
InputWithLabel,
|
|
6364
6406
|
{
|
|
6365
6407
|
label: tr("insertTableRows"),
|
|
@@ -6370,8 +6412,8 @@ function InsertTableDialog({ activeEditor }) {
|
|
|
6370
6412
|
onChange: (e) => setRows(e.target.value)
|
|
6371
6413
|
}
|
|
6372
6414
|
),
|
|
6373
|
-
/* @__PURE__ */ (0,
|
|
6374
|
-
/* @__PURE__ */ (0,
|
|
6415
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)("span", { className: "c-rte-insert-table__dimensions__separator" }),
|
|
6416
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
6375
6417
|
InputWithLabel,
|
|
6376
6418
|
{
|
|
6377
6419
|
type: "text",
|
|
@@ -6383,12 +6425,12 @@ function InsertTableDialog({ activeEditor }) {
|
|
|
6383
6425
|
}
|
|
6384
6426
|
)
|
|
6385
6427
|
] }),
|
|
6386
|
-
/* @__PURE__ */ (0,
|
|
6428
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)("div", { className: "c-rte-insert-table__actions", children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(Button, { as: Dialog.Close, size: "sm", intent: "action", "aria-label": tr("insertTableCommit"), onClick, children: tr("insertTableCommit") }) })
|
|
6387
6429
|
] });
|
|
6388
6430
|
}
|
|
6389
6431
|
|
|
6390
6432
|
// src/rich-text-editor/plugins/ToolbarPlugin/index.tsx
|
|
6391
|
-
var
|
|
6433
|
+
var import_jsx_runtime95 = require("react/jsx-runtime");
|
|
6392
6434
|
var headingTypeToBlockName = {
|
|
6393
6435
|
h1: "Heading 1",
|
|
6394
6436
|
h2: "Heading 2",
|
|
@@ -6429,17 +6471,17 @@ function BlockFormatDropDown({
|
|
|
6429
6471
|
const formatParagraph = () => {
|
|
6430
6472
|
if (blockType !== "paragraph") {
|
|
6431
6473
|
editor.update(() => {
|
|
6432
|
-
const selection = (0,
|
|
6433
|
-
if ((0,
|
|
6434
|
-
(0, import_selection3.$setBlocksType)(selection, () => (0,
|
|
6474
|
+
const selection = (0, import_lexical15.$getSelection)();
|
|
6475
|
+
if ((0, import_lexical15.$isRangeSelection)(selection) || (0, import_lexical15.DEPRECATED_$isGridSelection)(selection))
|
|
6476
|
+
(0, import_selection3.$setBlocksType)(selection, () => (0, import_lexical15.$createParagraphNode)());
|
|
6435
6477
|
});
|
|
6436
6478
|
}
|
|
6437
6479
|
};
|
|
6438
6480
|
const formatHeading = (headingSize) => {
|
|
6439
6481
|
if (blockType !== headingSize) {
|
|
6440
6482
|
editor.update(() => {
|
|
6441
|
-
const selection = (0,
|
|
6442
|
-
if ((0,
|
|
6483
|
+
const selection = (0, import_lexical15.$getSelection)();
|
|
6484
|
+
if ((0, import_lexical15.$isRangeSelection)(selection) || (0, import_lexical15.DEPRECATED_$isGridSelection)(selection)) {
|
|
6443
6485
|
(0, import_selection3.$setBlocksType)(selection, () => (0, import_rich_text4.$createHeadingNode)(headingSize));
|
|
6444
6486
|
}
|
|
6445
6487
|
});
|
|
@@ -6462,11 +6504,11 @@ function BlockFormatDropDown({
|
|
|
6462
6504
|
const formatQuote = () => {
|
|
6463
6505
|
if (blockType !== "quote") {
|
|
6464
6506
|
editor.update(() => {
|
|
6465
|
-
const selection = (0,
|
|
6466
|
-
if ((0,
|
|
6507
|
+
const selection = (0, import_lexical15.$getSelection)();
|
|
6508
|
+
if ((0, import_lexical15.$isRangeSelection)(selection) || (0, import_lexical15.DEPRECATED_$isGridSelection)(selection)) {
|
|
6467
6509
|
(0, import_selection3.$setBlocksType)(selection, () => (0, import_rich_text4.$createQuoteNode)());
|
|
6468
6510
|
} else {
|
|
6469
|
-
(0, import_selection3.$setBlocksType)((0,
|
|
6511
|
+
(0, import_selection3.$setBlocksType)((0, import_lexical15.$getRoot)().select(), () => (0, import_rich_text4.$createQuoteNode)());
|
|
6470
6512
|
}
|
|
6471
6513
|
});
|
|
6472
6514
|
}
|
|
@@ -6474,95 +6516,94 @@ function BlockFormatDropDown({
|
|
|
6474
6516
|
const formatCode = () => {
|
|
6475
6517
|
if (blockType !== "code") {
|
|
6476
6518
|
editor.update(() => {
|
|
6477
|
-
let selection = (0,
|
|
6478
|
-
if ((0,
|
|
6519
|
+
let selection = (0, import_lexical15.$getSelection)();
|
|
6520
|
+
if ((0, import_lexical15.$isRangeSelection)(selection) || (0, import_lexical15.DEPRECATED_$isGridSelection)(selection)) {
|
|
6479
6521
|
if (selection.isCollapsed()) {
|
|
6480
6522
|
(0, import_selection3.$setBlocksType)(selection, () => (0, import_code9.$createCodeNode)());
|
|
6481
6523
|
} else {
|
|
6482
6524
|
const textContent = selection.getTextContent();
|
|
6483
6525
|
const codeNode = (0, import_code9.$createCodeNode)();
|
|
6484
6526
|
selection.insertNodes([codeNode]);
|
|
6485
|
-
selection = (0,
|
|
6486
|
-
if ((0,
|
|
6527
|
+
selection = (0, import_lexical15.$getSelection)();
|
|
6528
|
+
if ((0, import_lexical15.$isRangeSelection)(selection))
|
|
6487
6529
|
selection.insertRawText(textContent);
|
|
6488
6530
|
}
|
|
6489
6531
|
} else {
|
|
6490
|
-
(0, import_selection3.$setBlocksType)((0,
|
|
6532
|
+
(0, import_selection3.$setBlocksType)((0, import_lexical15.$getRoot)().select(), () => (0, import_code9.$createCodeNode)());
|
|
6491
6533
|
}
|
|
6492
6534
|
});
|
|
6493
6535
|
}
|
|
6494
6536
|
};
|
|
6495
|
-
return /* @__PURE__ */ (0,
|
|
6537
|
+
return /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
|
|
6496
6538
|
DropdownMenu.Root,
|
|
6497
6539
|
{
|
|
6498
6540
|
disabled,
|
|
6499
6541
|
style: { zIndex: 1 },
|
|
6500
|
-
content: /* @__PURE__ */ (0,
|
|
6501
|
-
/* @__PURE__ */ (0,
|
|
6502
|
-
/* @__PURE__ */ (0,
|
|
6542
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime95.jsxs)(import_jsx_runtime95.Fragment, { children: [
|
|
6543
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsxs)(DropdownMenu.Item, { onClick: formatParagraph, children: [
|
|
6544
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
|
|
6503
6545
|
"i",
|
|
6504
6546
|
{
|
|
6505
|
-
className: `
|
|
6547
|
+
className: `c-rte-icon-paragraph c-rte-toolbar__block-format__icon ${blockType === "paragraph" ? "selected" : ""}`
|
|
6506
6548
|
}
|
|
6507
6549
|
),
|
|
6508
|
-
/* @__PURE__ */ (0,
|
|
6509
|
-
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)("span", { className: `${blockType === "paragraph" ? "font-bold" : "font-normal"} text-sm px-3 min-w-[150px]`, children: "Normal" })
|
|
6550
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)("span", { className: `c-rte-toolbar__block-format__text ${blockType === "paragraph" ? "selected" : ""}`, children: "Normal" })
|
|
6510
6551
|
] }),
|
|
6511
|
-
headings.map((headingSize) => /* @__PURE__ */ (0,
|
|
6512
|
-
/* @__PURE__ */ (0,
|
|
6552
|
+
headings.map((headingSize) => /* @__PURE__ */ (0, import_jsx_runtime95.jsxs)(DropdownMenu.Item, { onClick: () => formatHeading(headingSize), children: [
|
|
6553
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
|
|
6513
6554
|
"i",
|
|
6514
6555
|
{
|
|
6515
|
-
className: `icon
|
|
6556
|
+
className: `c-rte-icon-${headingSize} c-rte-toolbar__block-format__icon ${blockType === headingSize ? "selected" : ""}`
|
|
6516
6557
|
}
|
|
6517
6558
|
),
|
|
6518
|
-
/* @__PURE__ */ (0,
|
|
6559
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)("span", { className: `c-rte-toolbar__block-format__text ${blockType === headingSize ? "selected" : ""}`, children: headingTypeToBlockName[headingSize] })
|
|
6519
6560
|
] }, headingSize)),
|
|
6520
|
-
/* @__PURE__ */ (0,
|
|
6521
|
-
/* @__PURE__ */ (0,
|
|
6561
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsxs)(DropdownMenu.Item, { onClick: formatBulletList, children: [
|
|
6562
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
|
|
6522
6563
|
"i",
|
|
6523
6564
|
{
|
|
6524
|
-
className: `icon
|
|
6565
|
+
className: `c-rte-icon-bullet-list c-rte-toolbar__block-format__icon ${blockType === "bullet" ? "selected" : ""}`
|
|
6525
6566
|
}
|
|
6526
6567
|
),
|
|
6527
|
-
/* @__PURE__ */ (0,
|
|
6568
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)("span", { className: `c-rte-toolbar__block-format__text ${blockType === "bullet" ? "selected" : ""}`, children: "Bullet List" })
|
|
6528
6569
|
] }),
|
|
6529
|
-
/* @__PURE__ */ (0,
|
|
6530
|
-
/* @__PURE__ */ (0,
|
|
6570
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsxs)(DropdownMenu.Item, { onClick: formatNumberedList, children: [
|
|
6571
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
|
|
6531
6572
|
"i",
|
|
6532
6573
|
{
|
|
6533
|
-
className: `icon
|
|
6574
|
+
className: `c-rte-icon-numbered-list c-rte-toolbar__block-format__icon ${blockType === "number" ? "selected" : ""}`
|
|
6534
6575
|
}
|
|
6535
6576
|
),
|
|
6536
|
-
/* @__PURE__ */ (0,
|
|
6577
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)("span", { className: `c-rte-toolbar__block-format__text ${blockType === "number" ? "selected" : ""}`, children: "Numbered List" })
|
|
6537
6578
|
] }),
|
|
6538
|
-
/* @__PURE__ */ (0,
|
|
6539
|
-
/* @__PURE__ */ (0,
|
|
6579
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsxs)(DropdownMenu.Item, { onClick: formatQuote, "data-testid": "toggle-block-format-quote", children: [
|
|
6580
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
|
|
6540
6581
|
"i",
|
|
6541
6582
|
{
|
|
6542
|
-
className: `
|
|
6583
|
+
className: `c-rte-icon-quote c-rte-toolbar__block-format__icon ${blockType === "quote" ? "selected" : ""}`
|
|
6543
6584
|
}
|
|
6544
6585
|
),
|
|
6545
|
-
/* @__PURE__ */ (0,
|
|
6586
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)("span", { className: `c-rte-toolbar__block-format__text ${blockType === "quote" ? "selected" : ""}`, children: "Quote" })
|
|
6546
6587
|
] }),
|
|
6547
|
-
/* @__PURE__ */ (0,
|
|
6548
|
-
/* @__PURE__ */ (0,
|
|
6588
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsxs)(DropdownMenu.Item, { onClick: formatCode, "data-testid": "toggle-block-format-code", children: [
|
|
6589
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
|
|
6549
6590
|
"i",
|
|
6550
6591
|
{
|
|
6551
|
-
className: `icon code border w-6 h-6 rounded-md bg-no-repeat bg-center bg-[length:18px_18px] ${blockType === "code" ? "
|
|
6592
|
+
className: `icon c-rte-icon-code border w-6 h-6 rounded-md bg-no-repeat bg-center bg-[length:18px_18px] ${blockType === "code" ? "selected" : ""}`
|
|
6552
6593
|
}
|
|
6553
6594
|
),
|
|
6554
|
-
/* @__PURE__ */ (0,
|
|
6595
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)("span", { className: `c-rte-toolbar__block-format__text ${blockType === "code" ? "selected" : ""}`, children: "Code block" })
|
|
6555
6596
|
] })
|
|
6556
6597
|
] }),
|
|
6557
|
-
children: /* @__PURE__ */ (0,
|
|
6598
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime95.jsxs)(
|
|
6558
6599
|
Button,
|
|
6559
6600
|
{
|
|
6560
6601
|
style: { backgroundColor: "transparent", padding: "0 8px" },
|
|
6561
6602
|
"aria-label": "Formatting options for text style",
|
|
6562
6603
|
"data-testid": "toggle-block-format",
|
|
6563
6604
|
children: [
|
|
6564
|
-
/* @__PURE__ */ (0,
|
|
6565
|
-
/* @__PURE__ */ (0,
|
|
6605
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)("i", { className: `c-rte-toolbar__toggle-icon c-rte-icon-${blockType}` }),
|
|
6606
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)(Icon.Arrow, {})
|
|
6566
6607
|
]
|
|
6567
6608
|
}
|
|
6568
6609
|
)
|
|
@@ -6570,36 +6611,36 @@ function BlockFormatDropDown({
|
|
|
6570
6611
|
);
|
|
6571
6612
|
}
|
|
6572
6613
|
function Divider() {
|
|
6573
|
-
return /* @__PURE__ */ (0,
|
|
6614
|
+
return /* @__PURE__ */ (0, import_jsx_runtime95.jsx)("div", { className: "c-rte-toolbar__divider" });
|
|
6574
6615
|
}
|
|
6575
6616
|
function ToolbarPlugin({
|
|
6576
6617
|
actionsMenuPrepend,
|
|
6577
6618
|
actionsMenuAppend
|
|
6578
6619
|
}) {
|
|
6579
6620
|
const [editor] = (0, import_LexicalComposerContext11.useLexicalComposerContext)();
|
|
6580
|
-
const [activeEditor, setActiveEditor] = (0,
|
|
6581
|
-
const [blockType, setBlockType] = (0,
|
|
6582
|
-
const [selectedElementKey, setSelectedElementKey] = (0,
|
|
6583
|
-
const [isLink, setIsLink] = (0,
|
|
6584
|
-
const [isBold, setIsBold] = (0,
|
|
6585
|
-
const [isItalic, setIsItalic] = (0,
|
|
6586
|
-
const [isUnderline, setIsUnderline] = (0,
|
|
6587
|
-
const [isStrikethrough, setIsStrikethrough] = (0,
|
|
6588
|
-
const [isSubscript, setIsSubscript] = (0,
|
|
6589
|
-
const [isSuperscript, setIsSuperscript] = (0,
|
|
6590
|
-
const [isCode, setIsCode] = (0,
|
|
6591
|
-
const [canUndo, setCanUndo] = (0,
|
|
6592
|
-
const [canRedo, setCanRedo] = (0,
|
|
6621
|
+
const [activeEditor, setActiveEditor] = (0, import_react83.useState)(editor);
|
|
6622
|
+
const [blockType, setBlockType] = (0, import_react83.useState)("paragraph");
|
|
6623
|
+
const [selectedElementKey, setSelectedElementKey] = (0, import_react83.useState)(null);
|
|
6624
|
+
const [isLink, setIsLink] = (0, import_react83.useState)(false);
|
|
6625
|
+
const [isBold, setIsBold] = (0, import_react83.useState)(false);
|
|
6626
|
+
const [isItalic, setIsItalic] = (0, import_react83.useState)(false);
|
|
6627
|
+
const [isUnderline, setIsUnderline] = (0, import_react83.useState)(false);
|
|
6628
|
+
const [isStrikethrough, setIsStrikethrough] = (0, import_react83.useState)(false);
|
|
6629
|
+
const [isSubscript, setIsSubscript] = (0, import_react83.useState)(false);
|
|
6630
|
+
const [isSuperscript, setIsSuperscript] = (0, import_react83.useState)(false);
|
|
6631
|
+
const [isCode, setIsCode] = (0, import_react83.useState)(false);
|
|
6632
|
+
const [canUndo, setCanUndo] = (0, import_react83.useState)(false);
|
|
6633
|
+
const [canRedo, setCanRedo] = (0, import_react83.useState)(false);
|
|
6593
6634
|
const tr = useTr();
|
|
6594
|
-
const [codeLanguage, setCodeLanguage] = (0,
|
|
6595
|
-
const [isEditable, setIsEditable] = (0,
|
|
6596
|
-
const updateToolbar = (0,
|
|
6597
|
-
const selection = (0,
|
|
6598
|
-
if ((0,
|
|
6635
|
+
const [codeLanguage, setCodeLanguage] = (0, import_react83.useState)("");
|
|
6636
|
+
const [isEditable, setIsEditable] = (0, import_react83.useState)(() => editor.isEditable());
|
|
6637
|
+
const updateToolbar = (0, import_react83.useCallback)(() => {
|
|
6638
|
+
const selection = (0, import_lexical15.$getSelection)();
|
|
6639
|
+
if ((0, import_lexical15.$isRangeSelection)(selection)) {
|
|
6599
6640
|
const anchorNode = selection.anchor.getNode();
|
|
6600
6641
|
let element = anchorNode.getKey() === "root" ? anchorNode : (0, import_utils4.$findMatchingParent)(anchorNode, (e) => {
|
|
6601
6642
|
const parent3 = e.getParent();
|
|
6602
|
-
return parent3 !== null && (0,
|
|
6643
|
+
return parent3 !== null && (0, import_lexical15.$isRootOrShadowRoot)(parent3);
|
|
6603
6644
|
});
|
|
6604
6645
|
if (element === null) {
|
|
6605
6646
|
element = anchorNode.getTopLevelElementOrThrow();
|
|
@@ -6640,18 +6681,18 @@ function ToolbarPlugin({
|
|
|
6640
6681
|
}
|
|
6641
6682
|
}
|
|
6642
6683
|
}, [activeEditor]);
|
|
6643
|
-
(0,
|
|
6684
|
+
(0, import_react83.useEffect)(() => {
|
|
6644
6685
|
return editor.registerCommand(
|
|
6645
|
-
|
|
6686
|
+
import_lexical15.SELECTION_CHANGE_COMMAND,
|
|
6646
6687
|
(_payload, newEditor) => {
|
|
6647
6688
|
updateToolbar();
|
|
6648
6689
|
setActiveEditor(newEditor);
|
|
6649
6690
|
return false;
|
|
6650
6691
|
},
|
|
6651
|
-
|
|
6692
|
+
import_lexical15.COMMAND_PRIORITY_CRITICAL
|
|
6652
6693
|
);
|
|
6653
6694
|
}, [editor, updateToolbar]);
|
|
6654
|
-
(0,
|
|
6695
|
+
(0, import_react83.useEffect)(() => {
|
|
6655
6696
|
return (0, import_utils4.mergeRegister)(
|
|
6656
6697
|
editor.registerEditableListener((editable) => {
|
|
6657
6698
|
setIsEditable(editable);
|
|
@@ -6662,30 +6703,30 @@ function ToolbarPlugin({
|
|
|
6662
6703
|
});
|
|
6663
6704
|
}),
|
|
6664
6705
|
activeEditor.registerCommand(
|
|
6665
|
-
|
|
6706
|
+
import_lexical15.CAN_UNDO_COMMAND,
|
|
6666
6707
|
(payload) => {
|
|
6667
6708
|
setCanUndo(payload);
|
|
6668
6709
|
return false;
|
|
6669
6710
|
},
|
|
6670
|
-
|
|
6711
|
+
import_lexical15.COMMAND_PRIORITY_CRITICAL
|
|
6671
6712
|
),
|
|
6672
6713
|
activeEditor.registerCommand(
|
|
6673
|
-
|
|
6714
|
+
import_lexical15.CAN_REDO_COMMAND,
|
|
6674
6715
|
(payload) => {
|
|
6675
6716
|
setCanRedo(payload);
|
|
6676
6717
|
return false;
|
|
6677
6718
|
},
|
|
6678
|
-
|
|
6719
|
+
import_lexical15.COMMAND_PRIORITY_CRITICAL
|
|
6679
6720
|
)
|
|
6680
6721
|
);
|
|
6681
6722
|
}, [activeEditor, editor, updateToolbar]);
|
|
6682
|
-
const clearFormatting = (0,
|
|
6723
|
+
const clearFormatting = (0, import_react83.useCallback)(() => {
|
|
6683
6724
|
activeEditor.update(() => {
|
|
6684
|
-
const selection = (0,
|
|
6685
|
-
if ((0,
|
|
6725
|
+
const selection = (0, import_lexical15.$getSelection)();
|
|
6726
|
+
if ((0, import_lexical15.$isRangeSelection)(selection)) {
|
|
6686
6727
|
(0, import_selection3.$selectAll)(selection);
|
|
6687
6728
|
selection.getNodes().forEach((node) => {
|
|
6688
|
-
if ((0,
|
|
6729
|
+
if ((0, import_lexical15.$isTextNode)(node)) {
|
|
6689
6730
|
node.setFormat(0);
|
|
6690
6731
|
node.setStyle("");
|
|
6691
6732
|
(0, import_utils4.$getNearestBlockElementAncestorOrThrow)(node).setFormat("");
|
|
@@ -6697,18 +6738,18 @@ function ToolbarPlugin({
|
|
|
6697
6738
|
}
|
|
6698
6739
|
});
|
|
6699
6740
|
}, [activeEditor]);
|
|
6700
|
-
const insertLink = (0,
|
|
6741
|
+
const insertLink = (0, import_react83.useCallback)(() => {
|
|
6701
6742
|
if (!isLink) {
|
|
6702
6743
|
editor.dispatchCommand(import_link6.TOGGLE_LINK_COMMAND, sanitizeUrl("https://"));
|
|
6703
6744
|
} else {
|
|
6704
6745
|
editor.dispatchCommand(import_link6.TOGGLE_LINK_COMMAND, null);
|
|
6705
6746
|
}
|
|
6706
6747
|
}, [editor, isLink]);
|
|
6707
|
-
const onCodeLanguageSelect = (0,
|
|
6748
|
+
const onCodeLanguageSelect = (0, import_react83.useCallback)(
|
|
6708
6749
|
(value) => {
|
|
6709
6750
|
activeEditor.update(() => {
|
|
6710
6751
|
if (selectedElementKey !== null) {
|
|
6711
|
-
const node = (0,
|
|
6752
|
+
const node = (0, import_lexical15.$getNodeByKey)(selectedElementKey);
|
|
6712
6753
|
if ((0, import_code9.$isCodeNode)(node)) {
|
|
6713
6754
|
node.setLanguage(value);
|
|
6714
6755
|
}
|
|
@@ -6717,65 +6758,60 @@ function ToolbarPlugin({
|
|
|
6717
6758
|
},
|
|
6718
6759
|
[activeEditor, selectedElementKey]
|
|
6719
6760
|
);
|
|
6720
|
-
return /* @__PURE__ */ (0,
|
|
6721
|
-
/* @__PURE__ */ (0,
|
|
6722
|
-
/* @__PURE__ */ (0,
|
|
6761
|
+
return /* @__PURE__ */ (0, import_jsx_runtime95.jsxs)("div", { className: "c-rte-toolbar", children: [
|
|
6762
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsxs)("div", { className: "c-rte-toolbar__inner", children: [
|
|
6763
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
|
|
6723
6764
|
IconButton,
|
|
6724
6765
|
{
|
|
6725
6766
|
disabled: !canUndo || !isEditable,
|
|
6726
6767
|
onClick: () => {
|
|
6727
|
-
activeEditor.dispatchCommand(
|
|
6768
|
+
activeEditor.dispatchCommand(import_lexical15.UNDO_COMMAND, void 0);
|
|
6728
6769
|
},
|
|
6729
6770
|
type: "button",
|
|
6730
6771
|
title: tr(IS_APPLE ? "actionUndoTitleApple" : "actionUndoTitle"),
|
|
6731
6772
|
"aria-label": tr("actionUndoLabel"),
|
|
6732
|
-
children: /* @__PURE__ */ (0,
|
|
6773
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
|
|
6733
6774
|
"i",
|
|
6734
6775
|
{
|
|
6735
|
-
className: `
|
|
6776
|
+
className: `c-rte-icon-undo c-rte-toolbar__icon ${!canUndo ? "disabled" : ""}
|
|
6736
6777
|
`
|
|
6737
6778
|
}
|
|
6738
6779
|
)
|
|
6739
6780
|
}
|
|
6740
6781
|
),
|
|
6741
|
-
/* @__PURE__ */ (0,
|
|
6782
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
|
|
6742
6783
|
IconButton,
|
|
6743
6784
|
{
|
|
6744
6785
|
disabled: !canRedo || !isEditable,
|
|
6745
6786
|
onClick: () => {
|
|
6746
|
-
activeEditor.dispatchCommand(
|
|
6787
|
+
activeEditor.dispatchCommand(import_lexical15.REDO_COMMAND, void 0);
|
|
6747
6788
|
},
|
|
6748
6789
|
type: "button",
|
|
6749
6790
|
title: tr(IS_APPLE ? "actionRedoTitleApple" : "actionRedoTitle"),
|
|
6750
6791
|
"aria-label": tr("actionRedoLabel"),
|
|
6751
|
-
children: /* @__PURE__ */ (0,
|
|
6752
|
-
"i",
|
|
6753
|
-
{
|
|
6754
|
-
className: `format icon redo border w-4 h-6 bg-no-repeat bg-center bg-[length:17px_17px] ${canRedo ? "opacity-100" : "opacity-30"}`
|
|
6755
|
-
}
|
|
6756
|
-
)
|
|
6792
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime95.jsx)("i", { className: `c-rte-icon-redo c-rte-toolbar__icon ${!canRedo ? "disabled" : ""}` })
|
|
6757
6793
|
}
|
|
6758
6794
|
),
|
|
6759
|
-
/* @__PURE__ */ (0,
|
|
6760
|
-
blockType in blockTypeToBlockName && activeEditor === editor && /* @__PURE__ */ (0,
|
|
6761
|
-
/* @__PURE__ */ (0,
|
|
6762
|
-
/* @__PURE__ */ (0,
|
|
6795
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)(Divider, {}),
|
|
6796
|
+
blockType in blockTypeToBlockName && activeEditor === editor && /* @__PURE__ */ (0, import_jsx_runtime95.jsxs)(import_jsx_runtime95.Fragment, { children: [
|
|
6797
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)(BlockFormatDropDown, { disabled: !isEditable, blockType, editor }),
|
|
6798
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)(Divider, {})
|
|
6763
6799
|
] }),
|
|
6764
|
-
blockType === "code" ? /* @__PURE__ */ (0,
|
|
6800
|
+
blockType === "code" ? /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(import_jsx_runtime95.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
|
|
6765
6801
|
DropdownMenu.Root,
|
|
6766
6802
|
{
|
|
6767
6803
|
disabled: !isEditable,
|
|
6768
6804
|
style: { zIndex: 1 },
|
|
6769
|
-
content: /* @__PURE__ */ (0,
|
|
6770
|
-
return /* @__PURE__ */ (0,
|
|
6805
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(import_jsx_runtime95.Fragment, { children: CODE_LANGUAGE_OPTIONS.map(([value, name]) => {
|
|
6806
|
+
return /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
|
|
6771
6807
|
DropdownMenu.Item,
|
|
6772
6808
|
{
|
|
6773
6809
|
className: `item ${dropDownActiveClass(value === codeLanguage)}`,
|
|
6774
6810
|
onClick: () => onCodeLanguageSelect(value),
|
|
6775
|
-
children: /* @__PURE__ */ (0,
|
|
6811
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
|
|
6776
6812
|
"span",
|
|
6777
6813
|
{
|
|
6778
|
-
className: `
|
|
6814
|
+
className: `c-rte-toolbar__code-lang__sel-item ${dropDownActiveClass(value === codeLanguage) ? "selected" : ""}`,
|
|
6779
6815
|
children: name
|
|
6780
6816
|
}
|
|
6781
6817
|
)
|
|
@@ -6783,149 +6819,144 @@ function ToolbarPlugin({
|
|
|
6783
6819
|
value
|
|
6784
6820
|
);
|
|
6785
6821
|
}) }),
|
|
6786
|
-
children: /* @__PURE__ */ (0,
|
|
6822
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(Button, { "aria-label": tr("codeSelectLanguage"), append: /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(Icon.Arrow, {}), children: /* @__PURE__ */ (0, import_jsx_runtime95.jsx)("span", { className: "c-rte-toolbar__code-lang__button-text", children: (0, import_code9.getLanguageFriendlyName)(codeLanguage) }) })
|
|
6787
6823
|
}
|
|
6788
|
-
) }) : /* @__PURE__ */ (0,
|
|
6789
|
-
/* @__PURE__ */ (0,
|
|
6824
|
+
) }) : /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(Dialog, { children: /* @__PURE__ */ (0, import_jsx_runtime95.jsxs)("div", { className: "c-rte-toolbar__actions-rest", children: [
|
|
6825
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
|
|
6790
6826
|
IconButton,
|
|
6791
6827
|
{
|
|
6792
6828
|
disabled: !isEditable,
|
|
6793
|
-
className:
|
|
6829
|
+
className: `c-rte-toolbar__icon-btn ${isBold ? "selected" : ""}`,
|
|
6794
6830
|
type: "button",
|
|
6795
6831
|
title: tr(IS_APPLE ? "actionFormatAsStrongTitleApple" : "actionFormatAsStrongTitle"),
|
|
6796
6832
|
"aria-label": tr("actionFormatAsStrongLabel"),
|
|
6797
6833
|
"data-testid": "toggle-format-bold",
|
|
6798
6834
|
onClick: () => {
|
|
6799
|
-
activeEditor.dispatchCommand(
|
|
6835
|
+
activeEditor.dispatchCommand(import_lexical15.FORMAT_TEXT_COMMAND, "bold");
|
|
6800
6836
|
},
|
|
6801
|
-
children: /* @__PURE__ */ (0,
|
|
6837
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime95.jsx)("i", { className: `c-rte-toolbar__icon-btn__icon c-rte-icon-bold` })
|
|
6802
6838
|
}
|
|
6803
6839
|
),
|
|
6804
|
-
/* @__PURE__ */ (0,
|
|
6840
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
|
|
6805
6841
|
IconButton,
|
|
6806
6842
|
{
|
|
6807
|
-
className:
|
|
6843
|
+
className: `c-rte-toolbar__icon-btn ${isItalic ? "selected" : ""}`,
|
|
6808
6844
|
disabled: !isEditable,
|
|
6809
6845
|
onClick: () => {
|
|
6810
|
-
activeEditor.dispatchCommand(
|
|
6846
|
+
activeEditor.dispatchCommand(import_lexical15.FORMAT_TEXT_COMMAND, "italic");
|
|
6811
6847
|
},
|
|
6812
6848
|
type: "button",
|
|
6813
6849
|
title: tr(IS_APPLE ? "actionFormatAsEmphasizedTitleApple" : "actionFormatAsEmphasizedTitle"),
|
|
6814
6850
|
"aria-label": tr("actionFormatAsEmphasizedLabel"),
|
|
6815
6851
|
"data-testid": "toggle-format-emphasized",
|
|
6816
|
-
children: /* @__PURE__ */ (0,
|
|
6852
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime95.jsx)("i", { className: `c-rte-toolbar__icon-btn__icon c-rte-icon-italic` })
|
|
6817
6853
|
}
|
|
6818
6854
|
),
|
|
6819
|
-
/* @__PURE__ */ (0,
|
|
6855
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
|
|
6820
6856
|
IconButton,
|
|
6821
6857
|
{
|
|
6822
|
-
className:
|
|
6858
|
+
className: `c-rte-toolbar__icon-btn ${isUnderline ? "selected" : ""}`,
|
|
6823
6859
|
disabled: !isEditable,
|
|
6824
6860
|
onClick: () => {
|
|
6825
|
-
activeEditor.dispatchCommand(
|
|
6861
|
+
activeEditor.dispatchCommand(import_lexical15.FORMAT_TEXT_COMMAND, "underline");
|
|
6826
6862
|
},
|
|
6827
6863
|
type: "button",
|
|
6828
6864
|
title: tr(IS_APPLE ? "actionFormatAsUnderlinedTitleApple" : "actionFormatAsUnderlinedTitle"),
|
|
6829
6865
|
"aria-label": tr("actionFormatAsUnderlinedLabel"),
|
|
6830
6866
|
"data-testid": "toggle-format-underlined",
|
|
6831
|
-
children: /* @__PURE__ */ (0,
|
|
6832
|
-
"i",
|
|
6833
|
-
{
|
|
6834
|
-
className: `format icon underline border w-full h-full bg-no-repeat bg-center bg-[length:18px_18px]`
|
|
6835
|
-
}
|
|
6836
|
-
)
|
|
6867
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime95.jsx)("i", { className: `c-rte-toolbar__icon-btn__icon c-rte-icon-underline` })
|
|
6837
6868
|
}
|
|
6838
6869
|
),
|
|
6839
|
-
/* @__PURE__ */ (0,
|
|
6870
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
|
|
6840
6871
|
IconButton,
|
|
6841
6872
|
{
|
|
6842
|
-
className:
|
|
6873
|
+
className: `c-rte-toolbar__icon-btn ${isCode ? "selected" : ""}`,
|
|
6843
6874
|
disabled: !isEditable,
|
|
6844
6875
|
onClick: () => {
|
|
6845
|
-
activeEditor.dispatchCommand(
|
|
6876
|
+
activeEditor.dispatchCommand(import_lexical15.FORMAT_TEXT_COMMAND, "code");
|
|
6846
6877
|
},
|
|
6847
6878
|
type: "button",
|
|
6848
6879
|
title: tr("actionInsertCodeBlock"),
|
|
6849
6880
|
"aria-label": tr("actionInsertCodeBlock"),
|
|
6850
|
-
children: /* @__PURE__ */ (0,
|
|
6881
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime95.jsx)("i", { className: `c-rte-toolbar__icon-btn__icon c-rte-icon-code` })
|
|
6851
6882
|
}
|
|
6852
6883
|
),
|
|
6853
|
-
/* @__PURE__ */ (0,
|
|
6884
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
|
|
6854
6885
|
IconButton,
|
|
6855
6886
|
{
|
|
6856
|
-
className:
|
|
6887
|
+
className: `c-rte-toolbar__icon-btn ${isLink ? "selected" : ""}`,
|
|
6857
6888
|
disabled: !isEditable,
|
|
6858
6889
|
onClick: insertLink,
|
|
6859
6890
|
type: "button",
|
|
6860
6891
|
"aria-label": tr("actionInsertlink"),
|
|
6861
6892
|
title: tr("actionInsertlink"),
|
|
6862
|
-
children: /* @__PURE__ */ (0,
|
|
6893
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime95.jsx)("i", { className: `c-rte-toolbar__icon-btn__icon c-rte-icon-link` })
|
|
6863
6894
|
}
|
|
6864
6895
|
),
|
|
6865
|
-
/* @__PURE__ */ (0,
|
|
6896
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
|
|
6866
6897
|
DropdownMenu.Root,
|
|
6867
6898
|
{
|
|
6868
6899
|
disabled: !isEditable,
|
|
6869
6900
|
style: { zIndex: 1 },
|
|
6870
|
-
content: /* @__PURE__ */ (0,
|
|
6871
|
-
/* @__PURE__ */ (0,
|
|
6901
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime95.jsxs)(import_jsx_runtime95.Fragment, { children: [
|
|
6902
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsxs)(
|
|
6872
6903
|
DropdownMenu.Item,
|
|
6873
6904
|
{
|
|
6874
6905
|
onClick: () => {
|
|
6875
|
-
activeEditor.dispatchCommand(
|
|
6906
|
+
activeEditor.dispatchCommand(import_lexical15.FORMAT_TEXT_COMMAND, "strikethrough");
|
|
6876
6907
|
},
|
|
6877
6908
|
title: tr("actionFormatWithStrikethroughTitle"),
|
|
6878
6909
|
"aria-label": tr("actionFormatWithStrikethroughLabel"),
|
|
6879
6910
|
children: [
|
|
6880
|
-
/* @__PURE__ */ (0,
|
|
6911
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
|
|
6881
6912
|
"i",
|
|
6882
6913
|
{
|
|
6883
|
-
className: `icon
|
|
6914
|
+
className: `c-rte-icon-strikethrough c-rte-toolbar__dd-item__icon ${isStrikethrough ? "selected" : ""}`
|
|
6884
6915
|
}
|
|
6885
6916
|
),
|
|
6886
|
-
/* @__PURE__ */ (0,
|
|
6917
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)("span", { className: `c-rte-toolbar__dd-item__text ${isStrikethrough ? "selected" : ""}`, children: tr("actionFormatAsStrongTitle") })
|
|
6887
6918
|
]
|
|
6888
6919
|
}
|
|
6889
6920
|
),
|
|
6890
|
-
/* @__PURE__ */ (0,
|
|
6921
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsxs)(
|
|
6891
6922
|
DropdownMenu.Item,
|
|
6892
6923
|
{
|
|
6893
6924
|
onClick: () => {
|
|
6894
|
-
activeEditor.dispatchCommand(
|
|
6925
|
+
activeEditor.dispatchCommand(import_lexical15.FORMAT_TEXT_COMMAND, "subscript");
|
|
6895
6926
|
},
|
|
6896
6927
|
title: tr("actionFormatWithSubscriptTitle"),
|
|
6897
6928
|
"aria-label": tr("actionFormatWithSubscriptLabel"),
|
|
6898
6929
|
children: [
|
|
6899
|
-
/* @__PURE__ */ (0,
|
|
6930
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
|
|
6900
6931
|
"i",
|
|
6901
6932
|
{
|
|
6902
|
-
className: `icon
|
|
6933
|
+
className: `c-rte-icon-subscript c-rte-toolbar__dd-item__icon ${isSubscript ? "selected" : ""}`
|
|
6903
6934
|
}
|
|
6904
6935
|
),
|
|
6905
|
-
/* @__PURE__ */ (0,
|
|
6936
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)("span", { className: `c-rte-toolbar__dd-item__text ${isSubscript ? "selected" : ""}`, children: tr("actionFormatWithSubscriptTitle") })
|
|
6906
6937
|
]
|
|
6907
6938
|
}
|
|
6908
6939
|
),
|
|
6909
|
-
/* @__PURE__ */ (0,
|
|
6940
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsxs)(
|
|
6910
6941
|
DropdownMenu.Item,
|
|
6911
6942
|
{
|
|
6912
6943
|
onClick: () => {
|
|
6913
|
-
activeEditor.dispatchCommand(
|
|
6944
|
+
activeEditor.dispatchCommand(import_lexical15.FORMAT_TEXT_COMMAND, "superscript");
|
|
6914
6945
|
},
|
|
6915
6946
|
title: tr("actionFormatWithSuperscriptTitle"),
|
|
6916
6947
|
"aria-label": tr("actionFormatWithSuperscriptLabel"),
|
|
6917
6948
|
children: [
|
|
6918
|
-
/* @__PURE__ */ (0,
|
|
6949
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
|
|
6919
6950
|
"i",
|
|
6920
6951
|
{
|
|
6921
|
-
className: `icon
|
|
6952
|
+
className: `c-rte-icon-superscript c-rte-toolbar__dd-item__icon ${isSuperscript ? "selected" : ""}`
|
|
6922
6953
|
}
|
|
6923
6954
|
),
|
|
6924
|
-
/* @__PURE__ */ (0,
|
|
6955
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)("span", { className: `c-rte-toolbar__dd-item__text ${isSuperscript ? "selected" : ""}`, children: tr("actionFormatWithSuperscriptTitle") })
|
|
6925
6956
|
]
|
|
6926
6957
|
}
|
|
6927
6958
|
),
|
|
6928
|
-
/* @__PURE__ */ (0,
|
|
6959
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsxs)(
|
|
6929
6960
|
DropdownMenu.Item,
|
|
6930
6961
|
{
|
|
6931
6962
|
onClick: clearFormatting,
|
|
@@ -6933,60 +6964,60 @@ function ToolbarPlugin({
|
|
|
6933
6964
|
title: tr("actionClearTextFormatting"),
|
|
6934
6965
|
"aria-label": tr("actionClearTextFormatting"),
|
|
6935
6966
|
children: [
|
|
6936
|
-
/* @__PURE__ */ (0,
|
|
6937
|
-
/* @__PURE__ */ (0,
|
|
6967
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)("i", { className: "c-rte-icon-clear c-rte-toolbar__dd-item__icon" }),
|
|
6968
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)("span", { className: "c-rte-toolbar__dd-item__text--clear", children: "Clear Formatting" })
|
|
6938
6969
|
]
|
|
6939
6970
|
}
|
|
6940
6971
|
)
|
|
6941
6972
|
] }),
|
|
6942
|
-
children: /* @__PURE__ */ (0,
|
|
6973
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime95.jsxs)(
|
|
6943
6974
|
Button,
|
|
6944
6975
|
{
|
|
6945
6976
|
style: { backgroundColor: "transparent", padding: "0 8px" },
|
|
6946
6977
|
"aria-label": tr("actionTextFormattingOptions"),
|
|
6947
6978
|
children: [
|
|
6948
|
-
/* @__PURE__ */ (0,
|
|
6949
|
-
/* @__PURE__ */ (0,
|
|
6979
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)("i", { className: `c-rte-icon-dropdown-more c-rte-toolbar__toggle-icon` }),
|
|
6980
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)(Icon.Arrow, {})
|
|
6950
6981
|
]
|
|
6951
6982
|
}
|
|
6952
6983
|
)
|
|
6953
6984
|
}
|
|
6954
6985
|
),
|
|
6955
|
-
/* @__PURE__ */ (0,
|
|
6956
|
-
/* @__PURE__ */ (0,
|
|
6986
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)(Divider, {}),
|
|
6987
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
|
|
6957
6988
|
DropdownMenu.Root,
|
|
6958
6989
|
{
|
|
6959
6990
|
style: { zIndex: 1 },
|
|
6960
6991
|
disabled: !isEditable,
|
|
6961
|
-
content: /* @__PURE__ */ (0,
|
|
6962
|
-
/* @__PURE__ */ (0,
|
|
6992
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime95.jsxs)(import_jsx_runtime95.Fragment, { children: [
|
|
6993
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsxs)(
|
|
6963
6994
|
DropdownMenu.Item,
|
|
6964
6995
|
{
|
|
6965
6996
|
onClick: () => {
|
|
6966
6997
|
activeEditor.dispatchCommand(import_LexicalHorizontalRuleNode4.INSERT_HORIZONTAL_RULE_COMMAND, void 0);
|
|
6967
6998
|
},
|
|
6968
|
-
children:
|
|
6969
|
-
/* @__PURE__ */ (0,
|
|
6970
|
-
/* @__PURE__ */ (0,
|
|
6971
|
-
]
|
|
6999
|
+
children: [
|
|
7000
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)("i", { className: "c-rte-toolbar__dd-item__icon c-rte-icon-horizontal-rule" }),
|
|
7001
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)("span", { className: "c-rte-toolbar__dd-item__text", children: tr("horizontalRule") })
|
|
7002
|
+
]
|
|
6972
7003
|
}
|
|
6973
7004
|
),
|
|
6974
|
-
/* @__PURE__ */ (0,
|
|
6975
|
-
/* @__PURE__ */ (0,
|
|
6976
|
-
/* @__PURE__ */ (0,
|
|
7005
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)(DropdownMenu.Item, { children: /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(Dialog.Trigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime95.jsxs)("div", { className: "c-rte-toolbar__dd-item--table", children: [
|
|
7006
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)("i", { className: "c-rte-toolbar__dd-item__icon c-rte-icon-table" }),
|
|
7007
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)("span", { className: "c-rte-toolbar__dd-item__text", children: tr("table") })
|
|
6977
7008
|
] }) }) })
|
|
6978
7009
|
] }),
|
|
6979
|
-
children: /* @__PURE__ */ (0,
|
|
7010
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(IconButton, { children: /* @__PURE__ */ (0, import_jsx_runtime95.jsx)("i", { className: "c-rte-icon-plus c-rte-toolbar__plus" }) })
|
|
6980
7011
|
}
|
|
6981
7012
|
),
|
|
6982
|
-
/* @__PURE__ */ (0,
|
|
6983
|
-
/* @__PURE__ */ (0,
|
|
6984
|
-
/* @__PURE__ */ (0,
|
|
6985
|
-
/* @__PURE__ */ (0,
|
|
7013
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsxs)(Dialog.Content, { children: [
|
|
7014
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)(Dialog.Title, { children: tr("insertTableTitle") }),
|
|
7015
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)(Dialog.Description, { children: tr("insertTableDescription") }),
|
|
7016
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)(InsertTableDialog, { activeEditor })
|
|
6986
7017
|
] })
|
|
6987
7018
|
] }) })
|
|
6988
7019
|
] }),
|
|
6989
|
-
/* @__PURE__ */ (0,
|
|
7020
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)(ActionsPlugin, { prepend: actionsMenuPrepend, append: actionsMenuAppend })
|
|
6990
7021
|
] });
|
|
6991
7022
|
}
|
|
6992
7023
|
|
|
@@ -7040,7 +7071,7 @@ var theme = {
|
|
|
7040
7071
|
h5: "CrystallizeRTEditorTheme__h5",
|
|
7041
7072
|
h6: "CrystallizeRTEditorTheme__h6"
|
|
7042
7073
|
},
|
|
7043
|
-
image: "
|
|
7074
|
+
image: "",
|
|
7044
7075
|
indent: "CrystallizeRTEditorTheme__indent",
|
|
7045
7076
|
link: "CrystallizeRTEditorTheme__link",
|
|
7046
7077
|
list: {
|
|
@@ -7093,7 +7124,7 @@ var theme = {
|
|
|
7093
7124
|
var CrystallizeRTEditorTheme_default = theme;
|
|
7094
7125
|
|
|
7095
7126
|
// src/rich-text-editor/rich-text-editor.tsx
|
|
7096
|
-
var
|
|
7127
|
+
var import_jsx_runtime96 = require("react/jsx-runtime");
|
|
7097
7128
|
function RichTextEditor({
|
|
7098
7129
|
initialData,
|
|
7099
7130
|
editable = true,
|
|
@@ -7101,7 +7132,7 @@ function RichTextEditor({
|
|
|
7101
7132
|
labelTranslations,
|
|
7102
7133
|
...rest
|
|
7103
7134
|
}) {
|
|
7104
|
-
return /* @__PURE__ */ (0,
|
|
7135
|
+
return /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
|
|
7105
7136
|
import_LexicalComposer.LexicalComposer,
|
|
7106
7137
|
{
|
|
7107
7138
|
initialConfig: {
|
|
@@ -7116,7 +7147,7 @@ function RichTextEditor({
|
|
|
7116
7147
|
richText: initialData
|
|
7117
7148
|
}) : void 0
|
|
7118
7149
|
},
|
|
7119
|
-
children: /* @__PURE__ */ (0,
|
|
7150
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(I18nProvider, { language, labelTranslations, children: /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(SharedHistoryContext, { children: /* @__PURE__ */ (0, import_jsx_runtime96.jsx)("div", { className: "c-rich-text-editor", children: /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(RichTextEditorWithoutContext, { ...rest, editable }) }) }) })
|
|
7120
7151
|
}
|
|
7121
7152
|
);
|
|
7122
7153
|
}
|
|
@@ -7129,34 +7160,23 @@ function RichTextEditorWithoutContext({
|
|
|
7129
7160
|
actionsMenuAppend,
|
|
7130
7161
|
slotPreContent,
|
|
7131
7162
|
maxLength,
|
|
7132
|
-
editable
|
|
7163
|
+
editable,
|
|
7164
|
+
id
|
|
7133
7165
|
}) {
|
|
7134
7166
|
const { historyState } = useSharedHistoryContext();
|
|
7135
|
-
const placeholder = /* @__PURE__ */ (0,
|
|
7167
|
+
const placeholder = /* @__PURE__ */ (0, import_jsx_runtime96.jsx)("div", { className: "c-rte-placeholder", children: placeholderText ?? "" });
|
|
7136
7168
|
const [editor] = (0, import_LexicalComposerContext12.useLexicalComposerContext)();
|
|
7137
|
-
const [floatingAnchorElem, setFloatingAnchorElem] = (0,
|
|
7138
|
-
const [isSmallWidthViewport, setIsSmallWidthViewport] = (0,
|
|
7139
|
-
const firstOnChangeTriggeredRef = (0,
|
|
7169
|
+
const [floatingAnchorElem, setFloatingAnchorElem] = (0, import_react84.useState)(null);
|
|
7170
|
+
const [isSmallWidthViewport, setIsSmallWidthViewport] = (0, import_react84.useState)(false);
|
|
7171
|
+
const firstOnChangeTriggeredRef = (0, import_react84.useRef)(!autoFocus);
|
|
7140
7172
|
const onRef = (_floatingAnchorElem) => {
|
|
7141
7173
|
if (_floatingAnchorElem !== null) {
|
|
7142
7174
|
setFloatingAnchorElem(_floatingAnchorElem);
|
|
7143
7175
|
}
|
|
7144
7176
|
};
|
|
7145
|
-
(0,
|
|
7177
|
+
(0, import_react84.useEffect)(() => {
|
|
7146
7178
|
editor.setEditable(editable || false);
|
|
7147
7179
|
}, [editable, editor]);
|
|
7148
|
-
(0, import_react83.useEffect)(() => {
|
|
7149
|
-
const updateViewPortWidth = () => {
|
|
7150
|
-
const isNextSmallWidthViewport = window.matchMedia("(max-width: 1025px)").matches;
|
|
7151
|
-
if (isNextSmallWidthViewport !== isSmallWidthViewport) {
|
|
7152
|
-
setIsSmallWidthViewport(isNextSmallWidthViewport);
|
|
7153
|
-
}
|
|
7154
|
-
};
|
|
7155
|
-
window.addEventListener("resize", updateViewPortWidth);
|
|
7156
|
-
return () => {
|
|
7157
|
-
window.removeEventListener("resize", updateViewPortWidth);
|
|
7158
|
-
};
|
|
7159
|
-
}, [isSmallWidthViewport]);
|
|
7160
7180
|
function onLocalChange(editorState) {
|
|
7161
7181
|
if (onChange) {
|
|
7162
7182
|
if (triggerOnChangeOnAutoFocus || firstOnChangeTriggeredRef.current) {
|
|
@@ -7165,37 +7185,38 @@ function RichTextEditorWithoutContext({
|
|
|
7165
7185
|
}
|
|
7166
7186
|
firstOnChangeTriggeredRef.current = true;
|
|
7167
7187
|
}
|
|
7168
|
-
return /* @__PURE__ */ (0,
|
|
7169
|
-
/* @__PURE__ */ (0,
|
|
7170
|
-
/* @__PURE__ */ (0,
|
|
7188
|
+
return /* @__PURE__ */ (0, import_jsx_runtime96.jsxs)(import_jsx_runtime96.Fragment, { children: [
|
|
7189
|
+
/* @__PURE__ */ (0, import_jsx_runtime96.jsx)(import_LexicalOnChangePlugin.OnChangePlugin, { onChange: onLocalChange, ignoreSelectionChange: true }),
|
|
7190
|
+
/* @__PURE__ */ (0, import_jsx_runtime96.jsx)(DimensionDetectorPlugin, { onChange: (d) => setIsSmallWidthViewport(d.isSmallWidth) }),
|
|
7191
|
+
isSmallWidthViewport ? null : /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(ToolbarPlugin, { actionsMenuPrepend, actionsMenuAppend }),
|
|
7171
7192
|
slotPreContent,
|
|
7172
|
-
/* @__PURE__ */ (0,
|
|
7173
|
-
maxLength != null ? /* @__PURE__ */ (0,
|
|
7174
|
-
!autoFocus ? null : /* @__PURE__ */ (0,
|
|
7175
|
-
/* @__PURE__ */ (0,
|
|
7176
|
-
/* @__PURE__ */ (0,
|
|
7177
|
-
/* @__PURE__ */ (0,
|
|
7178
|
-
/* @__PURE__ */ (0,
|
|
7193
|
+
/* @__PURE__ */ (0, import_jsx_runtime96.jsxs)("div", { className: "c-rte-editor-container", children: [
|
|
7194
|
+
maxLength != null ? /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(MaxLengthPlugin, { maxLength }) : null,
|
|
7195
|
+
!autoFocus ? null : /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(import_LexicalAutoFocusPlugin.AutoFocusPlugin, {}),
|
|
7196
|
+
/* @__PURE__ */ (0, import_jsx_runtime96.jsx)(import_LexicalClearEditorPlugin.ClearEditorPlugin, {}),
|
|
7197
|
+
/* @__PURE__ */ (0, import_jsx_runtime96.jsx)(LexicalAutoLinkPlugin, {}),
|
|
7198
|
+
/* @__PURE__ */ (0, import_jsx_runtime96.jsx)(import_LexicalHistoryPlugin2.HistoryPlugin, { externalHistoryState: historyState }),
|
|
7199
|
+
/* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
|
|
7179
7200
|
import_LexicalRichTextPlugin.RichTextPlugin,
|
|
7180
7201
|
{
|
|
7181
|
-
contentEditable: /* @__PURE__ */ (0,
|
|
7202
|
+
contentEditable: /* @__PURE__ */ (0, import_jsx_runtime96.jsx)("div", { className: "c-rte-editor-scroller", children: /* @__PURE__ */ (0, import_jsx_runtime96.jsx)("div", { className: "c-rte-editor", ref: onRef, children: /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(import_LexicalContentEditable.ContentEditable, { className: "c-rte-contenteditable-root", id }) }) }),
|
|
7182
7203
|
placeholder,
|
|
7183
7204
|
ErrorBoundary: import_LexicalErrorBoundary.default
|
|
7184
7205
|
}
|
|
7185
7206
|
),
|
|
7186
|
-
/* @__PURE__ */ (0,
|
|
7187
|
-
/* @__PURE__ */ (0,
|
|
7188
|
-
/* @__PURE__ */ (0,
|
|
7189
|
-
/* @__PURE__ */ (0,
|
|
7190
|
-
/* @__PURE__ */ (0,
|
|
7191
|
-
/* @__PURE__ */ (0,
|
|
7192
|
-
/* @__PURE__ */ (0,
|
|
7193
|
-
/* @__PURE__ */ (0,
|
|
7194
|
-
floatingAnchorElem && !isSmallWidthViewport && /* @__PURE__ */ (0,
|
|
7195
|
-
/* @__PURE__ */ (0,
|
|
7196
|
-
/* @__PURE__ */ (0,
|
|
7197
|
-
/* @__PURE__ */ (0,
|
|
7198
|
-
/* @__PURE__ */ (0,
|
|
7207
|
+
/* @__PURE__ */ (0, import_jsx_runtime96.jsx)(CodeHighlightPlugin, {}),
|
|
7208
|
+
/* @__PURE__ */ (0, import_jsx_runtime96.jsx)(import_LexicalListPlugin.ListPlugin, {}),
|
|
7209
|
+
/* @__PURE__ */ (0, import_jsx_runtime96.jsx)(ListMaxIndentLevelPlugin, { maxDepth: 7 }),
|
|
7210
|
+
/* @__PURE__ */ (0, import_jsx_runtime96.jsx)(import_LexicalTablePlugin.TablePlugin, {}),
|
|
7211
|
+
/* @__PURE__ */ (0, import_jsx_runtime96.jsx)(LinkPlugin, {}),
|
|
7212
|
+
/* @__PURE__ */ (0, import_jsx_runtime96.jsx)(import_LexicalHorizontalRulePlugin.HorizontalRulePlugin, {}),
|
|
7213
|
+
/* @__PURE__ */ (0, import_jsx_runtime96.jsx)(TabFocusPlugin, {}),
|
|
7214
|
+
/* @__PURE__ */ (0, import_jsx_runtime96.jsx)(import_LexicalTabIndentationPlugin.TabIndentationPlugin, {}),
|
|
7215
|
+
floatingAnchorElem && !isSmallWidthViewport && /* @__PURE__ */ (0, import_jsx_runtime96.jsxs)(import_jsx_runtime96.Fragment, { children: [
|
|
7216
|
+
/* @__PURE__ */ (0, import_jsx_runtime96.jsx)(CodeActionMenuPlugin, { anchorElem: floatingAnchorElem }),
|
|
7217
|
+
/* @__PURE__ */ (0, import_jsx_runtime96.jsx)(FloatingLinkEditorPlugin, { anchorElem: floatingAnchorElem }),
|
|
7218
|
+
/* @__PURE__ */ (0, import_jsx_runtime96.jsx)(TableActionMenuPlugin, { anchorElem: floatingAnchorElem }),
|
|
7219
|
+
/* @__PURE__ */ (0, import_jsx_runtime96.jsx)(FloatingTextFormatToolbarPlugin, { anchorElem: floatingAnchorElem })
|
|
7199
7220
|
] })
|
|
7200
7221
|
] })
|
|
7201
7222
|
] });
|