@crystallize/design-system 1.12.0 → 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 +7 -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 +517 -515
- package/dist/index.mjs +398 -396
- package/package.json +6 -7
- 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/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 +11 -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.mjs
CHANGED
|
@@ -3,8 +3,8 @@ import { forwardRef as forwardRef2 } from "react";
|
|
|
3
3
|
import { cva } from "class-variance-authority";
|
|
4
4
|
|
|
5
5
|
// src/spinner/index.tsx
|
|
6
|
-
import { cx } from "class-variance-authority";
|
|
7
6
|
import { forwardRef } from "react";
|
|
7
|
+
import { cx } from "class-variance-authority";
|
|
8
8
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
9
|
var realSize = 40;
|
|
10
10
|
var Spinner = forwardRef(
|
|
@@ -173,8 +173,8 @@ import { cva as cva3 } from "class-variance-authority";
|
|
|
173
173
|
import { Portal as Portal2, Separator } from "@radix-ui/react-dropdown-menu";
|
|
174
174
|
|
|
175
175
|
// src/dropdown-menu/dropdown-menu-item.tsx
|
|
176
|
-
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
|
|
177
176
|
import { cx as cx2 } from "class-variance-authority";
|
|
177
|
+
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
|
|
178
178
|
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
179
179
|
function DropdownMenuItem({ children, className, ...delegated }) {
|
|
180
180
|
return /* @__PURE__ */ jsx4(DropdownMenuPrimitive.Item, { ...delegated, className: cx2("c-dropdown-menu-item", className), children });
|
|
@@ -303,8 +303,8 @@ var Avatar = forwardRef3(({ name, size, className, ...delegated }, ref) => {
|
|
|
303
303
|
Avatar.displayName = "Avatar";
|
|
304
304
|
|
|
305
305
|
// src/checkbox/checkbox.tsx
|
|
306
|
-
import * as CheckboxPrimitive from "@radix-ui/react-checkbox";
|
|
307
306
|
import { forwardRef as forwardRef4 } from "react";
|
|
307
|
+
import * as CheckboxPrimitive from "@radix-ui/react-checkbox";
|
|
308
308
|
import { jsx as jsx11, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
309
309
|
var Checkbox = forwardRef4((props, ref) => {
|
|
310
310
|
return /* @__PURE__ */ jsx11(CheckboxPrimitive.Root, { ...props, ref, className: "c-checkbox", children: /* @__PURE__ */ jsx11(CheckboxPrimitive.Indicator, { children: /* @__PURE__ */ jsxs5("svg", { viewBox: "0 0 9 9", fill: "none", className: "c-checkbox__svg", children: [
|
|
@@ -326,8 +326,8 @@ var Checkbox = forwardRef4((props, ref) => {
|
|
|
326
326
|
});
|
|
327
327
|
Checkbox.displayName = "Checkbox";
|
|
328
328
|
|
|
329
|
-
// src/dialog/
|
|
330
|
-
|
|
329
|
+
// src/dialog/config.tsx
|
|
330
|
+
import { unmountComponentAtNode, render as DOMRender } from "react-dom";
|
|
331
331
|
|
|
332
332
|
// src/dialog/dialog.tsx
|
|
333
333
|
import { cva as cva5, cx as cx5 } from "class-variance-authority";
|
|
@@ -3715,9 +3715,6 @@ DialogBase.Content = DialogContent;
|
|
|
3715
3715
|
DialogBase.Overlay = DialogPrimitive.Overlay;
|
|
3716
3716
|
DialogBase.Close = DialogPrimitive.Close;
|
|
3717
3717
|
|
|
3718
|
-
// src/dialog/config.tsx
|
|
3719
|
-
import { unmountComponentAtNode, render as DOMRender } from "react-dom";
|
|
3720
|
-
|
|
3721
3718
|
// src/dialog/confirm-dialog.tsx
|
|
3722
3719
|
import { jsx as jsx67, jsxs as jsxs58 } from "react/jsx-runtime";
|
|
3723
3720
|
function ConfirmDialog({
|
|
@@ -3782,6 +3779,9 @@ function ConfirmDialog({
|
|
|
3782
3779
|
) });
|
|
3783
3780
|
}
|
|
3784
3781
|
|
|
3782
|
+
// src/dialog/destroyFns.ts
|
|
3783
|
+
var destroyFns = [];
|
|
3784
|
+
|
|
3785
3785
|
// src/dialog/config.tsx
|
|
3786
3786
|
import { jsx as jsx68 } from "react/jsx-runtime";
|
|
3787
3787
|
function confirm(config) {
|
|
@@ -3953,8 +3953,8 @@ var IconButton = forwardRef59(
|
|
|
3953
3953
|
IconButton.displayName = "Button";
|
|
3954
3954
|
|
|
3955
3955
|
// src/inline-radio/inline-radio.tsx
|
|
3956
|
-
import * as RadioGroupPrimitive from "@radix-ui/react-radio-group";
|
|
3957
3956
|
import { cx as cx6, cva as cva7 } from "class-variance-authority";
|
|
3957
|
+
import * as RadioGroupPrimitive from "@radix-ui/react-radio-group";
|
|
3958
3958
|
import { jsx as jsx70 } from "react/jsx-runtime";
|
|
3959
3959
|
var inlineRadioGroupStyles = cva7("c-inline-radio-group", {
|
|
3960
3960
|
variants: {
|
|
@@ -3984,34 +3984,12 @@ var InlineRadio = {
|
|
|
3984
3984
|
import { forwardRef as forwardRef63 } from "react";
|
|
3985
3985
|
import { cva as cva9, cx as cx8 } from "class-variance-authority";
|
|
3986
3986
|
|
|
3987
|
-
// src/
|
|
3988
|
-
import { cva as cva8 } from "class-variance-authority";
|
|
3987
|
+
// src/iconography/triangle.tsx
|
|
3989
3988
|
import { forwardRef as forwardRef60 } from "react";
|
|
3990
3989
|
import { jsx as jsx71 } from "react/jsx-runtime";
|
|
3991
|
-
var
|
|
3992
|
-
variants: {},
|
|
3993
|
-
defaultVariants: {}
|
|
3994
|
-
});
|
|
3995
|
-
var Input = forwardRef60(({ className, ...delegated }, ref) => {
|
|
3996
|
-
return /* @__PURE__ */ jsx71("input", { ref, className: inputStyles({ className }), type: "text", ...delegated });
|
|
3997
|
-
});
|
|
3998
|
-
Input.displayName = "Input";
|
|
3999
|
-
|
|
4000
|
-
// src/label/label.tsx
|
|
4001
|
-
import { forwardRef as forwardRef61 } from "react";
|
|
4002
|
-
import { cx as cx7 } from "class-variance-authority";
|
|
4003
|
-
import { jsx as jsx72 } from "react/jsx-runtime";
|
|
4004
|
-
var Label2 = forwardRef61(({ className, ...delegated }, ref) => {
|
|
4005
|
-
return /* @__PURE__ */ jsx72("label", { ref, className: cx7("c-label", className), ...delegated });
|
|
4006
|
-
});
|
|
4007
|
-
Label2.displayName = "Label";
|
|
4008
|
-
|
|
4009
|
-
// src/iconography/triangle.tsx
|
|
4010
|
-
import { forwardRef as forwardRef62 } from "react";
|
|
4011
|
-
import { jsx as jsx73 } from "react/jsx-runtime";
|
|
4012
|
-
var Triangle = forwardRef62((delegated, ref) => {
|
|
3990
|
+
var Triangle = forwardRef60((delegated, ref) => {
|
|
4013
3991
|
const { width = 20, height = 20, ...rest } = delegated;
|
|
4014
|
-
return /* @__PURE__ */
|
|
3992
|
+
return /* @__PURE__ */ jsx71(
|
|
4015
3993
|
"svg",
|
|
4016
3994
|
{
|
|
4017
3995
|
viewBox: "0 0 17 15",
|
|
@@ -4021,11 +3999,33 @@ var Triangle = forwardRef62((delegated, ref) => {
|
|
|
4021
3999
|
fill: "none",
|
|
4022
4000
|
xmlns: "http://www.w3.org/2000/svg",
|
|
4023
4001
|
...rest,
|
|
4024
|
-
children: /* @__PURE__ */
|
|
4002
|
+
children: /* @__PURE__ */ jsx71("path", { d: "M15.463 1.2L8.5 12.685 1.537 1.2h13.925zM1.353.896s0 0 0 0h0z", stroke: "currentColor", strokeWidth: 2.4 })
|
|
4025
4003
|
}
|
|
4026
4004
|
);
|
|
4027
4005
|
});
|
|
4028
4006
|
|
|
4007
|
+
// src/input/input.tsx
|
|
4008
|
+
import { forwardRef as forwardRef61 } from "react";
|
|
4009
|
+
import { cva as cva8 } from "class-variance-authority";
|
|
4010
|
+
import { jsx as jsx72 } from "react/jsx-runtime";
|
|
4011
|
+
var inputStyles = cva8(["c-input"], {
|
|
4012
|
+
variants: {},
|
|
4013
|
+
defaultVariants: {}
|
|
4014
|
+
});
|
|
4015
|
+
var Input = forwardRef61(({ className, ...delegated }, ref) => {
|
|
4016
|
+
return /* @__PURE__ */ jsx72("input", { ref, className: inputStyles({ className }), type: "text", ...delegated });
|
|
4017
|
+
});
|
|
4018
|
+
Input.displayName = "Input";
|
|
4019
|
+
|
|
4020
|
+
// src/label/label.tsx
|
|
4021
|
+
import { forwardRef as forwardRef62 } from "react";
|
|
4022
|
+
import { cx as cx7 } from "class-variance-authority";
|
|
4023
|
+
import { jsx as jsx73 } from "react/jsx-runtime";
|
|
4024
|
+
var Label2 = forwardRef62(({ className, ...delegated }, ref) => {
|
|
4025
|
+
return /* @__PURE__ */ jsx73("label", { ref, className: cx7("c-label", className), ...delegated });
|
|
4026
|
+
});
|
|
4027
|
+
Label2.displayName = "Label";
|
|
4028
|
+
|
|
4029
4029
|
// src/input-with-label/input-with-label.tsx
|
|
4030
4030
|
import { Fragment, jsx as jsx74, jsxs as jsxs59 } from "react/jsx-runtime";
|
|
4031
4031
|
var inputWithLabelStyles = cva9(["c-input-with-label"], {
|
|
@@ -4064,8 +4064,8 @@ var InputWithLabel = forwardRef63(
|
|
|
4064
4064
|
InputWithLabel.displayName = "InputWithLabel";
|
|
4065
4065
|
|
|
4066
4066
|
// src/progress/progress.tsx
|
|
4067
|
-
import * as ProgressPrimitives from "@radix-ui/react-progress";
|
|
4068
4067
|
import { cx as cx9 } from "class-variance-authority";
|
|
4068
|
+
import * as ProgressPrimitives from "@radix-ui/react-progress";
|
|
4069
4069
|
import { jsx as jsx75 } from "react/jsx-runtime";
|
|
4070
4070
|
function Progress({ className, value }) {
|
|
4071
4071
|
return /* @__PURE__ */ jsx75(ProgressPrimitives.Root, { className: cx9(className, "c-progress-root"), value, children: /* @__PURE__ */ jsx75(
|
|
@@ -4103,8 +4103,8 @@ SelectItem.displayName = "SelectItem";
|
|
|
4103
4103
|
|
|
4104
4104
|
// src/select/select-root.tsx
|
|
4105
4105
|
import { forwardRef as forwardRef65 } from "react";
|
|
4106
|
-
import * as SelectPrimitives2 from "@radix-ui/react-select";
|
|
4107
4106
|
import { cva as cva10 } from "class-variance-authority";
|
|
4107
|
+
import * as SelectPrimitives2 from "@radix-ui/react-select";
|
|
4108
4108
|
import { jsx as jsx78, jsxs as jsxs61 } from "react/jsx-runtime";
|
|
4109
4109
|
var selectTriggerStyles = cva10("c-select-trigger", {
|
|
4110
4110
|
variants: {
|
|
@@ -4143,9 +4143,9 @@ var Select = {
|
|
|
4143
4143
|
};
|
|
4144
4144
|
|
|
4145
4145
|
// src/slider/slider.tsx
|
|
4146
|
-
import * as SliderPrimitive from "@radix-ui/react-slider";
|
|
4147
|
-
import { cx as cx10 } from "class-variance-authority";
|
|
4148
4146
|
import { forwardRef as forwardRef66 } from "react";
|
|
4147
|
+
import { cx as cx10 } from "class-variance-authority";
|
|
4148
|
+
import * as SliderPrimitive from "@radix-ui/react-slider";
|
|
4149
4149
|
import { jsx as jsx79, jsxs as jsxs62 } from "react/jsx-runtime";
|
|
4150
4150
|
var Slider = forwardRef66(({ className, transparentRange, ...delegated }, ref) => {
|
|
4151
4151
|
return /* @__PURE__ */ jsxs62(SliderPrimitive.Root, { className: cx10("c-slider-root", className), ref, ...delegated, children: [
|
|
@@ -4198,7 +4198,7 @@ function Tag({ children, className, variant, size, prepend, onRemove, ...delegat
|
|
|
4198
4198
|
}
|
|
4199
4199
|
|
|
4200
4200
|
// src/rich-text-editor/rich-text-editor.tsx
|
|
4201
|
-
import { useEffect as
|
|
4201
|
+
import { useEffect as useEffect12, useRef as useRef7, useState as useState11 } from "react";
|
|
4202
4202
|
import { AutoFocusPlugin } from "@lexical/react/LexicalAutoFocusPlugin";
|
|
4203
4203
|
import { ClearEditorPlugin } from "@lexical/react/LexicalClearEditorPlugin";
|
|
4204
4204
|
import { LexicalComposer } from "@lexical/react/LexicalComposer";
|
|
@@ -4752,8 +4752,8 @@ var BaseNodes = [
|
|
|
4752
4752
|
];
|
|
4753
4753
|
|
|
4754
4754
|
// src/rich-text-editor/plugins/AutoLinkPlugin/index.tsx
|
|
4755
|
-
import { AutoLinkPlugin } from "@lexical/react/LexicalAutoLinkPlugin";
|
|
4756
4755
|
import "react";
|
|
4756
|
+
import { AutoLinkPlugin } from "@lexical/react/LexicalAutoLinkPlugin";
|
|
4757
4757
|
import { jsx as jsx83 } from "react/jsx-runtime";
|
|
4758
4758
|
var URL_MATCHER = /((https?:\/\/(www\.)?)|(www\.))[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)/;
|
|
4759
4759
|
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,}))/;
|
|
@@ -4828,7 +4828,7 @@ function CopyButton({ editor, getCodeDOMNode }) {
|
|
|
4828
4828
|
console.error("Failed to copy: ", err);
|
|
4829
4829
|
}
|
|
4830
4830
|
}
|
|
4831
|
-
return /* @__PURE__ */ jsx84("button", { className: "
|
|
4831
|
+
return /* @__PURE__ */ jsx84("button", { className: "c-rte-code-button", onClick: handleClick, "aria-label": tr("actionCopyCode"), children: isCopyCompleted ? /* @__PURE__ */ jsx84("i", { className: "c-rte-code-button__icon c-rte-icon-success" }) : /* @__PURE__ */ jsx84("i", { className: "c-rte-code-button__icon c-rte-icon-copy" }) });
|
|
4832
4832
|
}
|
|
4833
4833
|
|
|
4834
4834
|
// src/rich-text-editor/plugins/CodeActionMenuPlugin/components/PrettierButton/index.tsx
|
|
@@ -4922,19 +4922,19 @@ function PrettierButton({ lang, editor, getCodeDOMNode }) {
|
|
|
4922
4922
|
setTipsVisible(false);
|
|
4923
4923
|
}
|
|
4924
4924
|
}
|
|
4925
|
-
return /* @__PURE__ */ jsxs64("div", { className: "prettier-wrapper", children: [
|
|
4925
|
+
return /* @__PURE__ */ jsxs64("div", { className: "c-rte-prettier-wrapper", children: [
|
|
4926
4926
|
/* @__PURE__ */ jsx85(
|
|
4927
4927
|
"button",
|
|
4928
4928
|
{
|
|
4929
|
-
className: "
|
|
4929
|
+
className: "c-rte-code-button",
|
|
4930
4930
|
onClick: handleClick,
|
|
4931
4931
|
onMouseEnter: handleMouseEnter,
|
|
4932
4932
|
onMouseLeave: handleMouseLeave,
|
|
4933
4933
|
"aria-label": tr("actionFormatCode"),
|
|
4934
|
-
children: syntaxError ? /* @__PURE__ */ jsx85("i", { className: "
|
|
4934
|
+
children: syntaxError ? /* @__PURE__ */ jsx85("i", { className: "c-rte-code-button__icon c-rte-icon-prettier-error" }) : /* @__PURE__ */ jsx85("i", { className: "c-rte-code-button__icon c-rte-icon-prettier" })
|
|
4935
4935
|
}
|
|
4936
4936
|
),
|
|
4937
|
-
tipsVisible ? /* @__PURE__ */ jsx85("pre", { className: "code-error-tips", children: syntaxError }) : null
|
|
4937
|
+
tipsVisible ? /* @__PURE__ */ jsx85("pre", { className: "c-rte-code-error-tips", children: syntaxError }) : null
|
|
4938
4938
|
] });
|
|
4939
4939
|
}
|
|
4940
4940
|
|
|
@@ -5016,8 +5016,8 @@ function CodeActionMenuContainer({ anchorElem }) {
|
|
|
5016
5016
|
});
|
|
5017
5017
|
const normalizedLang = normalizeCodeLang(lang);
|
|
5018
5018
|
const codeFriendlyName = getLanguageFriendlyName(lang);
|
|
5019
|
-
return /* @__PURE__ */ jsx86(Fragment2, { children: isShown ? /* @__PURE__ */ jsxs65("div", { className: "code-action-menu-container", style: { ...position }, children: [
|
|
5020
|
-
/* @__PURE__ */ jsx86("div", { className: "code-highlight-language", children: codeFriendlyName }),
|
|
5019
|
+
return /* @__PURE__ */ jsx86(Fragment2, { children: isShown ? /* @__PURE__ */ jsxs65("div", { className: "c-rte-code-action-menu-container", style: { ...position }, children: [
|
|
5020
|
+
/* @__PURE__ */ jsx86("div", { className: "c-rte-code-highlight-language", children: codeFriendlyName }),
|
|
5021
5021
|
/* @__PURE__ */ jsx86(CopyButton, { editor, getCodeDOMNode }),
|
|
5022
5022
|
canBePrettier(normalizedLang) ? /* @__PURE__ */ jsx86(PrettierButton, { editor, getCodeDOMNode, lang: normalizedLang }) : null
|
|
5023
5023
|
] }) : null });
|
|
@@ -5026,7 +5026,7 @@ function getMouseInfo(event) {
|
|
|
5026
5026
|
const target = event.target;
|
|
5027
5027
|
if (target && target instanceof HTMLElement) {
|
|
5028
5028
|
const codeDOMNode = target.closest("code.CrystallizeRTEditorTheme__code");
|
|
5029
|
-
const isOutside = !(codeDOMNode || target.closest("div.code-action-menu-container"));
|
|
5029
|
+
const isOutside = !(codeDOMNode || target.closest("div.c-rte-code-action-menu-container"));
|
|
5030
5030
|
return { codeDOMNode, isOutside };
|
|
5031
5031
|
} else {
|
|
5032
5032
|
return { codeDOMNode: null, isOutside: true };
|
|
@@ -5050,8 +5050,42 @@ function CodeHighlightPlugin() {
|
|
|
5050
5050
|
return null;
|
|
5051
5051
|
}
|
|
5052
5052
|
|
|
5053
|
+
// src/rich-text-editor/plugins/DimensionsDetectorPlugin/index.tsx
|
|
5054
|
+
import { useEffect as useEffect3, useRef as useRef2, useState as useState4 } from "react";
|
|
5055
|
+
import { jsx as jsx87 } from "react/jsx-runtime";
|
|
5056
|
+
function DimensionDetectorPlugin({ onChange }) {
|
|
5057
|
+
const [dimensions, setDimensions] = useState4();
|
|
5058
|
+
const ref = useRef2(null);
|
|
5059
|
+
useEffect3(() => {
|
|
5060
|
+
if (ref.current) {
|
|
5061
|
+
const el = ref.current;
|
|
5062
|
+
const resizeObserver = new ResizeObserver((entries) => {
|
|
5063
|
+
const [first] = entries;
|
|
5064
|
+
if (first) {
|
|
5065
|
+
const [contentBox] = first.contentBoxSize;
|
|
5066
|
+
if (contentBox) {
|
|
5067
|
+
const width = contentBox.inlineSize;
|
|
5068
|
+
setDimensions({
|
|
5069
|
+
width,
|
|
5070
|
+
isSmallWidth: width < 600
|
|
5071
|
+
});
|
|
5072
|
+
}
|
|
5073
|
+
}
|
|
5074
|
+
});
|
|
5075
|
+
resizeObserver.observe(el);
|
|
5076
|
+
return () => resizeObserver.disconnect();
|
|
5077
|
+
}
|
|
5078
|
+
}, []);
|
|
5079
|
+
useEffect3(() => {
|
|
5080
|
+
if (dimensions) {
|
|
5081
|
+
onChange(dimensions);
|
|
5082
|
+
}
|
|
5083
|
+
}, [dimensions, onChange]);
|
|
5084
|
+
return /* @__PURE__ */ jsx87("div", { ref, style: { height: 1, marginTop: -1 } });
|
|
5085
|
+
}
|
|
5086
|
+
|
|
5053
5087
|
// src/rich-text-editor/plugins/FloatingLinkEditorPlugin/index.tsx
|
|
5054
|
-
import { useCallback, useEffect as
|
|
5088
|
+
import { useCallback, useEffect as useEffect5, useRef as useRef3, useState as useState6 } from "react";
|
|
5055
5089
|
import "react";
|
|
5056
5090
|
import {
|
|
5057
5091
|
$getSelection as $getSelection3,
|
|
@@ -5068,10 +5102,10 @@ import { useLexicalComposerContext as useLexicalComposerContext4 } from "@lexica
|
|
|
5068
5102
|
import { $findMatchingParent, mergeRegister } from "@lexical/utils";
|
|
5069
5103
|
|
|
5070
5104
|
// src/rich-text-editor/ui/LinkPreview.tsx
|
|
5071
|
-
import { Suspense, useEffect as
|
|
5105
|
+
import { Suspense, useEffect as useEffect4, useState as useState5 } from "react";
|
|
5072
5106
|
import { $getSelection as $getSelection2, $isTextNode as $isTextNode3 } from "lexical";
|
|
5073
5107
|
import { useLexicalComposerContext as useLexicalComposerContext3 } from "@lexical/react/LexicalComposerContext";
|
|
5074
|
-
import { Fragment as Fragment3, jsx as
|
|
5108
|
+
import { Fragment as Fragment3, jsx as jsx88, jsxs as jsxs66 } from "react/jsx-runtime";
|
|
5075
5109
|
var PREVIEW_CACHE = {};
|
|
5076
5110
|
var URL_MATCHER2 = /((https?:\/\/(www\.)?)|(www\.))[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)/;
|
|
5077
5111
|
function useSuspenseRequest(url) {
|
|
@@ -5095,12 +5129,12 @@ function useSuspenseRequest(url) {
|
|
|
5095
5129
|
function LinkPreviewContent({
|
|
5096
5130
|
url
|
|
5097
5131
|
}) {
|
|
5098
|
-
const [textContent, setTextContent] =
|
|
5132
|
+
const [textContent, setTextContent] = useState5("");
|
|
5099
5133
|
const { preview } = useSuspenseRequest(url);
|
|
5100
5134
|
const [editor] = useLexicalComposerContext3();
|
|
5101
5135
|
const tr = useTr();
|
|
5102
5136
|
const hasPreview = preview !== null && preview.google?.title;
|
|
5103
|
-
|
|
5137
|
+
useEffect4(() => {
|
|
5104
5138
|
editor.update(() => {
|
|
5105
5139
|
const sel = $getSelection2();
|
|
5106
5140
|
const nodes = sel?.getNodes();
|
|
@@ -5128,18 +5162,18 @@ function LinkPreviewContent({
|
|
|
5128
5162
|
if (!hasPreview) {
|
|
5129
5163
|
return null;
|
|
5130
5164
|
}
|
|
5131
|
-
return /* @__PURE__ */ jsxs66("div", { className: "
|
|
5132
|
-
preview.google.image && /* @__PURE__ */
|
|
5133
|
-
preview.google.title && /* @__PURE__ */
|
|
5134
|
-
preview.google.description && /* @__PURE__ */
|
|
5135
|
-
textContent && textContent !== preview.google.title ? /* @__PURE__ */
|
|
5165
|
+
return /* @__PURE__ */ jsxs66("div", { className: "c-rte-link-preview", children: [
|
|
5166
|
+
preview.google.image && /* @__PURE__ */ jsx88("div", { className: "c-rte-link-preview-image-wrapper", children: /* @__PURE__ */ jsx88("img", { src: preview.google.image, alt: preview.google.title, className: "c-rte-link-preview-image" }) }),
|
|
5167
|
+
preview.google.title && /* @__PURE__ */ jsx88("div", { className: "c-rte-link-preview-title", children: preview.google.title }),
|
|
5168
|
+
preview.google.description && /* @__PURE__ */ jsx88("div", { className: "c-rte-link-preview-description", children: preview.google.description }),
|
|
5169
|
+
textContent && textContent !== preview.google.title ? /* @__PURE__ */ jsx88(Button, { className: "c-rte-link-preview__replace-text-btn", onClick: useTitleForText, children: tr("linkPreviewReplaceTextWithTitle") }) : null
|
|
5136
5170
|
] });
|
|
5137
5171
|
}
|
|
5138
5172
|
function Glimmer(props) {
|
|
5139
|
-
return /* @__PURE__ */
|
|
5173
|
+
return /* @__PURE__ */ jsx88(
|
|
5140
5174
|
"div",
|
|
5141
5175
|
{
|
|
5142
|
-
className: "
|
|
5176
|
+
className: "c-rte-link-preview-glimmer",
|
|
5143
5177
|
...props,
|
|
5144
5178
|
style: {
|
|
5145
5179
|
animationDelay: String((props.index || 0) * 300),
|
|
@@ -5151,22 +5185,21 @@ function Glimmer(props) {
|
|
|
5151
5185
|
function LinkPreview({
|
|
5152
5186
|
url
|
|
5153
5187
|
}) {
|
|
5154
|
-
return /* @__PURE__ */
|
|
5188
|
+
return /* @__PURE__ */ jsx88(
|
|
5155
5189
|
Suspense,
|
|
5156
5190
|
{
|
|
5157
5191
|
fallback: /* @__PURE__ */ jsxs66(Fragment3, { children: [
|
|
5158
|
-
/* @__PURE__ */
|
|
5159
|
-
/* @__PURE__ */
|
|
5160
|
-
/* @__PURE__ */
|
|
5192
|
+
/* @__PURE__ */ jsx88(Glimmer, { style: { height: "80px" }, index: 0 }),
|
|
5193
|
+
/* @__PURE__ */ jsx88(Glimmer, { style: { width: "60%" }, index: 1 }),
|
|
5194
|
+
/* @__PURE__ */ jsx88(Glimmer, { style: { width: "80%" }, index: 2 })
|
|
5161
5195
|
] }),
|
|
5162
|
-
children: /* @__PURE__ */
|
|
5196
|
+
children: /* @__PURE__ */ jsx88(LinkPreviewContent, { url })
|
|
5163
5197
|
}
|
|
5164
5198
|
);
|
|
5165
5199
|
}
|
|
5166
5200
|
|
|
5167
5201
|
// src/rich-text-editor/utils/getSelectedNode.ts
|
|
5168
5202
|
import { $isAtNodeEnd } from "@lexical/selection";
|
|
5169
|
-
import "lexical";
|
|
5170
5203
|
function getSelectedNode(selection) {
|
|
5171
5204
|
const anchor = selection.anchor;
|
|
5172
5205
|
const focus = selection.focus;
|
|
@@ -5227,20 +5260,20 @@ function validateUrl(url) {
|
|
|
5227
5260
|
}
|
|
5228
5261
|
|
|
5229
5262
|
// src/rich-text-editor/plugins/FloatingLinkEditorPlugin/index.tsx
|
|
5230
|
-
import { Fragment as Fragment4, jsx as
|
|
5263
|
+
import { Fragment as Fragment4, jsx as jsx89, jsxs as jsxs67 } from "react/jsx-runtime";
|
|
5231
5264
|
function FloatingLinkEditor({
|
|
5232
5265
|
editor,
|
|
5233
5266
|
isLink,
|
|
5234
5267
|
setIsLink,
|
|
5235
5268
|
anchorElem
|
|
5236
5269
|
}) {
|
|
5237
|
-
const editorRef =
|
|
5238
|
-
const inputRef =
|
|
5239
|
-
const [linkUrl, setLinkUrl] =
|
|
5240
|
-
const [rel, setRel] =
|
|
5241
|
-
const [target, setTarget] =
|
|
5242
|
-
const [isEditMode, setEditMode] =
|
|
5243
|
-
const [lastSelection, setLastSelection] =
|
|
5270
|
+
const editorRef = useRef3(null);
|
|
5271
|
+
const inputRef = useRef3(null);
|
|
5272
|
+
const [linkUrl, setLinkUrl] = useState6("");
|
|
5273
|
+
const [rel, setRel] = useState6(null);
|
|
5274
|
+
const [target, setTarget] = useState6(null);
|
|
5275
|
+
const [isEditMode, setEditMode] = useState6(false);
|
|
5276
|
+
const [lastSelection, setLastSelection] = useState6(null);
|
|
5244
5277
|
const tr = useTr();
|
|
5245
5278
|
const updateLinkEditor = useCallback(() => {
|
|
5246
5279
|
const selection = $getSelection3();
|
|
@@ -5292,7 +5325,7 @@ function FloatingLinkEditor({
|
|
|
5292
5325
|
}
|
|
5293
5326
|
return true;
|
|
5294
5327
|
}, [anchorElem, editor]);
|
|
5295
|
-
|
|
5328
|
+
useEffect5(() => {
|
|
5296
5329
|
const scrollerElem = anchorElem.parentElement;
|
|
5297
5330
|
const update = () => {
|
|
5298
5331
|
editor.getEditorState().read(() => {
|
|
@@ -5310,7 +5343,7 @@ function FloatingLinkEditor({
|
|
|
5310
5343
|
}
|
|
5311
5344
|
};
|
|
5312
5345
|
}, [anchorElem.parentElement, editor, updateLinkEditor]);
|
|
5313
|
-
|
|
5346
|
+
useEffect5(() => {
|
|
5314
5347
|
return mergeRegister(
|
|
5315
5348
|
editor.registerUpdateListener(({ editorState }) => {
|
|
5316
5349
|
editorState.read(() => {
|
|
@@ -5338,18 +5371,18 @@ function FloatingLinkEditor({
|
|
|
5338
5371
|
)
|
|
5339
5372
|
);
|
|
5340
5373
|
}, [editor, updateLinkEditor, setIsLink, isLink]);
|
|
5341
|
-
|
|
5374
|
+
useEffect5(() => {
|
|
5342
5375
|
editor.getEditorState().read(() => {
|
|
5343
5376
|
updateLinkEditor();
|
|
5344
5377
|
});
|
|
5345
5378
|
}, [editor, updateLinkEditor]);
|
|
5346
|
-
|
|
5379
|
+
useEffect5(() => {
|
|
5347
5380
|
if (isEditMode && inputRef.current) {
|
|
5348
5381
|
inputRef.current.focus();
|
|
5349
5382
|
}
|
|
5350
5383
|
}, [isEditMode]);
|
|
5351
|
-
return /* @__PURE__ */
|
|
5352
|
-
/* @__PURE__ */
|
|
5384
|
+
return /* @__PURE__ */ jsx89("div", { ref: editorRef, className: "c-rte-link-editor", children: isEditMode ? /* @__PURE__ */ jsxs67("div", { children: [
|
|
5385
|
+
/* @__PURE__ */ jsx89("div", { className: "c-rte-link-editor-input-group", children: /* @__PURE__ */ jsx89(
|
|
5353
5386
|
InputWithLabel,
|
|
5354
5387
|
{
|
|
5355
5388
|
label: tr("linkEditorLink"),
|
|
@@ -5358,7 +5391,7 @@ function FloatingLinkEditor({
|
|
|
5358
5391
|
onChange: (e) => setLinkUrl(e.target.value)
|
|
5359
5392
|
}
|
|
5360
5393
|
) }),
|
|
5361
|
-
/* @__PURE__ */
|
|
5394
|
+
/* @__PURE__ */ jsx89("div", { className: "c-rte-link-editor-input-group", children: /* @__PURE__ */ jsx89(
|
|
5362
5395
|
InputWithLabel,
|
|
5363
5396
|
{
|
|
5364
5397
|
label: tr("linkEditorRel"),
|
|
@@ -5367,7 +5400,7 @@ function FloatingLinkEditor({
|
|
|
5367
5400
|
onChange: (e) => setRel(e.target.value)
|
|
5368
5401
|
}
|
|
5369
5402
|
) }),
|
|
5370
|
-
/* @__PURE__ */
|
|
5403
|
+
/* @__PURE__ */ jsx89("div", { className: "c-rte-link-editor-input-group", children: /* @__PURE__ */ jsx89(
|
|
5371
5404
|
InputWithLabel,
|
|
5372
5405
|
{
|
|
5373
5406
|
label: tr("linkEditorTarget"),
|
|
@@ -5376,7 +5409,7 @@ function FloatingLinkEditor({
|
|
|
5376
5409
|
onChange: (e) => setTarget(e.target.value)
|
|
5377
5410
|
}
|
|
5378
5411
|
) }),
|
|
5379
|
-
/* @__PURE__ */
|
|
5412
|
+
/* @__PURE__ */ jsx89("div", { className: "c-rte-link-editor-button-wrap", children: /* @__PURE__ */ jsx89(
|
|
5380
5413
|
Button,
|
|
5381
5414
|
{
|
|
5382
5415
|
onClick: () => {
|
|
@@ -5395,15 +5428,15 @@ function FloatingLinkEditor({
|
|
|
5395
5428
|
}
|
|
5396
5429
|
) })
|
|
5397
5430
|
] }) : /* @__PURE__ */ jsxs67(Fragment4, { children: [
|
|
5398
|
-
/* @__PURE__ */ jsxs67("div", { className: "
|
|
5399
|
-
/* @__PURE__ */ jsxs67("div", { className: "
|
|
5400
|
-
/* @__PURE__ */
|
|
5401
|
-
rel || target ? /* @__PURE__ */ jsxs67("div", { className: "
|
|
5402
|
-
rel && /* @__PURE__ */
|
|
5403
|
-
target && /* @__PURE__ */
|
|
5431
|
+
/* @__PURE__ */ jsxs67("div", { className: "c-rte-link-editor-link-input", children: [
|
|
5432
|
+
/* @__PURE__ */ jsxs67("div", { className: "c-rte-link-editor-link-preview", children: [
|
|
5433
|
+
/* @__PURE__ */ jsx89("a", { href: linkUrl, target: "_blank", rel: "noopener noreferrer", children: linkUrl }),
|
|
5434
|
+
rel || target ? /* @__PURE__ */ jsxs67("div", { className: "c-rte-link-editor-preview-attrs", children: [
|
|
5435
|
+
rel && /* @__PURE__ */ jsx89("div", { className: "c-rte-link-editor-preview-attr", children: rel }),
|
|
5436
|
+
target && /* @__PURE__ */ jsx89("div", { className: "c-rte-link-editor-preview-attr", children: target })
|
|
5404
5437
|
] }) : null
|
|
5405
5438
|
] }),
|
|
5406
|
-
/* @__PURE__ */
|
|
5439
|
+
/* @__PURE__ */ jsx89("div", { children: /* @__PURE__ */ jsx89(
|
|
5407
5440
|
IconButton,
|
|
5408
5441
|
{
|
|
5409
5442
|
size: "sm",
|
|
@@ -5411,16 +5444,16 @@ function FloatingLinkEditor({
|
|
|
5411
5444
|
onMouseDown: (event) => event.preventDefault(),
|
|
5412
5445
|
onClick: () => setEditMode(true),
|
|
5413
5446
|
"aria-label": tr("linkEditorEdit"),
|
|
5414
|
-
children: /* @__PURE__ */
|
|
5447
|
+
children: /* @__PURE__ */ jsx89(Icon.Edit, {})
|
|
5415
5448
|
}
|
|
5416
5449
|
) })
|
|
5417
5450
|
] }),
|
|
5418
|
-
/* @__PURE__ */
|
|
5451
|
+
/* @__PURE__ */ jsx89("div", { children: /* @__PURE__ */ jsx89(LinkPreview, { url: linkUrl }) })
|
|
5419
5452
|
] }) });
|
|
5420
5453
|
}
|
|
5421
5454
|
function useFloatingLinkEditorToolbar(editor, anchorElem) {
|
|
5422
|
-
const [activeEditor, setActiveEditor] =
|
|
5423
|
-
const [isLink, setIsLink] =
|
|
5455
|
+
const [activeEditor, setActiveEditor] = useState6(editor);
|
|
5456
|
+
const [isLink, setIsLink] = useState6(false);
|
|
5424
5457
|
const updateToolbar = useCallback(() => {
|
|
5425
5458
|
const selection = $getSelection3();
|
|
5426
5459
|
if ($isRangeSelection(selection)) {
|
|
@@ -5434,7 +5467,7 @@ function useFloatingLinkEditorToolbar(editor, anchorElem) {
|
|
|
5434
5467
|
}
|
|
5435
5468
|
}
|
|
5436
5469
|
}, []);
|
|
5437
|
-
|
|
5470
|
+
useEffect5(() => {
|
|
5438
5471
|
return editor.registerCommand(
|
|
5439
5472
|
SELECTION_CHANGE_COMMAND,
|
|
5440
5473
|
(_payload, newEditor) => {
|
|
@@ -5446,7 +5479,7 @@ function useFloatingLinkEditorToolbar(editor, anchorElem) {
|
|
|
5446
5479
|
);
|
|
5447
5480
|
}, [editor, updateToolbar]);
|
|
5448
5481
|
return isLink ? createPortal2(
|
|
5449
|
-
/* @__PURE__ */
|
|
5482
|
+
/* @__PURE__ */ jsx89(FloatingLinkEditor, { editor: activeEditor, isLink, anchorElem, setIsLink }),
|
|
5450
5483
|
anchorElem
|
|
5451
5484
|
) : null;
|
|
5452
5485
|
}
|
|
@@ -5458,7 +5491,7 @@ function FloatingLinkEditorPlugin({
|
|
|
5458
5491
|
}
|
|
5459
5492
|
|
|
5460
5493
|
// src/rich-text-editor/plugins/FloatingTextFormatToolbarPlugin/index.tsx
|
|
5461
|
-
import { useCallback as useCallback2, useEffect as
|
|
5494
|
+
import { useCallback as useCallback2, useEffect as useEffect6, useRef as useRef4, useState as useState7 } from "react";
|
|
5462
5495
|
import "react";
|
|
5463
5496
|
import {
|
|
5464
5497
|
$getSelection as $getSelection4,
|
|
@@ -5507,7 +5540,7 @@ function getDOMRangeRect(nativeSelection, rootElement) {
|
|
|
5507
5540
|
}
|
|
5508
5541
|
|
|
5509
5542
|
// src/rich-text-editor/plugins/FloatingTextFormatToolbarPlugin/index.tsx
|
|
5510
|
-
import { Fragment as Fragment5, jsx as
|
|
5543
|
+
import { Fragment as Fragment5, jsx as jsx90, jsxs as jsxs68 } from "react/jsx-runtime";
|
|
5511
5544
|
function TextFormatFloatingToolbar({
|
|
5512
5545
|
editor,
|
|
5513
5546
|
anchorElem,
|
|
@@ -5520,7 +5553,7 @@ function TextFormatFloatingToolbar({
|
|
|
5520
5553
|
isSubscript,
|
|
5521
5554
|
isSuperscript
|
|
5522
5555
|
}) {
|
|
5523
|
-
const popupCharStylesEditorRef =
|
|
5556
|
+
const popupCharStylesEditorRef = useRef4(null);
|
|
5524
5557
|
const tr = useTr();
|
|
5525
5558
|
const insertLink = useCallback2(() => {
|
|
5526
5559
|
if (!isLink) {
|
|
@@ -5542,7 +5575,7 @@ function TextFormatFloatingToolbar({
|
|
|
5542
5575
|
setFloatingElemPosition(rangeRect, popupCharStylesEditorElem, anchorElem);
|
|
5543
5576
|
}
|
|
5544
5577
|
}, [editor, anchorElem]);
|
|
5545
|
-
|
|
5578
|
+
useEffect6(() => {
|
|
5546
5579
|
const scrollerElem = anchorElem.parentElement;
|
|
5547
5580
|
const update = () => {
|
|
5548
5581
|
editor.getEditorState().read(() => {
|
|
@@ -5560,7 +5593,7 @@ function TextFormatFloatingToolbar({
|
|
|
5560
5593
|
}
|
|
5561
5594
|
};
|
|
5562
5595
|
}, [editor, updateTextFormatFloatingToolbar, anchorElem]);
|
|
5563
|
-
|
|
5596
|
+
useEffect6(() => {
|
|
5564
5597
|
editor.getEditorState().read(() => {
|
|
5565
5598
|
updateTextFormatFloatingToolbar();
|
|
5566
5599
|
});
|
|
@@ -5580,8 +5613,8 @@ function TextFormatFloatingToolbar({
|
|
|
5580
5613
|
)
|
|
5581
5614
|
);
|
|
5582
5615
|
}, [editor, updateTextFormatFloatingToolbar]);
|
|
5583
|
-
return /* @__PURE__ */
|
|
5584
|
-
/* @__PURE__ */
|
|
5616
|
+
return /* @__PURE__ */ jsx90("div", { ref: popupCharStylesEditorRef, className: "c-rte-floating-text-format-tb-plugin", children: editor.isEditable() && /* @__PURE__ */ jsxs68(Fragment5, { children: [
|
|
5617
|
+
/* @__PURE__ */ jsx90(
|
|
5585
5618
|
IconButton,
|
|
5586
5619
|
{
|
|
5587
5620
|
onClick: () => {
|
|
@@ -5590,15 +5623,15 @@ function TextFormatFloatingToolbar({
|
|
|
5590
5623
|
style: { padding: 0, overflow: "hidden" },
|
|
5591
5624
|
title: tr(IS_APPLE ? "actionFormatAsStrongTitleApple" : "actionFormatAsStrongTitle"),
|
|
5592
5625
|
"aria-label": tr("actionFormatAsStrongLabel"),
|
|
5593
|
-
children: /* @__PURE__ */
|
|
5626
|
+
children: /* @__PURE__ */ jsx90(
|
|
5594
5627
|
"i",
|
|
5595
5628
|
{
|
|
5596
|
-
className: `
|
|
5629
|
+
className: `c-rte-icon-bold c-rte-floating-text-format-tb-plugin__format-icon ${isBold ? "selected" : ""}`
|
|
5597
5630
|
}
|
|
5598
5631
|
)
|
|
5599
5632
|
}
|
|
5600
5633
|
),
|
|
5601
|
-
/* @__PURE__ */
|
|
5634
|
+
/* @__PURE__ */ jsx90(
|
|
5602
5635
|
IconButton,
|
|
5603
5636
|
{
|
|
5604
5637
|
style: { padding: 0, overflow: "hidden" },
|
|
@@ -5607,15 +5640,15 @@ function TextFormatFloatingToolbar({
|
|
|
5607
5640
|
},
|
|
5608
5641
|
title: tr("actionFormatAsEmphasizedTitle"),
|
|
5609
5642
|
"aria-label": tr("actionFormatAsEmphasizedLabel"),
|
|
5610
|
-
children: /* @__PURE__ */
|
|
5643
|
+
children: /* @__PURE__ */ jsx90(
|
|
5611
5644
|
"i",
|
|
5612
5645
|
{
|
|
5613
|
-
className: `
|
|
5646
|
+
className: `c-rte-icon-italic c-rte-floating-text-format-tb-plugin__format-icon ${isItalic ? "selected" : ""}`
|
|
5614
5647
|
}
|
|
5615
5648
|
)
|
|
5616
5649
|
}
|
|
5617
5650
|
),
|
|
5618
|
-
/* @__PURE__ */
|
|
5651
|
+
/* @__PURE__ */ jsx90(
|
|
5619
5652
|
IconButton,
|
|
5620
5653
|
{
|
|
5621
5654
|
style: { padding: 0, overflow: "hidden" },
|
|
@@ -5624,15 +5657,15 @@ function TextFormatFloatingToolbar({
|
|
|
5624
5657
|
},
|
|
5625
5658
|
title: tr("actionFormatAsUnderlinedTitle"),
|
|
5626
5659
|
"aria-label": tr("actionFormatAsUnderlinedLabel"),
|
|
5627
|
-
children: /* @__PURE__ */
|
|
5660
|
+
children: /* @__PURE__ */ jsx90(
|
|
5628
5661
|
"i",
|
|
5629
5662
|
{
|
|
5630
|
-
className: `
|
|
5663
|
+
className: `c-rte-icon-underline c-rte-floating-text-format-tb-plugin__format-icon ${isUnderline ? "selected" : ""}`
|
|
5631
5664
|
}
|
|
5632
5665
|
)
|
|
5633
5666
|
}
|
|
5634
5667
|
),
|
|
5635
|
-
/* @__PURE__ */
|
|
5668
|
+
/* @__PURE__ */ jsx90(
|
|
5636
5669
|
IconButton,
|
|
5637
5670
|
{
|
|
5638
5671
|
style: { padding: 0, overflow: "hidden" },
|
|
@@ -5641,15 +5674,15 @@ function TextFormatFloatingToolbar({
|
|
|
5641
5674
|
},
|
|
5642
5675
|
title: tr("actionFormatWithStrikethroughTitle"),
|
|
5643
5676
|
"aria-label": tr("actionFormatWithStrikethroughLabel"),
|
|
5644
|
-
children: /* @__PURE__ */
|
|
5677
|
+
children: /* @__PURE__ */ jsx90(
|
|
5645
5678
|
"i",
|
|
5646
5679
|
{
|
|
5647
|
-
className: `
|
|
5680
|
+
className: `c-rte-icon-strikethrough c-rte-floating-text-format-tb-plugin__format-icon ${isStrikethrough ? "selected" : ""}`
|
|
5648
5681
|
}
|
|
5649
5682
|
)
|
|
5650
5683
|
}
|
|
5651
5684
|
),
|
|
5652
|
-
/* @__PURE__ */
|
|
5685
|
+
/* @__PURE__ */ jsx90(
|
|
5653
5686
|
IconButton,
|
|
5654
5687
|
{
|
|
5655
5688
|
style: { padding: 0, overflow: "hidden" },
|
|
@@ -5658,15 +5691,15 @@ function TextFormatFloatingToolbar({
|
|
|
5658
5691
|
},
|
|
5659
5692
|
title: tr("actionFormatWithSubscriptTitle"),
|
|
5660
5693
|
"aria-label": tr("actionFormatWithSubscriptLabel"),
|
|
5661
|
-
children: /* @__PURE__ */
|
|
5694
|
+
children: /* @__PURE__ */ jsx90(
|
|
5662
5695
|
"i",
|
|
5663
5696
|
{
|
|
5664
|
-
className: `
|
|
5697
|
+
className: `c-rte-icon-subscript c-rte-floating-text-format-tb-plugin__format-icon ${isSubscript ? "selected" : ""}`
|
|
5665
5698
|
}
|
|
5666
5699
|
)
|
|
5667
5700
|
}
|
|
5668
5701
|
),
|
|
5669
|
-
/* @__PURE__ */
|
|
5702
|
+
/* @__PURE__ */ jsx90(
|
|
5670
5703
|
IconButton,
|
|
5671
5704
|
{
|
|
5672
5705
|
style: { padding: 0, overflow: "hidden" },
|
|
@@ -5675,15 +5708,15 @@ function TextFormatFloatingToolbar({
|
|
|
5675
5708
|
},
|
|
5676
5709
|
title: tr("actionFormatWithSuperscriptTitle"),
|
|
5677
5710
|
"aria-label": tr("actionFormatWithSuperscriptLabel"),
|
|
5678
|
-
children: /* @__PURE__ */
|
|
5711
|
+
children: /* @__PURE__ */ jsx90(
|
|
5679
5712
|
"i",
|
|
5680
5713
|
{
|
|
5681
|
-
className: `
|
|
5714
|
+
className: `c-rte-icon-superscript c-rte-floating-text-format-tb-plugin__format-icon ${isSuperscript ? "selected" : ""}`
|
|
5682
5715
|
}
|
|
5683
5716
|
)
|
|
5684
5717
|
}
|
|
5685
5718
|
),
|
|
5686
|
-
/* @__PURE__ */
|
|
5719
|
+
/* @__PURE__ */ jsx90(
|
|
5687
5720
|
IconButton,
|
|
5688
5721
|
{
|
|
5689
5722
|
style: { padding: 0, overflow: "hidden" },
|
|
@@ -5691,24 +5724,24 @@ function TextFormatFloatingToolbar({
|
|
|
5691
5724
|
editor.dispatchCommand(FORMAT_TEXT_COMMAND, "code");
|
|
5692
5725
|
},
|
|
5693
5726
|
"aria-label": tr("actionInsertCodeBlock"),
|
|
5694
|
-
children: /* @__PURE__ */
|
|
5727
|
+
children: /* @__PURE__ */ jsx90(
|
|
5695
5728
|
"i",
|
|
5696
5729
|
{
|
|
5697
|
-
className: `
|
|
5730
|
+
className: `c-rte-icon-code c-rte-floating-text-format-tb-plugin__format-icon ${isCode ? "selected" : ""}`
|
|
5698
5731
|
}
|
|
5699
5732
|
)
|
|
5700
5733
|
}
|
|
5701
5734
|
),
|
|
5702
|
-
/* @__PURE__ */
|
|
5735
|
+
/* @__PURE__ */ jsx90(
|
|
5703
5736
|
IconButton,
|
|
5704
5737
|
{
|
|
5705
5738
|
style: { padding: 0, overflow: "hidden" },
|
|
5706
5739
|
onClick: insertLink,
|
|
5707
5740
|
"aria-label": tr("actionInsertlink"),
|
|
5708
|
-
children: /* @__PURE__ */
|
|
5741
|
+
children: /* @__PURE__ */ jsx90(
|
|
5709
5742
|
"i",
|
|
5710
5743
|
{
|
|
5711
|
-
className: `
|
|
5744
|
+
className: `c-rte-icon-link c-rte-floating-text-format-tb-plugin__format-icon ${isLink ? "selected" : ""}`
|
|
5712
5745
|
}
|
|
5713
5746
|
)
|
|
5714
5747
|
}
|
|
@@ -5716,15 +5749,15 @@ function TextFormatFloatingToolbar({
|
|
|
5716
5749
|
] }) });
|
|
5717
5750
|
}
|
|
5718
5751
|
function useFloatingTextFormatToolbar(editor, anchorElem) {
|
|
5719
|
-
const [isText, setIsText] =
|
|
5720
|
-
const [isLink, setIsLink] =
|
|
5721
|
-
const [isBold, setIsBold] =
|
|
5722
|
-
const [isItalic, setIsItalic] =
|
|
5723
|
-
const [isUnderline, setIsUnderline] =
|
|
5724
|
-
const [isStrikethrough, setIsStrikethrough] =
|
|
5725
|
-
const [isSubscript, setIsSubscript] =
|
|
5726
|
-
const [isSuperscript, setIsSuperscript] =
|
|
5727
|
-
const [isCode, setIsCode] =
|
|
5752
|
+
const [isText, setIsText] = useState7(false);
|
|
5753
|
+
const [isLink, setIsLink] = useState7(false);
|
|
5754
|
+
const [isBold, setIsBold] = useState7(false);
|
|
5755
|
+
const [isItalic, setIsItalic] = useState7(false);
|
|
5756
|
+
const [isUnderline, setIsUnderline] = useState7(false);
|
|
5757
|
+
const [isStrikethrough, setIsStrikethrough] = useState7(false);
|
|
5758
|
+
const [isSubscript, setIsSubscript] = useState7(false);
|
|
5759
|
+
const [isSuperscript, setIsSuperscript] = useState7(false);
|
|
5760
|
+
const [isCode, setIsCode] = useState7(false);
|
|
5728
5761
|
const updatePopup = useCallback2(() => {
|
|
5729
5762
|
editor.getEditorState().read(() => {
|
|
5730
5763
|
if (editor.isComposing()) {
|
|
@@ -5761,13 +5794,13 @@ function useFloatingTextFormatToolbar(editor, anchorElem) {
|
|
|
5761
5794
|
}
|
|
5762
5795
|
});
|
|
5763
5796
|
}, [editor]);
|
|
5764
|
-
|
|
5797
|
+
useEffect6(() => {
|
|
5765
5798
|
document.addEventListener("selectionchange", updatePopup);
|
|
5766
5799
|
return () => {
|
|
5767
5800
|
document.removeEventListener("selectionchange", updatePopup);
|
|
5768
5801
|
};
|
|
5769
5802
|
}, [updatePopup]);
|
|
5770
|
-
|
|
5803
|
+
useEffect6(() => {
|
|
5771
5804
|
return mergeRegister2(
|
|
5772
5805
|
editor.registerUpdateListener(() => {
|
|
5773
5806
|
updatePopup();
|
|
@@ -5783,7 +5816,7 @@ function useFloatingTextFormatToolbar(editor, anchorElem) {
|
|
|
5783
5816
|
return null;
|
|
5784
5817
|
}
|
|
5785
5818
|
return createPortal3(
|
|
5786
|
-
/* @__PURE__ */
|
|
5819
|
+
/* @__PURE__ */ jsx90(
|
|
5787
5820
|
TextFormatFloatingToolbar,
|
|
5788
5821
|
{
|
|
5789
5822
|
editor,
|
|
@@ -5809,16 +5842,15 @@ function FloatingTextFormatToolbarPlugin({
|
|
|
5809
5842
|
}
|
|
5810
5843
|
|
|
5811
5844
|
// src/rich-text-editor/plugins/LinkPlugin/index.tsx
|
|
5812
|
-
import { LinkPlugin as LexicalLinkPlugin } from "@lexical/react/LexicalLinkPlugin";
|
|
5813
5845
|
import "react";
|
|
5814
|
-
import {
|
|
5846
|
+
import { LinkPlugin as LexicalLinkPlugin } from "@lexical/react/LexicalLinkPlugin";
|
|
5847
|
+
import { jsx as jsx91 } from "react/jsx-runtime";
|
|
5815
5848
|
function LinkPlugin() {
|
|
5816
|
-
return /* @__PURE__ */
|
|
5849
|
+
return /* @__PURE__ */ jsx91(LexicalLinkPlugin, { validateUrl });
|
|
5817
5850
|
}
|
|
5818
5851
|
|
|
5819
5852
|
// src/rich-text-editor/plugins/ListMaxIndentLevelPlugin/index.ts
|
|
5820
|
-
import {
|
|
5821
|
-
import { useLexicalComposerContext as useLexicalComposerContext6 } from "@lexical/react/LexicalComposerContext";
|
|
5853
|
+
import { useEffect as useEffect7 } from "react";
|
|
5822
5854
|
import {
|
|
5823
5855
|
$getSelection as $getSelection5,
|
|
5824
5856
|
$isElementNode as $isElementNode2,
|
|
@@ -5826,18 +5858,14 @@ import {
|
|
|
5826
5858
|
COMMAND_PRIORITY_CRITICAL as COMMAND_PRIORITY_CRITICAL2,
|
|
5827
5859
|
INDENT_CONTENT_COMMAND
|
|
5828
5860
|
} from "lexical";
|
|
5829
|
-
import {
|
|
5861
|
+
import { $getListDepth, $isListItemNode as $isListItemNode2, $isListNode as $isListNode2 } from "@lexical/list";
|
|
5862
|
+
import { useLexicalComposerContext as useLexicalComposerContext6 } from "@lexical/react/LexicalComposerContext";
|
|
5830
5863
|
function getElementNodesInSelection(selection) {
|
|
5831
5864
|
const nodesInSelection = selection.getNodes();
|
|
5832
5865
|
if (nodesInSelection.length === 0) {
|
|
5833
|
-
return /* @__PURE__ */ new Set([
|
|
5834
|
-
selection.anchor.getNode().getParentOrThrow(),
|
|
5835
|
-
selection.focus.getNode().getParentOrThrow()
|
|
5836
|
-
]);
|
|
5866
|
+
return /* @__PURE__ */ new Set([selection.anchor.getNode().getParentOrThrow(), selection.focus.getNode().getParentOrThrow()]);
|
|
5837
5867
|
}
|
|
5838
|
-
return new Set(
|
|
5839
|
-
nodesInSelection.map((n) => $isElementNode2(n) ? n : n.getParentOrThrow())
|
|
5840
|
-
);
|
|
5868
|
+
return new Set(nodesInSelection.map((n) => $isElementNode2(n) ? n : n.getParentOrThrow()));
|
|
5841
5869
|
}
|
|
5842
5870
|
function isIndentPermitted(maxDepth) {
|
|
5843
5871
|
const selection = $getSelection5();
|
|
@@ -5852,9 +5880,7 @@ function isIndentPermitted(maxDepth) {
|
|
|
5852
5880
|
} else if ($isListItemNode2(elementNode)) {
|
|
5853
5881
|
const parent2 = elementNode.getParent();
|
|
5854
5882
|
if (!$isListNode2(parent2)) {
|
|
5855
|
-
throw new Error(
|
|
5856
|
-
"ListMaxIndentLevelPlugin: A ListItemNode must have a ListNode for a parent."
|
|
5857
|
-
);
|
|
5883
|
+
throw new Error("ListMaxIndentLevelPlugin: A ListItemNode must have a ListNode for a parent.");
|
|
5858
5884
|
}
|
|
5859
5885
|
totalDepth = Math.max($getListDepth(parent2) + 1, totalDepth);
|
|
5860
5886
|
}
|
|
@@ -5863,7 +5889,7 @@ function isIndentPermitted(maxDepth) {
|
|
|
5863
5889
|
}
|
|
5864
5890
|
function ListMaxIndentLevelPlugin({ maxDepth }) {
|
|
5865
5891
|
const [editor] = useLexicalComposerContext6();
|
|
5866
|
-
|
|
5892
|
+
useEffect7(() => {
|
|
5867
5893
|
return editor.registerCommand(
|
|
5868
5894
|
INDENT_CONTENT_COMMAND,
|
|
5869
5895
|
() => !isIndentPermitted(maxDepth ?? 7),
|
|
@@ -5874,7 +5900,7 @@ function ListMaxIndentLevelPlugin({ maxDepth }) {
|
|
|
5874
5900
|
}
|
|
5875
5901
|
|
|
5876
5902
|
// src/rich-text-editor/plugins/MaxLengthPlugin/index.tsx
|
|
5877
|
-
import { useEffect as
|
|
5903
|
+
import { useEffect as useEffect8 } from "react";
|
|
5878
5904
|
import { $getSelection as $getSelection6, $isRangeSelection as $isRangeSelection4 } from "lexical";
|
|
5879
5905
|
import { useLexicalComposerContext as useLexicalComposerContext7 } from "@lexical/react/LexicalComposerContext";
|
|
5880
5906
|
import { trimTextContentFromAnchor } from "@lexical/selection";
|
|
@@ -5916,7 +5942,7 @@ ${content}
|
|
|
5916
5942
|
// src/rich-text-editor/plugins/MaxLengthPlugin/index.tsx
|
|
5917
5943
|
function MaxLengthPlugin({ maxLength }) {
|
|
5918
5944
|
const [editor] = useLexicalComposerContext7();
|
|
5919
|
-
|
|
5945
|
+
useEffect8(() => {
|
|
5920
5946
|
let lastRestoredEditorState = null;
|
|
5921
5947
|
return editor.registerUpdateListener(({ editorState, prevEditorState }) => {
|
|
5922
5948
|
editor.update(() => {
|
|
@@ -5946,7 +5972,7 @@ function MaxLengthPlugin({ maxLength }) {
|
|
|
5946
5972
|
}
|
|
5947
5973
|
|
|
5948
5974
|
// src/rich-text-editor/plugins/TabFocusPlugin/index.tsx
|
|
5949
|
-
import { useEffect as
|
|
5975
|
+
import { useEffect as useEffect9 } from "react";
|
|
5950
5976
|
import { $getSelection as $getSelection7, $isRangeSelection as $isRangeSelection5, $setSelection as $setSelection2, FOCUS_COMMAND } from "lexical";
|
|
5951
5977
|
import { useLexicalComposerContext as useLexicalComposerContext8 } from "@lexical/react/LexicalComposerContext";
|
|
5952
5978
|
var COMMAND_PRIORITY_LOW3 = 1;
|
|
@@ -5966,7 +5992,7 @@ function registerKeyTimeStampTracker() {
|
|
|
5966
5992
|
}
|
|
5967
5993
|
function TabFocusPlugin() {
|
|
5968
5994
|
const [editor] = useLexicalComposerContext8();
|
|
5969
|
-
|
|
5995
|
+
useEffect9(() => {
|
|
5970
5996
|
if (!hasRegisteredKeyDownListener) {
|
|
5971
5997
|
registerKeyTimeStampTracker();
|
|
5972
5998
|
hasRegisteredKeyDownListener = true;
|
|
@@ -5989,7 +6015,7 @@ function TabFocusPlugin() {
|
|
|
5989
6015
|
}
|
|
5990
6016
|
|
|
5991
6017
|
// src/rich-text-editor/plugins/TableActionMenuPlugin/index.tsx
|
|
5992
|
-
import { useCallback as useCallback3, useEffect as
|
|
6018
|
+
import { useCallback as useCallback3, useEffect as useEffect10, useRef as useRef5, useState as useState8 } from "react";
|
|
5993
6019
|
import { $getRoot as $getRoot3, $getSelection as $getSelection8, $isRangeSelection as $isRangeSelection6, DEPRECATED_$isGridSelection } from "lexical";
|
|
5994
6020
|
import { createPortal as createPortal4 } from "react-dom";
|
|
5995
6021
|
import { useLexicalComposerContext as useLexicalComposerContext9 } from "@lexical/react/LexicalComposerContext";
|
|
@@ -6011,16 +6037,16 @@ import {
|
|
|
6011
6037
|
TableCellHeaderStates,
|
|
6012
6038
|
TableCellNode as TableCellNode2
|
|
6013
6039
|
} from "@lexical/table";
|
|
6014
|
-
import { Fragment as Fragment6, jsx as
|
|
6040
|
+
import { Fragment as Fragment6, jsx as jsx92, jsxs as jsxs69 } from "react/jsx-runtime";
|
|
6015
6041
|
function TableActionMenu({ tableCellNode: _tableCellNode, tableStats }) {
|
|
6016
6042
|
const [editor] = useLexicalComposerContext9();
|
|
6017
|
-
const [tableCellNode, updateTableCellNode] =
|
|
6018
|
-
const [selectionCounts, updateSelectionCounts] =
|
|
6043
|
+
const [tableCellNode, updateTableCellNode] = useState8(_tableCellNode);
|
|
6044
|
+
const [selectionCounts, updateSelectionCounts] = useState8({
|
|
6019
6045
|
columns: 1,
|
|
6020
6046
|
rows: 1
|
|
6021
6047
|
});
|
|
6022
6048
|
const tr = useTr();
|
|
6023
|
-
|
|
6049
|
+
useEffect10(() => {
|
|
6024
6050
|
return editor.registerMutationListener(TableCellNode2, (nodeMutations) => {
|
|
6025
6051
|
const nodeUpdated = nodeMutations.get(tableCellNode.getKey()) === "updated";
|
|
6026
6052
|
if (nodeUpdated) {
|
|
@@ -6030,7 +6056,7 @@ function TableActionMenu({ tableCellNode: _tableCellNode, tableStats }) {
|
|
|
6030
6056
|
}
|
|
6031
6057
|
});
|
|
6032
6058
|
}, [editor, tableCellNode]);
|
|
6033
|
-
|
|
6059
|
+
useEffect10(() => {
|
|
6034
6060
|
editor.getEditorState().read(() => {
|
|
6035
6061
|
const selection = $getSelection8();
|
|
6036
6062
|
if (DEPRECATED_$isGridSelection(selection)) {
|
|
@@ -6167,29 +6193,29 @@ function TableActionMenu({ tableCellNode: _tableCellNode, tableStats }) {
|
|
|
6167
6193
|
});
|
|
6168
6194
|
}, [editor, tableCellNode, clearTableSelection]);
|
|
6169
6195
|
return /* @__PURE__ */ jsxs69(Fragment6, { children: [
|
|
6170
|
-
/* @__PURE__ */
|
|
6171
|
-
/* @__PURE__ */
|
|
6172
|
-
/* @__PURE__ */
|
|
6173
|
-
/* @__PURE__ */
|
|
6174
|
-
/* @__PURE__ */
|
|
6196
|
+
/* @__PURE__ */ jsx92(DropdownMenu.Item, { onSelect: () => insertTableRowAtSelection(false), children: tr("actionTableInsertRowsAbove", selectionCounts.rows) }),
|
|
6197
|
+
/* @__PURE__ */ jsx92(DropdownMenu.Item, { onSelect: () => insertTableRowAtSelection(true), children: tr("actionTableInsertRowsBelow", selectionCounts.rows) }),
|
|
6198
|
+
/* @__PURE__ */ jsx92(DropdownMenu.Item, { onSelect: () => insertTableColumnAtSelection(false), children: tr("actionTableInsertColumnsBefore", selectionCounts.columns) }),
|
|
6199
|
+
/* @__PURE__ */ jsx92(DropdownMenu.Item, { onSelect: () => insertTableColumnAtSelection(true), children: tr("actionTableInsertColumnsAfter", selectionCounts.columns) }),
|
|
6200
|
+
/* @__PURE__ */ jsx92(DropdownMenu.Item, { onSelect: () => toggleTableRowIsHeader(), children: tr(
|
|
6175
6201
|
(tableCellNode.__headerState & TableCellHeaderStates.ROW) === TableCellHeaderStates.ROW ? "actionTableRemoveRowHeader" : "actionTableAddRowHeader"
|
|
6176
6202
|
) }),
|
|
6177
|
-
/* @__PURE__ */
|
|
6203
|
+
/* @__PURE__ */ jsx92(DropdownMenu.Item, { onSelect: () => toggleTableColumnIsHeader(), children: tr(
|
|
6178
6204
|
(tableCellNode.__headerState & TableCellHeaderStates.COLUMN) === TableCellHeaderStates.COLUMN ? "actionTableRemoveColumnHeader" : "actionTableAddColumnHeader"
|
|
6179
6205
|
) }),
|
|
6180
|
-
/* @__PURE__ */
|
|
6181
|
-
tableStats.columns > 1 && /* @__PURE__ */
|
|
6182
|
-
tableStats.rows > 1 && /* @__PURE__ */
|
|
6183
|
-
/* @__PURE__ */
|
|
6206
|
+
/* @__PURE__ */ jsx92(DropdownMenu.Separator, {}),
|
|
6207
|
+
tableStats.columns > 1 && /* @__PURE__ */ jsx92(DropdownMenu.Item, { onSelect: () => deleteTableColumnAtSelection(), children: tr("actionTableDeleteColumn") }),
|
|
6208
|
+
tableStats.rows > 1 && /* @__PURE__ */ jsx92(DropdownMenu.Item, { onSelect: () => deleteTableRowAtSelection(), children: tr("actionTableDeleteRow") }),
|
|
6209
|
+
/* @__PURE__ */ jsx92(DropdownMenu.Item, { onSelect: () => deleteTableAtSelection(), children: tr("actionTableDeleteTable") })
|
|
6184
6210
|
] });
|
|
6185
6211
|
}
|
|
6186
6212
|
function TableCellActionMenuContainer({ anchorElem }) {
|
|
6187
6213
|
const [editor] = useLexicalComposerContext9();
|
|
6188
6214
|
const tr = useTr();
|
|
6189
|
-
const menuButtonRef =
|
|
6190
|
-
const [isMenuOpen, setIsMenuOpen] =
|
|
6191
|
-
const [tableCellNode, setTableMenuCellNode] =
|
|
6192
|
-
const [tableStats, setTablestats] =
|
|
6215
|
+
const menuButtonRef = useRef5(null);
|
|
6216
|
+
const [isMenuOpen, setIsMenuOpen] = useState8(false);
|
|
6217
|
+
const [tableCellNode, setTableMenuCellNode] = useState8(null);
|
|
6218
|
+
const [tableStats, setTablestats] = useState8({ rows: 1, columns: 1 });
|
|
6193
6219
|
const moveMenu = useCallback3(() => {
|
|
6194
6220
|
if (isMenuOpen) {
|
|
6195
6221
|
return;
|
|
@@ -6233,14 +6259,14 @@ function TableCellActionMenuContainer({ anchorElem }) {
|
|
|
6233
6259
|
setTableMenuCellNode(null);
|
|
6234
6260
|
}
|
|
6235
6261
|
}, [editor, isMenuOpen]);
|
|
6236
|
-
|
|
6262
|
+
useEffect10(() => {
|
|
6237
6263
|
return editor.registerUpdateListener(() => {
|
|
6238
6264
|
editor.getEditorState().read(() => {
|
|
6239
6265
|
moveMenu();
|
|
6240
6266
|
});
|
|
6241
6267
|
});
|
|
6242
6268
|
});
|
|
6243
|
-
|
|
6269
|
+
useEffect10(() => {
|
|
6244
6270
|
const menuButtonDOM = menuButtonRef.current;
|
|
6245
6271
|
if (menuButtonDOM != null && tableCellNode != null) {
|
|
6246
6272
|
const tableCellNodeDOM = editor.getElementByKey(tableCellNode.getKey());
|
|
@@ -6258,12 +6284,12 @@ function TableCellActionMenuContainer({ anchorElem }) {
|
|
|
6258
6284
|
}
|
|
6259
6285
|
}
|
|
6260
6286
|
}, [menuButtonRef, tableCellNode, editor, anchorElem]);
|
|
6261
|
-
return /* @__PURE__ */
|
|
6287
|
+
return /* @__PURE__ */ jsx92("div", { className: "c-rte-table-cell-action-button-container", ref: menuButtonRef, children: tableCellNode != null && /* @__PURE__ */ jsx92(
|
|
6262
6288
|
DropdownMenu.Root,
|
|
6263
6289
|
{
|
|
6264
6290
|
onOpenChange: (isOpen) => setIsMenuOpen(isOpen),
|
|
6265
|
-
content: /* @__PURE__ */
|
|
6266
|
-
children: /* @__PURE__ */
|
|
6291
|
+
content: /* @__PURE__ */ jsx92(TableActionMenu, { tableCellNode, tableStats }),
|
|
6292
|
+
children: /* @__PURE__ */ jsx92(IconButton, { size: "xs", "aria-label": tr("actionTableOpenOptions"), children: /* @__PURE__ */ jsx92(Icon.Arrow, {}) })
|
|
6267
6293
|
}
|
|
6268
6294
|
) });
|
|
6269
6295
|
}
|
|
@@ -6271,11 +6297,11 @@ function TableActionMenuPlugin({
|
|
|
6271
6297
|
anchorElem = document.body
|
|
6272
6298
|
}) {
|
|
6273
6299
|
const isEditable = useLexicalEditable();
|
|
6274
|
-
return createPortal4(isEditable ? /* @__PURE__ */
|
|
6300
|
+
return createPortal4(isEditable ? /* @__PURE__ */ jsx92(TableCellActionMenuContainer, { anchorElem }) : null, anchorElem);
|
|
6275
6301
|
}
|
|
6276
6302
|
|
|
6277
6303
|
// src/rich-text-editor/plugins/ToolbarPlugin/index.tsx
|
|
6278
|
-
import { useCallback as useCallback4, useEffect as
|
|
6304
|
+
import { useCallback as useCallback4, useEffect as useEffect11, useState as useState10 } from "react";
|
|
6279
6305
|
import {
|
|
6280
6306
|
$createParagraphNode as $createParagraphNode2,
|
|
6281
6307
|
$getNodeByKey,
|
|
@@ -6321,10 +6347,10 @@ import {
|
|
|
6321
6347
|
} from "@lexical/utils";
|
|
6322
6348
|
|
|
6323
6349
|
// src/rich-text-editor/plugins/ActionsPlugin/index.tsx
|
|
6324
|
-
import { useRef as
|
|
6350
|
+
import { useRef as useRef6 } from "react";
|
|
6325
6351
|
import { CLEAR_EDITOR_COMMAND } from "lexical";
|
|
6326
6352
|
import { useLexicalComposerContext as useLexicalComposerContext10 } from "@lexical/react/LexicalComposerContext";
|
|
6327
|
-
import { jsx as
|
|
6353
|
+
import { jsx as jsx93, jsxs as jsxs70 } from "react/jsx-runtime";
|
|
6328
6354
|
async function copyJson(editor) {
|
|
6329
6355
|
const json = lexicalToCrystallizeRichText({ editor, editorState: editor.getEditorState() });
|
|
6330
6356
|
try {
|
|
@@ -6339,51 +6365,48 @@ function ActionsPlugin({
|
|
|
6339
6365
|
}) {
|
|
6340
6366
|
const [editor] = useLexicalComposerContext10();
|
|
6341
6367
|
const tr = useTr();
|
|
6342
|
-
const actionMenuAnchorRef =
|
|
6343
|
-
return /* @__PURE__ */
|
|
6344
|
-
/* @__PURE__ */
|
|
6345
|
-
|
|
6346
|
-
|
|
6347
|
-
|
|
6348
|
-
|
|
6349
|
-
|
|
6350
|
-
|
|
6351
|
-
|
|
6352
|
-
|
|
6353
|
-
|
|
6354
|
-
|
|
6355
|
-
|
|
6356
|
-
|
|
6357
|
-
|
|
6358
|
-
{
|
|
6359
|
-
|
|
6360
|
-
|
|
6361
|
-
editor.dispatchCommand(CLEAR_EDITOR_COMMAND, void 0);
|
|
6362
|
-
editor.focus();
|
|
6363
|
-
},
|
|
6364
|
-
children: tr("actionClear")
|
|
6365
|
-
}
|
|
6366
|
-
),
|
|
6367
|
-
!append ? null : append.map((actionItem) => /* @__PURE__ */ jsx92(
|
|
6368
|
-
ActionMenu.Item,
|
|
6369
|
-
{
|
|
6370
|
-
onSelect: actionItem.action,
|
|
6371
|
-
className: actionItem.type === "danger" ? "danger" : "",
|
|
6372
|
-
children: actionItem.title
|
|
6368
|
+
const actionMenuAnchorRef = useRef6(null);
|
|
6369
|
+
return /* @__PURE__ */ jsx93("div", { ref: actionMenuAnchorRef, className: "c-rte-actions-plugin", children: /* @__PURE__ */ jsxs70(ActionMenu, { container: actionMenuAnchorRef.current, children: [
|
|
6370
|
+
!prepend ? null : prepend.map((actionItem) => /* @__PURE__ */ jsx93(
|
|
6371
|
+
ActionMenu.Item,
|
|
6372
|
+
{
|
|
6373
|
+
onSelect: actionItem.action,
|
|
6374
|
+
className: actionItem.type === "danger" ? "danger" : "",
|
|
6375
|
+
children: actionItem.title
|
|
6376
|
+
},
|
|
6377
|
+
actionItem.title
|
|
6378
|
+
)),
|
|
6379
|
+
/* @__PURE__ */ jsx93(ActionMenu.Item, { onSelect: () => copyJson(editor), children: tr("actionCopyJSON") }),
|
|
6380
|
+
/* @__PURE__ */ jsx93(
|
|
6381
|
+
ActionMenu.Item,
|
|
6382
|
+
{
|
|
6383
|
+
className: "danger",
|
|
6384
|
+
onSelect: () => {
|
|
6385
|
+
editor.dispatchCommand(CLEAR_EDITOR_COMMAND, void 0);
|
|
6386
|
+
editor.focus();
|
|
6373
6387
|
},
|
|
6374
|
-
|
|
6375
|
-
|
|
6376
|
-
|
|
6377
|
-
|
|
6388
|
+
children: tr("actionClear")
|
|
6389
|
+
}
|
|
6390
|
+
),
|
|
6391
|
+
!append ? null : append.map((actionItem) => /* @__PURE__ */ jsx93(
|
|
6392
|
+
ActionMenu.Item,
|
|
6393
|
+
{
|
|
6394
|
+
onSelect: actionItem.action,
|
|
6395
|
+
className: actionItem.type === "danger" ? "danger" : "",
|
|
6396
|
+
children: actionItem.title
|
|
6397
|
+
},
|
|
6398
|
+
actionItem.title
|
|
6399
|
+
))
|
|
6400
|
+
] }) });
|
|
6378
6401
|
}
|
|
6379
6402
|
|
|
6380
6403
|
// src/rich-text-editor/plugins/ToolbarPlugin/insert-table.tsx
|
|
6381
|
-
import { useState as
|
|
6404
|
+
import { useState as useState9 } from "react";
|
|
6382
6405
|
import { INSERT_TABLE_COMMAND } from "@lexical/table";
|
|
6383
|
-
import {
|
|
6406
|
+
import { jsx as jsx94, jsxs as jsxs71 } from "react/jsx-runtime";
|
|
6384
6407
|
function InsertTableDialog({ activeEditor }) {
|
|
6385
|
-
const [rows, setRows] =
|
|
6386
|
-
const [columns, setColumns] =
|
|
6408
|
+
const [rows, setRows] = useState9("5");
|
|
6409
|
+
const [columns, setColumns] = useState9("5");
|
|
6387
6410
|
const tr = useTr();
|
|
6388
6411
|
const onClick = () => {
|
|
6389
6412
|
if (parseInt(rows) < 1 || parseInt(columns) < 1) {
|
|
@@ -6398,9 +6421,9 @@ function InsertTableDialog({ activeEditor }) {
|
|
|
6398
6421
|
}
|
|
6399
6422
|
});
|
|
6400
6423
|
};
|
|
6401
|
-
return /* @__PURE__ */ jsxs71(
|
|
6402
|
-
/* @__PURE__ */ jsxs71("div", { className: "
|
|
6403
|
-
/* @__PURE__ */
|
|
6424
|
+
return /* @__PURE__ */ jsxs71("div", { className: "c-rte-insert-table", children: [
|
|
6425
|
+
/* @__PURE__ */ jsxs71("div", { className: "c-rte-insert-table__dimensions", children: [
|
|
6426
|
+
/* @__PURE__ */ jsx94(
|
|
6404
6427
|
InputWithLabel,
|
|
6405
6428
|
{
|
|
6406
6429
|
label: tr("insertTableRows"),
|
|
@@ -6411,8 +6434,8 @@ function InsertTableDialog({ activeEditor }) {
|
|
|
6411
6434
|
onChange: (e) => setRows(e.target.value)
|
|
6412
6435
|
}
|
|
6413
6436
|
),
|
|
6414
|
-
/* @__PURE__ */
|
|
6415
|
-
/* @__PURE__ */
|
|
6437
|
+
/* @__PURE__ */ jsx94("span", { className: "c-rte-insert-table__dimensions__separator" }),
|
|
6438
|
+
/* @__PURE__ */ jsx94(
|
|
6416
6439
|
InputWithLabel,
|
|
6417
6440
|
{
|
|
6418
6441
|
type: "text",
|
|
@@ -6424,12 +6447,12 @@ function InsertTableDialog({ activeEditor }) {
|
|
|
6424
6447
|
}
|
|
6425
6448
|
)
|
|
6426
6449
|
] }),
|
|
6427
|
-
/* @__PURE__ */
|
|
6450
|
+
/* @__PURE__ */ jsx94("div", { className: "c-rte-insert-table__actions", children: /* @__PURE__ */ jsx94(Button, { as: Dialog.Close, size: "sm", intent: "action", "aria-label": tr("insertTableCommit"), onClick, children: tr("insertTableCommit") }) })
|
|
6428
6451
|
] });
|
|
6429
6452
|
}
|
|
6430
6453
|
|
|
6431
6454
|
// src/rich-text-editor/plugins/ToolbarPlugin/index.tsx
|
|
6432
|
-
import { Fragment as
|
|
6455
|
+
import { Fragment as Fragment7, jsx as jsx95, jsxs as jsxs72 } from "react/jsx-runtime";
|
|
6433
6456
|
var headingTypeToBlockName = {
|
|
6434
6457
|
h1: "Heading 1",
|
|
6435
6458
|
h2: "Heading 2",
|
|
@@ -6533,66 +6556,65 @@ function BlockFormatDropDown({
|
|
|
6533
6556
|
});
|
|
6534
6557
|
}
|
|
6535
6558
|
};
|
|
6536
|
-
return /* @__PURE__ */
|
|
6559
|
+
return /* @__PURE__ */ jsx95(
|
|
6537
6560
|
DropdownMenu.Root,
|
|
6538
6561
|
{
|
|
6539
6562
|
disabled,
|
|
6540
6563
|
style: { zIndex: 1 },
|
|
6541
|
-
content: /* @__PURE__ */ jsxs72(
|
|
6564
|
+
content: /* @__PURE__ */ jsxs72(Fragment7, { children: [
|
|
6542
6565
|
/* @__PURE__ */ jsxs72(DropdownMenu.Item, { onClick: formatParagraph, children: [
|
|
6543
|
-
/* @__PURE__ */
|
|
6566
|
+
/* @__PURE__ */ jsx95(
|
|
6544
6567
|
"i",
|
|
6545
6568
|
{
|
|
6546
|
-
className: `
|
|
6569
|
+
className: `c-rte-icon-paragraph c-rte-toolbar__block-format__icon ${blockType === "paragraph" ? "selected" : ""}`
|
|
6547
6570
|
}
|
|
6548
6571
|
),
|
|
6549
|
-
/* @__PURE__ */
|
|
6550
|
-
/* @__PURE__ */ jsx94("span", { className: `${blockType === "paragraph" ? "font-bold" : "font-normal"} text-sm px-3 min-w-[150px]`, children: "Normal" })
|
|
6572
|
+
/* @__PURE__ */ jsx95("span", { className: `c-rte-toolbar__block-format__text ${blockType === "paragraph" ? "selected" : ""}`, children: "Normal" })
|
|
6551
6573
|
] }),
|
|
6552
6574
|
headings.map((headingSize) => /* @__PURE__ */ jsxs72(DropdownMenu.Item, { onClick: () => formatHeading(headingSize), children: [
|
|
6553
|
-
/* @__PURE__ */
|
|
6575
|
+
/* @__PURE__ */ jsx95(
|
|
6554
6576
|
"i",
|
|
6555
6577
|
{
|
|
6556
|
-
className: `icon
|
|
6578
|
+
className: `c-rte-icon-${headingSize} c-rte-toolbar__block-format__icon ${blockType === headingSize ? "selected" : ""}`
|
|
6557
6579
|
}
|
|
6558
6580
|
),
|
|
6559
|
-
/* @__PURE__ */
|
|
6581
|
+
/* @__PURE__ */ jsx95("span", { className: `c-rte-toolbar__block-format__text ${blockType === headingSize ? "selected" : ""}`, children: headingTypeToBlockName[headingSize] })
|
|
6560
6582
|
] }, headingSize)),
|
|
6561
6583
|
/* @__PURE__ */ jsxs72(DropdownMenu.Item, { onClick: formatBulletList, children: [
|
|
6562
|
-
/* @__PURE__ */
|
|
6584
|
+
/* @__PURE__ */ jsx95(
|
|
6563
6585
|
"i",
|
|
6564
6586
|
{
|
|
6565
|
-
className: `icon
|
|
6587
|
+
className: `c-rte-icon-bullet-list c-rte-toolbar__block-format__icon ${blockType === "bullet" ? "selected" : ""}`
|
|
6566
6588
|
}
|
|
6567
6589
|
),
|
|
6568
|
-
/* @__PURE__ */
|
|
6590
|
+
/* @__PURE__ */ jsx95("span", { className: `c-rte-toolbar__block-format__text ${blockType === "bullet" ? "selected" : ""}`, children: "Bullet List" })
|
|
6569
6591
|
] }),
|
|
6570
6592
|
/* @__PURE__ */ jsxs72(DropdownMenu.Item, { onClick: formatNumberedList, children: [
|
|
6571
|
-
/* @__PURE__ */
|
|
6593
|
+
/* @__PURE__ */ jsx95(
|
|
6572
6594
|
"i",
|
|
6573
6595
|
{
|
|
6574
|
-
className: `icon
|
|
6596
|
+
className: `c-rte-icon-numbered-list c-rte-toolbar__block-format__icon ${blockType === "number" ? "selected" : ""}`
|
|
6575
6597
|
}
|
|
6576
6598
|
),
|
|
6577
|
-
/* @__PURE__ */
|
|
6599
|
+
/* @__PURE__ */ jsx95("span", { className: `c-rte-toolbar__block-format__text ${blockType === "number" ? "selected" : ""}`, children: "Numbered List" })
|
|
6578
6600
|
] }),
|
|
6579
6601
|
/* @__PURE__ */ jsxs72(DropdownMenu.Item, { onClick: formatQuote, "data-testid": "toggle-block-format-quote", children: [
|
|
6580
|
-
/* @__PURE__ */
|
|
6602
|
+
/* @__PURE__ */ jsx95(
|
|
6581
6603
|
"i",
|
|
6582
6604
|
{
|
|
6583
|
-
className: `
|
|
6605
|
+
className: `c-rte-icon-quote c-rte-toolbar__block-format__icon ${blockType === "quote" ? "selected" : ""}`
|
|
6584
6606
|
}
|
|
6585
6607
|
),
|
|
6586
|
-
/* @__PURE__ */
|
|
6608
|
+
/* @__PURE__ */ jsx95("span", { className: `c-rte-toolbar__block-format__text ${blockType === "quote" ? "selected" : ""}`, children: "Quote" })
|
|
6587
6609
|
] }),
|
|
6588
6610
|
/* @__PURE__ */ jsxs72(DropdownMenu.Item, { onClick: formatCode, "data-testid": "toggle-block-format-code", children: [
|
|
6589
|
-
/* @__PURE__ */
|
|
6611
|
+
/* @__PURE__ */ jsx95(
|
|
6590
6612
|
"i",
|
|
6591
6613
|
{
|
|
6592
|
-
className: `icon code border w-6 h-6 rounded-md bg-no-repeat bg-center bg-[length:18px_18px] ${blockType === "code" ? "
|
|
6614
|
+
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" : ""}`
|
|
6593
6615
|
}
|
|
6594
6616
|
),
|
|
6595
|
-
/* @__PURE__ */
|
|
6617
|
+
/* @__PURE__ */ jsx95("span", { className: `c-rte-toolbar__block-format__text ${blockType === "code" ? "selected" : ""}`, children: "Code block" })
|
|
6596
6618
|
] })
|
|
6597
6619
|
] }),
|
|
6598
6620
|
children: /* @__PURE__ */ jsxs72(
|
|
@@ -6602,8 +6624,8 @@ function BlockFormatDropDown({
|
|
|
6602
6624
|
"aria-label": "Formatting options for text style",
|
|
6603
6625
|
"data-testid": "toggle-block-format",
|
|
6604
6626
|
children: [
|
|
6605
|
-
/* @__PURE__ */
|
|
6606
|
-
/* @__PURE__ */
|
|
6627
|
+
/* @__PURE__ */ jsx95("i", { className: `c-rte-toolbar__toggle-icon c-rte-icon-${blockType}` }),
|
|
6628
|
+
/* @__PURE__ */ jsx95(Icon.Arrow, {})
|
|
6607
6629
|
]
|
|
6608
6630
|
}
|
|
6609
6631
|
)
|
|
@@ -6611,29 +6633,29 @@ function BlockFormatDropDown({
|
|
|
6611
6633
|
);
|
|
6612
6634
|
}
|
|
6613
6635
|
function Divider() {
|
|
6614
|
-
return /* @__PURE__ */
|
|
6636
|
+
return /* @__PURE__ */ jsx95("div", { className: "c-rte-toolbar__divider" });
|
|
6615
6637
|
}
|
|
6616
6638
|
function ToolbarPlugin({
|
|
6617
6639
|
actionsMenuPrepend,
|
|
6618
6640
|
actionsMenuAppend
|
|
6619
6641
|
}) {
|
|
6620
6642
|
const [editor] = useLexicalComposerContext11();
|
|
6621
|
-
const [activeEditor, setActiveEditor] =
|
|
6622
|
-
const [blockType, setBlockType] =
|
|
6623
|
-
const [selectedElementKey, setSelectedElementKey] =
|
|
6624
|
-
const [isLink, setIsLink] =
|
|
6625
|
-
const [isBold, setIsBold] =
|
|
6626
|
-
const [isItalic, setIsItalic] =
|
|
6627
|
-
const [isUnderline, setIsUnderline] =
|
|
6628
|
-
const [isStrikethrough, setIsStrikethrough] =
|
|
6629
|
-
const [isSubscript, setIsSubscript] =
|
|
6630
|
-
const [isSuperscript, setIsSuperscript] =
|
|
6631
|
-
const [isCode, setIsCode] =
|
|
6632
|
-
const [canUndo, setCanUndo] =
|
|
6633
|
-
const [canRedo, setCanRedo] =
|
|
6643
|
+
const [activeEditor, setActiveEditor] = useState10(editor);
|
|
6644
|
+
const [blockType, setBlockType] = useState10("paragraph");
|
|
6645
|
+
const [selectedElementKey, setSelectedElementKey] = useState10(null);
|
|
6646
|
+
const [isLink, setIsLink] = useState10(false);
|
|
6647
|
+
const [isBold, setIsBold] = useState10(false);
|
|
6648
|
+
const [isItalic, setIsItalic] = useState10(false);
|
|
6649
|
+
const [isUnderline, setIsUnderline] = useState10(false);
|
|
6650
|
+
const [isStrikethrough, setIsStrikethrough] = useState10(false);
|
|
6651
|
+
const [isSubscript, setIsSubscript] = useState10(false);
|
|
6652
|
+
const [isSuperscript, setIsSuperscript] = useState10(false);
|
|
6653
|
+
const [isCode, setIsCode] = useState10(false);
|
|
6654
|
+
const [canUndo, setCanUndo] = useState10(false);
|
|
6655
|
+
const [canRedo, setCanRedo] = useState10(false);
|
|
6634
6656
|
const tr = useTr();
|
|
6635
|
-
const [codeLanguage, setCodeLanguage] =
|
|
6636
|
-
const [isEditable, setIsEditable] =
|
|
6657
|
+
const [codeLanguage, setCodeLanguage] = useState10("");
|
|
6658
|
+
const [isEditable, setIsEditable] = useState10(() => editor.isEditable());
|
|
6637
6659
|
const updateToolbar = useCallback4(() => {
|
|
6638
6660
|
const selection = $getSelection9();
|
|
6639
6661
|
if ($isRangeSelection7(selection)) {
|
|
@@ -6681,7 +6703,7 @@ function ToolbarPlugin({
|
|
|
6681
6703
|
}
|
|
6682
6704
|
}
|
|
6683
6705
|
}, [activeEditor]);
|
|
6684
|
-
|
|
6706
|
+
useEffect11(() => {
|
|
6685
6707
|
return editor.registerCommand(
|
|
6686
6708
|
SELECTION_CHANGE_COMMAND3,
|
|
6687
6709
|
(_payload, newEditor) => {
|
|
@@ -6692,7 +6714,7 @@ function ToolbarPlugin({
|
|
|
6692
6714
|
COMMAND_PRIORITY_CRITICAL3
|
|
6693
6715
|
);
|
|
6694
6716
|
}, [editor, updateToolbar]);
|
|
6695
|
-
|
|
6717
|
+
useEffect11(() => {
|
|
6696
6718
|
return mergeRegister3(
|
|
6697
6719
|
editor.registerEditableListener((editable) => {
|
|
6698
6720
|
setIsEditable(editable);
|
|
@@ -6758,9 +6780,9 @@ function ToolbarPlugin({
|
|
|
6758
6780
|
},
|
|
6759
6781
|
[activeEditor, selectedElementKey]
|
|
6760
6782
|
);
|
|
6761
|
-
return /* @__PURE__ */ jsxs72("div", { className: "toolbar", children: [
|
|
6762
|
-
/* @__PURE__ */ jsxs72("div", { className: "
|
|
6763
|
-
/* @__PURE__ */
|
|
6783
|
+
return /* @__PURE__ */ jsxs72("div", { className: "c-rte-toolbar", children: [
|
|
6784
|
+
/* @__PURE__ */ jsxs72("div", { className: "c-rte-toolbar__inner", children: [
|
|
6785
|
+
/* @__PURE__ */ jsx95(
|
|
6764
6786
|
IconButton,
|
|
6765
6787
|
{
|
|
6766
6788
|
disabled: !canUndo || !isEditable,
|
|
@@ -6770,16 +6792,16 @@ function ToolbarPlugin({
|
|
|
6770
6792
|
type: "button",
|
|
6771
6793
|
title: tr(IS_APPLE ? "actionUndoTitleApple" : "actionUndoTitle"),
|
|
6772
6794
|
"aria-label": tr("actionUndoLabel"),
|
|
6773
|
-
children: /* @__PURE__ */
|
|
6795
|
+
children: /* @__PURE__ */ jsx95(
|
|
6774
6796
|
"i",
|
|
6775
6797
|
{
|
|
6776
|
-
className: `
|
|
6798
|
+
className: `c-rte-icon-undo c-rte-toolbar__icon ${!canUndo ? "disabled" : ""}
|
|
6777
6799
|
`
|
|
6778
6800
|
}
|
|
6779
6801
|
)
|
|
6780
6802
|
}
|
|
6781
6803
|
),
|
|
6782
|
-
/* @__PURE__ */
|
|
6804
|
+
/* @__PURE__ */ jsx95(
|
|
6783
6805
|
IconButton,
|
|
6784
6806
|
{
|
|
6785
6807
|
disabled: !canRedo || !isEditable,
|
|
@@ -6789,34 +6811,29 @@ function ToolbarPlugin({
|
|
|
6789
6811
|
type: "button",
|
|
6790
6812
|
title: tr(IS_APPLE ? "actionRedoTitleApple" : "actionRedoTitle"),
|
|
6791
6813
|
"aria-label": tr("actionRedoLabel"),
|
|
6792
|
-
children: /* @__PURE__ */
|
|
6793
|
-
"i",
|
|
6794
|
-
{
|
|
6795
|
-
className: `format icon redo border w-4 h-6 bg-no-repeat bg-center bg-[length:17px_17px] ${canRedo ? "opacity-100" : "opacity-30"}`
|
|
6796
|
-
}
|
|
6797
|
-
)
|
|
6814
|
+
children: /* @__PURE__ */ jsx95("i", { className: `c-rte-icon-redo c-rte-toolbar__icon ${!canRedo ? "disabled" : ""}` })
|
|
6798
6815
|
}
|
|
6799
6816
|
),
|
|
6800
|
-
/* @__PURE__ */
|
|
6801
|
-
blockType in blockTypeToBlockName && activeEditor === editor && /* @__PURE__ */ jsxs72(
|
|
6802
|
-
/* @__PURE__ */
|
|
6803
|
-
/* @__PURE__ */
|
|
6817
|
+
/* @__PURE__ */ jsx95(Divider, {}),
|
|
6818
|
+
blockType in blockTypeToBlockName && activeEditor === editor && /* @__PURE__ */ jsxs72(Fragment7, { children: [
|
|
6819
|
+
/* @__PURE__ */ jsx95(BlockFormatDropDown, { disabled: !isEditable, blockType, editor }),
|
|
6820
|
+
/* @__PURE__ */ jsx95(Divider, {})
|
|
6804
6821
|
] }),
|
|
6805
|
-
blockType === "code" ? /* @__PURE__ */
|
|
6822
|
+
blockType === "code" ? /* @__PURE__ */ jsx95(Fragment7, { children: /* @__PURE__ */ jsx95(
|
|
6806
6823
|
DropdownMenu.Root,
|
|
6807
6824
|
{
|
|
6808
6825
|
disabled: !isEditable,
|
|
6809
6826
|
style: { zIndex: 1 },
|
|
6810
|
-
content: /* @__PURE__ */
|
|
6811
|
-
return /* @__PURE__ */
|
|
6827
|
+
content: /* @__PURE__ */ jsx95(Fragment7, { children: CODE_LANGUAGE_OPTIONS.map(([value, name]) => {
|
|
6828
|
+
return /* @__PURE__ */ jsx95(
|
|
6812
6829
|
DropdownMenu.Item,
|
|
6813
6830
|
{
|
|
6814
6831
|
className: `item ${dropDownActiveClass(value === codeLanguage)}`,
|
|
6815
6832
|
onClick: () => onCodeLanguageSelect(value),
|
|
6816
|
-
children: /* @__PURE__ */
|
|
6833
|
+
children: /* @__PURE__ */ jsx95(
|
|
6817
6834
|
"span",
|
|
6818
6835
|
{
|
|
6819
|
-
className: `
|
|
6836
|
+
className: `c-rte-toolbar__code-lang__sel-item ${dropDownActiveClass(value === codeLanguage) ? "selected" : ""}`,
|
|
6820
6837
|
children: name
|
|
6821
6838
|
}
|
|
6822
6839
|
)
|
|
@@ -6824,14 +6841,14 @@ function ToolbarPlugin({
|
|
|
6824
6841
|
value
|
|
6825
6842
|
);
|
|
6826
6843
|
}) }),
|
|
6827
|
-
children: /* @__PURE__ */
|
|
6844
|
+
children: /* @__PURE__ */ jsx95(Button, { "aria-label": tr("codeSelectLanguage"), append: /* @__PURE__ */ jsx95(Icon.Arrow, {}), children: /* @__PURE__ */ jsx95("span", { className: "c-rte-toolbar__code-lang__button-text", children: getLanguageFriendlyName2(codeLanguage) }) })
|
|
6828
6845
|
}
|
|
6829
|
-
) }) : /* @__PURE__ */
|
|
6830
|
-
/* @__PURE__ */
|
|
6846
|
+
) }) : /* @__PURE__ */ jsx95(Dialog, { children: /* @__PURE__ */ jsxs72("div", { className: "c-rte-toolbar__actions-rest", children: [
|
|
6847
|
+
/* @__PURE__ */ jsx95(
|
|
6831
6848
|
IconButton,
|
|
6832
6849
|
{
|
|
6833
6850
|
disabled: !isEditable,
|
|
6834
|
-
className:
|
|
6851
|
+
className: `c-rte-toolbar__icon-btn ${isBold ? "selected" : ""}`,
|
|
6835
6852
|
type: "button",
|
|
6836
6853
|
title: tr(IS_APPLE ? "actionFormatAsStrongTitleApple" : "actionFormatAsStrongTitle"),
|
|
6837
6854
|
"aria-label": tr("actionFormatAsStrongLabel"),
|
|
@@ -6839,13 +6856,13 @@ function ToolbarPlugin({
|
|
|
6839
6856
|
onClick: () => {
|
|
6840
6857
|
activeEditor.dispatchCommand(FORMAT_TEXT_COMMAND2, "bold");
|
|
6841
6858
|
},
|
|
6842
|
-
children: /* @__PURE__ */
|
|
6859
|
+
children: /* @__PURE__ */ jsx95("i", { className: `c-rte-toolbar__icon-btn__icon c-rte-icon-bold` })
|
|
6843
6860
|
}
|
|
6844
6861
|
),
|
|
6845
|
-
/* @__PURE__ */
|
|
6862
|
+
/* @__PURE__ */ jsx95(
|
|
6846
6863
|
IconButton,
|
|
6847
6864
|
{
|
|
6848
|
-
className:
|
|
6865
|
+
className: `c-rte-toolbar__icon-btn ${isItalic ? "selected" : ""}`,
|
|
6849
6866
|
disabled: !isEditable,
|
|
6850
6867
|
onClick: () => {
|
|
6851
6868
|
activeEditor.dispatchCommand(FORMAT_TEXT_COMMAND2, "italic");
|
|
@@ -6854,13 +6871,13 @@ function ToolbarPlugin({
|
|
|
6854
6871
|
title: tr(IS_APPLE ? "actionFormatAsEmphasizedTitleApple" : "actionFormatAsEmphasizedTitle"),
|
|
6855
6872
|
"aria-label": tr("actionFormatAsEmphasizedLabel"),
|
|
6856
6873
|
"data-testid": "toggle-format-emphasized",
|
|
6857
|
-
children: /* @__PURE__ */
|
|
6874
|
+
children: /* @__PURE__ */ jsx95("i", { className: `c-rte-toolbar__icon-btn__icon c-rte-icon-italic` })
|
|
6858
6875
|
}
|
|
6859
6876
|
),
|
|
6860
|
-
/* @__PURE__ */
|
|
6877
|
+
/* @__PURE__ */ jsx95(
|
|
6861
6878
|
IconButton,
|
|
6862
6879
|
{
|
|
6863
|
-
className:
|
|
6880
|
+
className: `c-rte-toolbar__icon-btn ${isUnderline ? "selected" : ""}`,
|
|
6864
6881
|
disabled: !isEditable,
|
|
6865
6882
|
onClick: () => {
|
|
6866
6883
|
activeEditor.dispatchCommand(FORMAT_TEXT_COMMAND2, "underline");
|
|
@@ -6869,18 +6886,13 @@ function ToolbarPlugin({
|
|
|
6869
6886
|
title: tr(IS_APPLE ? "actionFormatAsUnderlinedTitleApple" : "actionFormatAsUnderlinedTitle"),
|
|
6870
6887
|
"aria-label": tr("actionFormatAsUnderlinedLabel"),
|
|
6871
6888
|
"data-testid": "toggle-format-underlined",
|
|
6872
|
-
children: /* @__PURE__ */
|
|
6873
|
-
"i",
|
|
6874
|
-
{
|
|
6875
|
-
className: `format icon underline border w-full h-full bg-no-repeat bg-center bg-[length:18px_18px]`
|
|
6876
|
-
}
|
|
6877
|
-
)
|
|
6889
|
+
children: /* @__PURE__ */ jsx95("i", { className: `c-rte-toolbar__icon-btn__icon c-rte-icon-underline` })
|
|
6878
6890
|
}
|
|
6879
6891
|
),
|
|
6880
|
-
/* @__PURE__ */
|
|
6892
|
+
/* @__PURE__ */ jsx95(
|
|
6881
6893
|
IconButton,
|
|
6882
6894
|
{
|
|
6883
|
-
className:
|
|
6895
|
+
className: `c-rte-toolbar__icon-btn ${isCode ? "selected" : ""}`,
|
|
6884
6896
|
disabled: !isEditable,
|
|
6885
6897
|
onClick: () => {
|
|
6886
6898
|
activeEditor.dispatchCommand(FORMAT_TEXT_COMMAND2, "code");
|
|
@@ -6888,27 +6900,27 @@ function ToolbarPlugin({
|
|
|
6888
6900
|
type: "button",
|
|
6889
6901
|
title: tr("actionInsertCodeBlock"),
|
|
6890
6902
|
"aria-label": tr("actionInsertCodeBlock"),
|
|
6891
|
-
children: /* @__PURE__ */
|
|
6903
|
+
children: /* @__PURE__ */ jsx95("i", { className: `c-rte-toolbar__icon-btn__icon c-rte-icon-code` })
|
|
6892
6904
|
}
|
|
6893
6905
|
),
|
|
6894
|
-
/* @__PURE__ */
|
|
6906
|
+
/* @__PURE__ */ jsx95(
|
|
6895
6907
|
IconButton,
|
|
6896
6908
|
{
|
|
6897
|
-
className:
|
|
6909
|
+
className: `c-rte-toolbar__icon-btn ${isLink ? "selected" : ""}`,
|
|
6898
6910
|
disabled: !isEditable,
|
|
6899
6911
|
onClick: insertLink,
|
|
6900
6912
|
type: "button",
|
|
6901
6913
|
"aria-label": tr("actionInsertlink"),
|
|
6902
6914
|
title: tr("actionInsertlink"),
|
|
6903
|
-
children: /* @__PURE__ */
|
|
6915
|
+
children: /* @__PURE__ */ jsx95("i", { className: `c-rte-toolbar__icon-btn__icon c-rte-icon-link` })
|
|
6904
6916
|
}
|
|
6905
6917
|
),
|
|
6906
|
-
/* @__PURE__ */
|
|
6918
|
+
/* @__PURE__ */ jsx95(
|
|
6907
6919
|
DropdownMenu.Root,
|
|
6908
6920
|
{
|
|
6909
6921
|
disabled: !isEditable,
|
|
6910
6922
|
style: { zIndex: 1 },
|
|
6911
|
-
content: /* @__PURE__ */ jsxs72(
|
|
6923
|
+
content: /* @__PURE__ */ jsxs72(Fragment7, { children: [
|
|
6912
6924
|
/* @__PURE__ */ jsxs72(
|
|
6913
6925
|
DropdownMenu.Item,
|
|
6914
6926
|
{
|
|
@@ -6918,13 +6930,13 @@ function ToolbarPlugin({
|
|
|
6918
6930
|
title: tr("actionFormatWithStrikethroughTitle"),
|
|
6919
6931
|
"aria-label": tr("actionFormatWithStrikethroughLabel"),
|
|
6920
6932
|
children: [
|
|
6921
|
-
/* @__PURE__ */
|
|
6933
|
+
/* @__PURE__ */ jsx95(
|
|
6922
6934
|
"i",
|
|
6923
6935
|
{
|
|
6924
|
-
className: `icon
|
|
6936
|
+
className: `c-rte-icon-strikethrough c-rte-toolbar__dd-item__icon ${isStrikethrough ? "selected" : ""}`
|
|
6925
6937
|
}
|
|
6926
6938
|
),
|
|
6927
|
-
/* @__PURE__ */
|
|
6939
|
+
/* @__PURE__ */ jsx95("span", { className: `c-rte-toolbar__dd-item__text ${isStrikethrough ? "selected" : ""}`, children: tr("actionFormatAsStrongTitle") })
|
|
6928
6940
|
]
|
|
6929
6941
|
}
|
|
6930
6942
|
),
|
|
@@ -6937,13 +6949,13 @@ function ToolbarPlugin({
|
|
|
6937
6949
|
title: tr("actionFormatWithSubscriptTitle"),
|
|
6938
6950
|
"aria-label": tr("actionFormatWithSubscriptLabel"),
|
|
6939
6951
|
children: [
|
|
6940
|
-
/* @__PURE__ */
|
|
6952
|
+
/* @__PURE__ */ jsx95(
|
|
6941
6953
|
"i",
|
|
6942
6954
|
{
|
|
6943
|
-
className: `icon
|
|
6955
|
+
className: `c-rte-icon-subscript c-rte-toolbar__dd-item__icon ${isSubscript ? "selected" : ""}`
|
|
6944
6956
|
}
|
|
6945
6957
|
),
|
|
6946
|
-
/* @__PURE__ */
|
|
6958
|
+
/* @__PURE__ */ jsx95("span", { className: `c-rte-toolbar__dd-item__text ${isSubscript ? "selected" : ""}`, children: tr("actionFormatWithSubscriptTitle") })
|
|
6947
6959
|
]
|
|
6948
6960
|
}
|
|
6949
6961
|
),
|
|
@@ -6956,13 +6968,13 @@ function ToolbarPlugin({
|
|
|
6956
6968
|
title: tr("actionFormatWithSuperscriptTitle"),
|
|
6957
6969
|
"aria-label": tr("actionFormatWithSuperscriptLabel"),
|
|
6958
6970
|
children: [
|
|
6959
|
-
/* @__PURE__ */
|
|
6971
|
+
/* @__PURE__ */ jsx95(
|
|
6960
6972
|
"i",
|
|
6961
6973
|
{
|
|
6962
|
-
className: `icon
|
|
6974
|
+
className: `c-rte-icon-superscript c-rte-toolbar__dd-item__icon ${isSuperscript ? "selected" : ""}`
|
|
6963
6975
|
}
|
|
6964
6976
|
),
|
|
6965
|
-
/* @__PURE__ */
|
|
6977
|
+
/* @__PURE__ */ jsx95("span", { className: `c-rte-toolbar__dd-item__text ${isSuperscript ? "selected" : ""}`, children: tr("actionFormatWithSuperscriptTitle") })
|
|
6966
6978
|
]
|
|
6967
6979
|
}
|
|
6968
6980
|
),
|
|
@@ -6974,8 +6986,8 @@ function ToolbarPlugin({
|
|
|
6974
6986
|
title: tr("actionClearTextFormatting"),
|
|
6975
6987
|
"aria-label": tr("actionClearTextFormatting"),
|
|
6976
6988
|
children: [
|
|
6977
|
-
/* @__PURE__ */
|
|
6978
|
-
/* @__PURE__ */
|
|
6989
|
+
/* @__PURE__ */ jsx95("i", { className: "c-rte-icon-clear c-rte-toolbar__dd-item__icon" }),
|
|
6990
|
+
/* @__PURE__ */ jsx95("span", { className: "c-rte-toolbar__dd-item__text--clear", children: "Clear Formatting" })
|
|
6979
6991
|
]
|
|
6980
6992
|
}
|
|
6981
6993
|
)
|
|
@@ -6986,48 +6998,48 @@ function ToolbarPlugin({
|
|
|
6986
6998
|
style: { backgroundColor: "transparent", padding: "0 8px" },
|
|
6987
6999
|
"aria-label": tr("actionTextFormattingOptions"),
|
|
6988
7000
|
children: [
|
|
6989
|
-
/* @__PURE__ */
|
|
6990
|
-
/* @__PURE__ */
|
|
7001
|
+
/* @__PURE__ */ jsx95("i", { className: `c-rte-icon-dropdown-more c-rte-toolbar__toggle-icon` }),
|
|
7002
|
+
/* @__PURE__ */ jsx95(Icon.Arrow, {})
|
|
6991
7003
|
]
|
|
6992
7004
|
}
|
|
6993
7005
|
)
|
|
6994
7006
|
}
|
|
6995
7007
|
),
|
|
6996
|
-
/* @__PURE__ */
|
|
6997
|
-
/* @__PURE__ */
|
|
7008
|
+
/* @__PURE__ */ jsx95(Divider, {}),
|
|
7009
|
+
/* @__PURE__ */ jsx95(
|
|
6998
7010
|
DropdownMenu.Root,
|
|
6999
7011
|
{
|
|
7000
7012
|
style: { zIndex: 1 },
|
|
7001
7013
|
disabled: !isEditable,
|
|
7002
|
-
content: /* @__PURE__ */ jsxs72(
|
|
7003
|
-
/* @__PURE__ */
|
|
7014
|
+
content: /* @__PURE__ */ jsxs72(Fragment7, { children: [
|
|
7015
|
+
/* @__PURE__ */ jsxs72(
|
|
7004
7016
|
DropdownMenu.Item,
|
|
7005
7017
|
{
|
|
7006
7018
|
onClick: () => {
|
|
7007
7019
|
activeEditor.dispatchCommand(INSERT_HORIZONTAL_RULE_COMMAND, void 0);
|
|
7008
7020
|
},
|
|
7009
|
-
children:
|
|
7010
|
-
/* @__PURE__ */
|
|
7011
|
-
/* @__PURE__ */
|
|
7012
|
-
]
|
|
7021
|
+
children: [
|
|
7022
|
+
/* @__PURE__ */ jsx95("i", { className: "c-rte-toolbar__dd-item__icon c-rte-icon-horizontal-rule" }),
|
|
7023
|
+
/* @__PURE__ */ jsx95("span", { className: "c-rte-toolbar__dd-item__text", children: tr("horizontalRule") })
|
|
7024
|
+
]
|
|
7013
7025
|
}
|
|
7014
7026
|
),
|
|
7015
|
-
/* @__PURE__ */
|
|
7016
|
-
/* @__PURE__ */
|
|
7017
|
-
/* @__PURE__ */
|
|
7027
|
+
/* @__PURE__ */ jsx95(DropdownMenu.Item, { children: /* @__PURE__ */ jsx95(Dialog.Trigger, { asChild: true, children: /* @__PURE__ */ jsxs72("div", { className: "c-rte-toolbar__dd-item--table", children: [
|
|
7028
|
+
/* @__PURE__ */ jsx95("i", { className: "c-rte-toolbar__dd-item__icon c-rte-icon-table" }),
|
|
7029
|
+
/* @__PURE__ */ jsx95("span", { className: "c-rte-toolbar__dd-item__text", children: tr("table") })
|
|
7018
7030
|
] }) }) })
|
|
7019
7031
|
] }),
|
|
7020
|
-
children: /* @__PURE__ */
|
|
7032
|
+
children: /* @__PURE__ */ jsx95(IconButton, { children: /* @__PURE__ */ jsx95("i", { className: "c-rte-icon-plus c-rte-toolbar__plus" }) })
|
|
7021
7033
|
}
|
|
7022
7034
|
),
|
|
7023
7035
|
/* @__PURE__ */ jsxs72(Dialog.Content, { children: [
|
|
7024
|
-
/* @__PURE__ */
|
|
7025
|
-
/* @__PURE__ */
|
|
7026
|
-
/* @__PURE__ */
|
|
7036
|
+
/* @__PURE__ */ jsx95(Dialog.Title, { children: tr("insertTableTitle") }),
|
|
7037
|
+
/* @__PURE__ */ jsx95(Dialog.Description, { children: tr("insertTableDescription") }),
|
|
7038
|
+
/* @__PURE__ */ jsx95(InsertTableDialog, { activeEditor })
|
|
7027
7039
|
] })
|
|
7028
7040
|
] }) })
|
|
7029
7041
|
] }),
|
|
7030
|
-
/* @__PURE__ */
|
|
7042
|
+
/* @__PURE__ */ jsx95(ActionsPlugin, { prepend: actionsMenuPrepend, append: actionsMenuAppend })
|
|
7031
7043
|
] });
|
|
7032
7044
|
}
|
|
7033
7045
|
|
|
@@ -7081,7 +7093,7 @@ var theme = {
|
|
|
7081
7093
|
h5: "CrystallizeRTEditorTheme__h5",
|
|
7082
7094
|
h6: "CrystallizeRTEditorTheme__h6"
|
|
7083
7095
|
},
|
|
7084
|
-
image: "
|
|
7096
|
+
image: "",
|
|
7085
7097
|
indent: "CrystallizeRTEditorTheme__indent",
|
|
7086
7098
|
link: "CrystallizeRTEditorTheme__link",
|
|
7087
7099
|
list: {
|
|
@@ -7134,7 +7146,7 @@ var theme = {
|
|
|
7134
7146
|
var CrystallizeRTEditorTheme_default = theme;
|
|
7135
7147
|
|
|
7136
7148
|
// src/rich-text-editor/rich-text-editor.tsx
|
|
7137
|
-
import { Fragment as
|
|
7149
|
+
import { Fragment as Fragment8, jsx as jsx96, jsxs as jsxs73 } from "react/jsx-runtime";
|
|
7138
7150
|
function RichTextEditor({
|
|
7139
7151
|
initialData,
|
|
7140
7152
|
editable = true,
|
|
@@ -7142,7 +7154,7 @@ function RichTextEditor({
|
|
|
7142
7154
|
labelTranslations,
|
|
7143
7155
|
...rest
|
|
7144
7156
|
}) {
|
|
7145
|
-
return /* @__PURE__ */
|
|
7157
|
+
return /* @__PURE__ */ jsx96(
|
|
7146
7158
|
LexicalComposer,
|
|
7147
7159
|
{
|
|
7148
7160
|
initialConfig: {
|
|
@@ -7157,7 +7169,7 @@ function RichTextEditor({
|
|
|
7157
7169
|
richText: initialData
|
|
7158
7170
|
}) : void 0
|
|
7159
7171
|
},
|
|
7160
|
-
children: /* @__PURE__ */
|
|
7172
|
+
children: /* @__PURE__ */ jsx96(I18nProvider, { language, labelTranslations, children: /* @__PURE__ */ jsx96(SharedHistoryContext, { children: /* @__PURE__ */ jsx96("div", { className: "c-rich-text-editor", children: /* @__PURE__ */ jsx96(RichTextEditorWithoutContext, { ...rest, editable }) }) }) })
|
|
7161
7173
|
}
|
|
7162
7174
|
);
|
|
7163
7175
|
}
|
|
@@ -7170,34 +7182,23 @@ function RichTextEditorWithoutContext({
|
|
|
7170
7182
|
actionsMenuAppend,
|
|
7171
7183
|
slotPreContent,
|
|
7172
7184
|
maxLength,
|
|
7173
|
-
editable
|
|
7185
|
+
editable,
|
|
7186
|
+
id
|
|
7174
7187
|
}) {
|
|
7175
7188
|
const { historyState } = useSharedHistoryContext();
|
|
7176
|
-
const placeholder = /* @__PURE__ */
|
|
7189
|
+
const placeholder = /* @__PURE__ */ jsx96("div", { className: "c-rte-placeholder", children: placeholderText ?? "" });
|
|
7177
7190
|
const [editor] = useLexicalComposerContext12();
|
|
7178
|
-
const [floatingAnchorElem, setFloatingAnchorElem] =
|
|
7179
|
-
const [isSmallWidthViewport, setIsSmallWidthViewport] =
|
|
7180
|
-
const firstOnChangeTriggeredRef =
|
|
7191
|
+
const [floatingAnchorElem, setFloatingAnchorElem] = useState11(null);
|
|
7192
|
+
const [isSmallWidthViewport, setIsSmallWidthViewport] = useState11(false);
|
|
7193
|
+
const firstOnChangeTriggeredRef = useRef7(!autoFocus);
|
|
7181
7194
|
const onRef = (_floatingAnchorElem) => {
|
|
7182
7195
|
if (_floatingAnchorElem !== null) {
|
|
7183
7196
|
setFloatingAnchorElem(_floatingAnchorElem);
|
|
7184
7197
|
}
|
|
7185
7198
|
};
|
|
7186
|
-
|
|
7199
|
+
useEffect12(() => {
|
|
7187
7200
|
editor.setEditable(editable || false);
|
|
7188
7201
|
}, [editable, editor]);
|
|
7189
|
-
useEffect11(() => {
|
|
7190
|
-
const updateViewPortWidth = () => {
|
|
7191
|
-
const isNextSmallWidthViewport = window.matchMedia("(max-width: 1025px)").matches;
|
|
7192
|
-
if (isNextSmallWidthViewport !== isSmallWidthViewport) {
|
|
7193
|
-
setIsSmallWidthViewport(isNextSmallWidthViewport);
|
|
7194
|
-
}
|
|
7195
|
-
};
|
|
7196
|
-
window.addEventListener("resize", updateViewPortWidth);
|
|
7197
|
-
return () => {
|
|
7198
|
-
window.removeEventListener("resize", updateViewPortWidth);
|
|
7199
|
-
};
|
|
7200
|
-
}, [isSmallWidthViewport]);
|
|
7201
7202
|
function onLocalChange(editorState) {
|
|
7202
7203
|
if (onChange) {
|
|
7203
7204
|
if (triggerOnChangeOnAutoFocus || firstOnChangeTriggeredRef.current) {
|
|
@@ -7206,37 +7207,38 @@ function RichTextEditorWithoutContext({
|
|
|
7206
7207
|
}
|
|
7207
7208
|
firstOnChangeTriggeredRef.current = true;
|
|
7208
7209
|
}
|
|
7209
|
-
return /* @__PURE__ */ jsxs73(
|
|
7210
|
-
/* @__PURE__ */
|
|
7211
|
-
/* @__PURE__ */
|
|
7210
|
+
return /* @__PURE__ */ jsxs73(Fragment8, { children: [
|
|
7211
|
+
/* @__PURE__ */ jsx96(OnChangePlugin, { onChange: onLocalChange, ignoreSelectionChange: true }),
|
|
7212
|
+
/* @__PURE__ */ jsx96(DimensionDetectorPlugin, { onChange: (d) => setIsSmallWidthViewport(d.isSmallWidth) }),
|
|
7213
|
+
isSmallWidthViewport ? null : /* @__PURE__ */ jsx96(ToolbarPlugin, { actionsMenuPrepend, actionsMenuAppend }),
|
|
7212
7214
|
slotPreContent,
|
|
7213
|
-
/* @__PURE__ */ jsxs73("div", { className: "editor-container", children: [
|
|
7214
|
-
maxLength != null ? /* @__PURE__ */
|
|
7215
|
-
!autoFocus ? null : /* @__PURE__ */
|
|
7216
|
-
/* @__PURE__ */
|
|
7217
|
-
/* @__PURE__ */
|
|
7218
|
-
/* @__PURE__ */
|
|
7219
|
-
/* @__PURE__ */
|
|
7215
|
+
/* @__PURE__ */ jsxs73("div", { className: "c-rte-editor-container", children: [
|
|
7216
|
+
maxLength != null ? /* @__PURE__ */ jsx96(MaxLengthPlugin, { maxLength }) : null,
|
|
7217
|
+
!autoFocus ? null : /* @__PURE__ */ jsx96(AutoFocusPlugin, {}),
|
|
7218
|
+
/* @__PURE__ */ jsx96(ClearEditorPlugin, {}),
|
|
7219
|
+
/* @__PURE__ */ jsx96(LexicalAutoLinkPlugin, {}),
|
|
7220
|
+
/* @__PURE__ */ jsx96(HistoryPlugin, { externalHistoryState: historyState }),
|
|
7221
|
+
/* @__PURE__ */ jsx96(
|
|
7220
7222
|
RichTextPlugin,
|
|
7221
7223
|
{
|
|
7222
|
-
contentEditable: /* @__PURE__ */
|
|
7224
|
+
contentEditable: /* @__PURE__ */ jsx96("div", { className: "c-rte-editor-scroller", children: /* @__PURE__ */ jsx96("div", { className: "c-rte-editor", ref: onRef, children: /* @__PURE__ */ jsx96(ContentEditable, { className: "c-rte-contenteditable-root", id }) }) }),
|
|
7223
7225
|
placeholder,
|
|
7224
7226
|
ErrorBoundary: LexicalErrorBoundary
|
|
7225
7227
|
}
|
|
7226
7228
|
),
|
|
7227
|
-
/* @__PURE__ */
|
|
7228
|
-
/* @__PURE__ */
|
|
7229
|
-
/* @__PURE__ */
|
|
7230
|
-
/* @__PURE__ */
|
|
7231
|
-
/* @__PURE__ */
|
|
7232
|
-
/* @__PURE__ */
|
|
7233
|
-
/* @__PURE__ */
|
|
7234
|
-
/* @__PURE__ */
|
|
7235
|
-
floatingAnchorElem && !isSmallWidthViewport && /* @__PURE__ */ jsxs73(
|
|
7236
|
-
/* @__PURE__ */
|
|
7237
|
-
/* @__PURE__ */
|
|
7238
|
-
/* @__PURE__ */
|
|
7239
|
-
/* @__PURE__ */
|
|
7229
|
+
/* @__PURE__ */ jsx96(CodeHighlightPlugin, {}),
|
|
7230
|
+
/* @__PURE__ */ jsx96(ListPlugin, {}),
|
|
7231
|
+
/* @__PURE__ */ jsx96(ListMaxIndentLevelPlugin, { maxDepth: 7 }),
|
|
7232
|
+
/* @__PURE__ */ jsx96(TablePlugin, {}),
|
|
7233
|
+
/* @__PURE__ */ jsx96(LinkPlugin, {}),
|
|
7234
|
+
/* @__PURE__ */ jsx96(HorizontalRulePlugin, {}),
|
|
7235
|
+
/* @__PURE__ */ jsx96(TabFocusPlugin, {}),
|
|
7236
|
+
/* @__PURE__ */ jsx96(TabIndentationPlugin, {}),
|
|
7237
|
+
floatingAnchorElem && !isSmallWidthViewport && /* @__PURE__ */ jsxs73(Fragment8, { children: [
|
|
7238
|
+
/* @__PURE__ */ jsx96(CodeActionMenuPlugin, { anchorElem: floatingAnchorElem }),
|
|
7239
|
+
/* @__PURE__ */ jsx96(FloatingLinkEditorPlugin, { anchorElem: floatingAnchorElem }),
|
|
7240
|
+
/* @__PURE__ */ jsx96(TableActionMenuPlugin, { anchorElem: floatingAnchorElem }),
|
|
7241
|
+
/* @__PURE__ */ jsx96(FloatingTextFormatToolbarPlugin, { anchorElem: floatingAnchorElem })
|
|
7240
7242
|
] })
|
|
7241
7243
|
] })
|
|
7242
7244
|
] });
|