@crystallize/design-system 1.17.0 → 1.17.2
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 +12 -0
- package/dist/index.css +5 -7
- package/dist/index.d.ts +7 -6
- package/dist/index.js +368 -414
- package/dist/index.mjs +315 -361
- package/package.json +1 -1
- package/src/action-menu/action-item.tsx +4 -4
- package/src/rich-text-editor/i18n/translations/en.ts +1 -0
- package/src/rich-text-editor/i18n/types.ts +1 -0
- package/src/rich-text-editor/model/lexical-to-crystallize.ts +3 -4
- package/src/rich-text-editor/plugins/ActionsPlugin/index.tsx +34 -38
- package/src/rich-text-editor/plugins/FloatingLinkEditorPlugin/index.tsx +3 -1
- package/src/rich-text-editor/plugins/FloatingTextFormatToolbarPlugin/index.tsx +16 -16
- package/src/rich-text-editor/plugins/ToolbarPlugin/index.css +9 -0
- package/src/rich-text-editor/plugins/ToolbarPlugin/index.tsx +11 -11
- package/src/rich-text-editor/rich-text-editor.css +0 -1
- package/src/rich-text-editor/rich-text-editor.tsx +5 -14
- package/src/rich-text-editor/types/crystallize-rich-text-types/index.ts +1 -1
- package/src/rich-text-editor/plugins/ActionsPlugin/index.css +0 -3
- package/src/rich-text-editor/plugins/DimensionsDetectorPlugin/index.tsx +0 -49
package/dist/index.js
CHANGED
|
@@ -29160,8 +29160,9 @@ var DropdownMenu = {
|
|
|
29160
29160
|
// src/action-menu/action-item.tsx
|
|
29161
29161
|
var import_class_variance_authority5 = require("class-variance-authority");
|
|
29162
29162
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
29163
|
-
function Item2({ children, className, onSelect }) {
|
|
29163
|
+
function Item2({ children, className, onSelect, ...delegated }) {
|
|
29164
29164
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DropdownMenu.Item, {
|
|
29165
|
+
...delegated,
|
|
29165
29166
|
onClick: onSelect,
|
|
29166
29167
|
className: (0, import_class_variance_authority5.cx)(className, ["c-action-menu-item"]),
|
|
29167
29168
|
children
|
|
@@ -34805,7 +34806,7 @@ function Tag({ children, className, variant, size, prepend, onRemove, ...delegat
|
|
|
34805
34806
|
}
|
|
34806
34807
|
|
|
34807
34808
|
// src/rich-text-editor/rich-text-editor.tsx
|
|
34808
|
-
var
|
|
34809
|
+
var import_react119 = require("react");
|
|
34809
34810
|
var import_LexicalAutoFocusPlugin = require("@lexical/react/LexicalAutoFocusPlugin");
|
|
34810
34811
|
var import_LexicalClearEditorPlugin = require("@lexical/react/LexicalClearEditorPlugin");
|
|
34811
34812
|
var import_LexicalComposer = require("@lexical/react/LexicalComposer");
|
|
@@ -34858,6 +34859,7 @@ var translations = {
|
|
|
34858
34859
|
actionFormatWithSubscriptTitle: "Subscript",
|
|
34859
34860
|
actionFormatWithSuperscriptLabel: "Format text as superscript",
|
|
34860
34861
|
actionFormatWithSuperscriptTitle: "Superscript",
|
|
34862
|
+
actionFormatClear: "Clear formatting",
|
|
34861
34863
|
actionInsertCodeBlock: "Insert code block",
|
|
34862
34864
|
actionInsertlink: "Insert link",
|
|
34863
34865
|
actionCopyJSON: "Copy JSON",
|
|
@@ -35265,12 +35267,11 @@ function lexicalToCrystallizeRichText({
|
|
|
35265
35267
|
if ((0, import_lexical2.$isElementNode)(childNode)) {
|
|
35266
35268
|
handleNode(childNode, parentChildrenToUse);
|
|
35267
35269
|
} else if ((0, import_LexicalHorizontalRuleNode2.$isHorizontalRuleNode)(childNode)) {
|
|
35268
|
-
parentChildrenToUse.push({
|
|
35269
|
-
kind: "block",
|
|
35270
|
-
type: "horizontal-line"
|
|
35271
|
-
});
|
|
35270
|
+
parentChildrenToUse.push({ kind: "block", type: "horizontal-line" });
|
|
35272
35271
|
} else if ((0, import_lexical2.$isTextNode)(childNode)) {
|
|
35273
35272
|
parentChildrenToUse.push(getTextChild(childNode));
|
|
35273
|
+
} else if ((0, import_lexical2.$isLineBreakNode)(childNode)) {
|
|
35274
|
+
parentChildrenToUse.push({ kind: "inline", type: "line-break" });
|
|
35274
35275
|
}
|
|
35275
35276
|
});
|
|
35276
35277
|
}
|
|
@@ -35687,45 +35688,8 @@ function CodeHighlightPlugin() {
|
|
|
35687
35688
|
return null;
|
|
35688
35689
|
}
|
|
35689
35690
|
|
|
35690
|
-
// src/rich-text-editor/plugins/DimensionsDetectorPlugin/index.tsx
|
|
35691
|
-
var import_react110 = require("react");
|
|
35692
|
-
var import_jsx_runtime126 = require("react/jsx-runtime");
|
|
35693
|
-
function DimensionDetectorPlugin({ onChange }) {
|
|
35694
|
-
const [dimensions, setDimensions] = (0, import_react110.useState)();
|
|
35695
|
-
const ref = (0, import_react110.useRef)(null);
|
|
35696
|
-
(0, import_react110.useEffect)(() => {
|
|
35697
|
-
if (ref.current) {
|
|
35698
|
-
const el = ref.current;
|
|
35699
|
-
const resizeObserver = new ResizeObserver((entries) => {
|
|
35700
|
-
const [first] = entries;
|
|
35701
|
-
if (first) {
|
|
35702
|
-
const [contentBox] = first.contentBoxSize;
|
|
35703
|
-
if (contentBox) {
|
|
35704
|
-
const width = contentBox.inlineSize;
|
|
35705
|
-
setDimensions({
|
|
35706
|
-
width,
|
|
35707
|
-
isSmallWidth: width < 600
|
|
35708
|
-
});
|
|
35709
|
-
}
|
|
35710
|
-
}
|
|
35711
|
-
});
|
|
35712
|
-
resizeObserver.observe(el);
|
|
35713
|
-
return () => resizeObserver.disconnect();
|
|
35714
|
-
}
|
|
35715
|
-
}, []);
|
|
35716
|
-
(0, import_react110.useEffect)(() => {
|
|
35717
|
-
if (dimensions) {
|
|
35718
|
-
onChange(dimensions);
|
|
35719
|
-
}
|
|
35720
|
-
}, [dimensions, onChange]);
|
|
35721
|
-
return /* @__PURE__ */ (0, import_jsx_runtime126.jsx)("div", {
|
|
35722
|
-
ref,
|
|
35723
|
-
style: { height: 1, marginTop: -1 }
|
|
35724
|
-
});
|
|
35725
|
-
}
|
|
35726
|
-
|
|
35727
35691
|
// src/rich-text-editor/plugins/FloatingLinkEditorPlugin/index.tsx
|
|
35728
|
-
var
|
|
35692
|
+
var import_react111 = require("react");
|
|
35729
35693
|
var React4 = require("react");
|
|
35730
35694
|
var import_lexical8 = require("lexical");
|
|
35731
35695
|
var import_react_dom3 = require("react-dom");
|
|
@@ -35734,10 +35698,10 @@ var import_LexicalComposerContext4 = require("@lexical/react/LexicalComposerCont
|
|
|
35734
35698
|
var import_utils = require("@lexical/utils");
|
|
35735
35699
|
|
|
35736
35700
|
// src/rich-text-editor/ui/LinkPreview.tsx
|
|
35737
|
-
var
|
|
35701
|
+
var import_react110 = require("react");
|
|
35738
35702
|
var import_lexical7 = require("lexical");
|
|
35739
35703
|
var import_LexicalComposerContext3 = require("@lexical/react/LexicalComposerContext");
|
|
35740
|
-
var
|
|
35704
|
+
var import_jsx_runtime126 = require("react/jsx-runtime");
|
|
35741
35705
|
var PREVIEW_CACHE = {};
|
|
35742
35706
|
var URL_MATCHER2 = /((https?:\/\/(www\.)?)|(www\.))[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)/;
|
|
35743
35707
|
function useSuspenseRequest(url) {
|
|
@@ -35761,12 +35725,12 @@ function useSuspenseRequest(url) {
|
|
|
35761
35725
|
function LinkPreviewContent({
|
|
35762
35726
|
url
|
|
35763
35727
|
}) {
|
|
35764
|
-
const [textContent, setTextContent] = (0,
|
|
35728
|
+
const [textContent, setTextContent] = (0, import_react110.useState)("");
|
|
35765
35729
|
const { preview } = useSuspenseRequest(url);
|
|
35766
35730
|
const [editor] = (0, import_LexicalComposerContext3.useLexicalComposerContext)();
|
|
35767
35731
|
const tr = useTr();
|
|
35768
35732
|
const hasPreview = preview !== null && preview.google?.title;
|
|
35769
|
-
(0,
|
|
35733
|
+
(0, import_react110.useEffect)(() => {
|
|
35770
35734
|
editor.update(() => {
|
|
35771
35735
|
const sel = (0, import_lexical7.$getSelection)();
|
|
35772
35736
|
const nodes = sel?.getNodes();
|
|
@@ -35794,26 +35758,26 @@ function LinkPreviewContent({
|
|
|
35794
35758
|
if (!hasPreview) {
|
|
35795
35759
|
return null;
|
|
35796
35760
|
}
|
|
35797
|
-
return /* @__PURE__ */ (0,
|
|
35761
|
+
return /* @__PURE__ */ (0, import_jsx_runtime126.jsxs)("div", {
|
|
35798
35762
|
className: "c-rte-link-preview",
|
|
35799
35763
|
children: [
|
|
35800
|
-
preview.google.image && /* @__PURE__ */ (0,
|
|
35764
|
+
preview.google.image && /* @__PURE__ */ (0, import_jsx_runtime126.jsx)("div", {
|
|
35801
35765
|
className: "c-rte-link-preview-image-wrapper",
|
|
35802
|
-
children: /* @__PURE__ */ (0,
|
|
35766
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime126.jsx)("img", {
|
|
35803
35767
|
src: preview.google.image,
|
|
35804
35768
|
alt: preview.google.title,
|
|
35805
35769
|
className: "c-rte-link-preview-image"
|
|
35806
35770
|
})
|
|
35807
35771
|
}),
|
|
35808
|
-
preview.google.title && /* @__PURE__ */ (0,
|
|
35772
|
+
preview.google.title && /* @__PURE__ */ (0, import_jsx_runtime126.jsx)("div", {
|
|
35809
35773
|
className: "c-rte-link-preview-title",
|
|
35810
35774
|
children: preview.google.title
|
|
35811
35775
|
}),
|
|
35812
|
-
preview.google.description && /* @__PURE__ */ (0,
|
|
35776
|
+
preview.google.description && /* @__PURE__ */ (0, import_jsx_runtime126.jsx)("div", {
|
|
35813
35777
|
className: "c-rte-link-preview-description",
|
|
35814
35778
|
children: preview.google.description
|
|
35815
35779
|
}),
|
|
35816
|
-
textContent && textContent !== preview.google.title ? /* @__PURE__ */ (0,
|
|
35780
|
+
textContent && textContent !== preview.google.title ? /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(Button, {
|
|
35817
35781
|
className: "c-rte-link-preview__replace-text-btn",
|
|
35818
35782
|
onClick: useTitleForText,
|
|
35819
35783
|
children: tr("linkPreviewReplaceTextWithTitle")
|
|
@@ -35822,7 +35786,7 @@ function LinkPreviewContent({
|
|
|
35822
35786
|
});
|
|
35823
35787
|
}
|
|
35824
35788
|
function Glimmer(props) {
|
|
35825
|
-
return /* @__PURE__ */ (0,
|
|
35789
|
+
return /* @__PURE__ */ (0, import_jsx_runtime126.jsx)("div", {
|
|
35826
35790
|
className: "c-rte-link-preview-glimmer",
|
|
35827
35791
|
...props,
|
|
35828
35792
|
style: {
|
|
@@ -35834,24 +35798,24 @@ function Glimmer(props) {
|
|
|
35834
35798
|
function LinkPreview({
|
|
35835
35799
|
url
|
|
35836
35800
|
}) {
|
|
35837
|
-
return /* @__PURE__ */ (0,
|
|
35838
|
-
fallback: /* @__PURE__ */ (0,
|
|
35801
|
+
return /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(import_react110.Suspense, {
|
|
35802
|
+
fallback: /* @__PURE__ */ (0, import_jsx_runtime126.jsxs)(import_jsx_runtime126.Fragment, {
|
|
35839
35803
|
children: [
|
|
35840
|
-
/* @__PURE__ */ (0,
|
|
35804
|
+
/* @__PURE__ */ (0, import_jsx_runtime126.jsx)(Glimmer, {
|
|
35841
35805
|
style: { height: "80px" },
|
|
35842
35806
|
index: 0
|
|
35843
35807
|
}),
|
|
35844
|
-
/* @__PURE__ */ (0,
|
|
35808
|
+
/* @__PURE__ */ (0, import_jsx_runtime126.jsx)(Glimmer, {
|
|
35845
35809
|
style: { width: "60%" },
|
|
35846
35810
|
index: 1
|
|
35847
35811
|
}),
|
|
35848
|
-
/* @__PURE__ */ (0,
|
|
35812
|
+
/* @__PURE__ */ (0, import_jsx_runtime126.jsx)(Glimmer, {
|
|
35849
35813
|
style: { width: "80%" },
|
|
35850
35814
|
index: 2
|
|
35851
35815
|
})
|
|
35852
35816
|
]
|
|
35853
35817
|
}),
|
|
35854
|
-
children: /* @__PURE__ */ (0,
|
|
35818
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(LinkPreviewContent, {
|
|
35855
35819
|
url
|
|
35856
35820
|
})
|
|
35857
35821
|
});
|
|
@@ -35919,22 +35883,22 @@ function validateUrl(url) {
|
|
|
35919
35883
|
}
|
|
35920
35884
|
|
|
35921
35885
|
// src/rich-text-editor/plugins/FloatingLinkEditorPlugin/index.tsx
|
|
35922
|
-
var
|
|
35886
|
+
var import_jsx_runtime127 = require("react/jsx-runtime");
|
|
35923
35887
|
function FloatingLinkEditor({
|
|
35924
35888
|
editor,
|
|
35925
35889
|
isLink,
|
|
35926
35890
|
setIsLink,
|
|
35927
35891
|
anchorElem
|
|
35928
35892
|
}) {
|
|
35929
|
-
const editorRef = (0,
|
|
35930
|
-
const inputRef = (0,
|
|
35931
|
-
const [linkUrl, setLinkUrl] = (0,
|
|
35932
|
-
const [rel, setRel] = (0,
|
|
35933
|
-
const [target, setTarget] = (0,
|
|
35934
|
-
const [isEditMode, setEditMode] = (0,
|
|
35935
|
-
const [lastSelection, setLastSelection] = (0,
|
|
35893
|
+
const editorRef = (0, import_react111.useRef)(null);
|
|
35894
|
+
const inputRef = (0, import_react111.useRef)(null);
|
|
35895
|
+
const [linkUrl, setLinkUrl] = (0, import_react111.useState)("");
|
|
35896
|
+
const [rel, setRel] = (0, import_react111.useState)(null);
|
|
35897
|
+
const [target, setTarget] = (0, import_react111.useState)(null);
|
|
35898
|
+
const [isEditMode, setEditMode] = (0, import_react111.useState)(false);
|
|
35899
|
+
const [lastSelection, setLastSelection] = (0, import_react111.useState)(null);
|
|
35936
35900
|
const tr = useTr();
|
|
35937
|
-
const updateLinkEditor = (0,
|
|
35901
|
+
const updateLinkEditor = (0, import_react111.useCallback)(() => {
|
|
35938
35902
|
const selection = (0, import_lexical8.$getSelection)();
|
|
35939
35903
|
if ((0, import_lexical8.$isRangeSelection)(selection)) {
|
|
35940
35904
|
const node = getSelectedNode(selection);
|
|
@@ -35984,7 +35948,7 @@ function FloatingLinkEditor({
|
|
|
35984
35948
|
}
|
|
35985
35949
|
return true;
|
|
35986
35950
|
}, [anchorElem, editor]);
|
|
35987
|
-
(0,
|
|
35951
|
+
(0, import_react111.useEffect)(() => {
|
|
35988
35952
|
const scrollerElem = anchorElem.parentElement;
|
|
35989
35953
|
const update = () => {
|
|
35990
35954
|
editor.getEditorState().read(() => {
|
|
@@ -36002,7 +35966,7 @@ function FloatingLinkEditor({
|
|
|
36002
35966
|
}
|
|
36003
35967
|
};
|
|
36004
35968
|
}, [anchorElem.parentElement, editor, updateLinkEditor]);
|
|
36005
|
-
(0,
|
|
35969
|
+
(0, import_react111.useEffect)(() => {
|
|
36006
35970
|
return (0, import_utils.mergeRegister)(
|
|
36007
35971
|
editor.registerUpdateListener(({ editorState }) => {
|
|
36008
35972
|
editorState.read(() => {
|
|
@@ -36030,51 +35994,53 @@ function FloatingLinkEditor({
|
|
|
36030
35994
|
)
|
|
36031
35995
|
);
|
|
36032
35996
|
}, [editor, updateLinkEditor, setIsLink, isLink]);
|
|
36033
|
-
(0,
|
|
35997
|
+
(0, import_react111.useEffect)(() => {
|
|
36034
35998
|
editor.getEditorState().read(() => {
|
|
36035
35999
|
updateLinkEditor();
|
|
36036
36000
|
});
|
|
36037
36001
|
}, [editor, updateLinkEditor]);
|
|
36038
|
-
(0,
|
|
36002
|
+
(0, import_react111.useEffect)(() => {
|
|
36039
36003
|
if (isEditMode && inputRef.current) {
|
|
36040
36004
|
inputRef.current.focus();
|
|
36041
36005
|
}
|
|
36042
36006
|
}, [isEditMode]);
|
|
36043
|
-
return /* @__PURE__ */ (0,
|
|
36007
|
+
return /* @__PURE__ */ (0, import_jsx_runtime127.jsx)("div", {
|
|
36044
36008
|
ref: editorRef,
|
|
36045
36009
|
className: "c-rte-link-editor",
|
|
36046
|
-
|
|
36010
|
+
"data-testid": "rich-text-link-editor",
|
|
36011
|
+
children: isEditMode ? /* @__PURE__ */ (0, import_jsx_runtime127.jsxs)("div", {
|
|
36047
36012
|
children: [
|
|
36048
|
-
/* @__PURE__ */ (0,
|
|
36013
|
+
/* @__PURE__ */ (0, import_jsx_runtime127.jsx)("div", {
|
|
36049
36014
|
className: "c-rte-link-editor-input-group",
|
|
36050
|
-
children: /* @__PURE__ */ (0,
|
|
36015
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(InputWithLabel, {
|
|
36051
36016
|
label: tr("linkEditorLink"),
|
|
36052
36017
|
type: "text",
|
|
36053
36018
|
value: linkUrl,
|
|
36054
36019
|
onChange: (e) => setLinkUrl(e.target.value)
|
|
36055
36020
|
})
|
|
36056
36021
|
}),
|
|
36057
|
-
/* @__PURE__ */ (0,
|
|
36022
|
+
/* @__PURE__ */ (0, import_jsx_runtime127.jsx)("div", {
|
|
36058
36023
|
className: "c-rte-link-editor-input-group",
|
|
36059
|
-
children: /* @__PURE__ */ (0,
|
|
36024
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(InputWithLabel, {
|
|
36060
36025
|
label: tr("linkEditorRel"),
|
|
36061
36026
|
type: "text",
|
|
36062
36027
|
value: rel ?? "",
|
|
36063
36028
|
onChange: (e) => setRel(e.target.value)
|
|
36064
36029
|
})
|
|
36065
36030
|
}),
|
|
36066
|
-
/* @__PURE__ */ (0,
|
|
36031
|
+
/* @__PURE__ */ (0, import_jsx_runtime127.jsx)("div", {
|
|
36067
36032
|
className: "c-rte-link-editor-input-group",
|
|
36068
|
-
children: /* @__PURE__ */ (0,
|
|
36033
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(InputWithLabel, {
|
|
36069
36034
|
label: tr("linkEditorTarget"),
|
|
36070
36035
|
type: "text",
|
|
36071
36036
|
value: target ?? "",
|
|
36072
36037
|
onChange: (e) => setTarget(e.target.value)
|
|
36073
36038
|
})
|
|
36074
36039
|
}),
|
|
36075
|
-
/* @__PURE__ */ (0,
|
|
36040
|
+
/* @__PURE__ */ (0, import_jsx_runtime127.jsx)("div", {
|
|
36076
36041
|
className: "c-rte-link-editor-button-wrap",
|
|
36077
|
-
children: /* @__PURE__ */ (0,
|
|
36042
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(Button, {
|
|
36043
|
+
"data-testid": "link-editor-save-button",
|
|
36078
36044
|
onClick: () => {
|
|
36079
36045
|
if (lastSelection !== null) {
|
|
36080
36046
|
if (linkUrl !== "") {
|
|
@@ -36091,28 +36057,28 @@ function FloatingLinkEditor({
|
|
|
36091
36057
|
})
|
|
36092
36058
|
})
|
|
36093
36059
|
]
|
|
36094
|
-
}) : /* @__PURE__ */ (0,
|
|
36060
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime127.jsxs)(import_jsx_runtime127.Fragment, {
|
|
36095
36061
|
children: [
|
|
36096
|
-
/* @__PURE__ */ (0,
|
|
36062
|
+
/* @__PURE__ */ (0, import_jsx_runtime127.jsxs)("div", {
|
|
36097
36063
|
className: "c-rte-link-editor-link-input",
|
|
36098
36064
|
children: [
|
|
36099
|
-
/* @__PURE__ */ (0,
|
|
36065
|
+
/* @__PURE__ */ (0, import_jsx_runtime127.jsxs)("div", {
|
|
36100
36066
|
className: "c-rte-link-editor-link-preview",
|
|
36101
36067
|
children: [
|
|
36102
|
-
/* @__PURE__ */ (0,
|
|
36068
|
+
/* @__PURE__ */ (0, import_jsx_runtime127.jsx)("a", {
|
|
36103
36069
|
href: linkUrl,
|
|
36104
36070
|
target: "_blank",
|
|
36105
36071
|
rel: "noopener noreferrer",
|
|
36106
36072
|
children: linkUrl
|
|
36107
36073
|
}),
|
|
36108
|
-
rel || target ? /* @__PURE__ */ (0,
|
|
36074
|
+
rel || target ? /* @__PURE__ */ (0, import_jsx_runtime127.jsxs)("div", {
|
|
36109
36075
|
className: "c-rte-link-editor-preview-attrs",
|
|
36110
36076
|
children: [
|
|
36111
|
-
rel && /* @__PURE__ */ (0,
|
|
36077
|
+
rel && /* @__PURE__ */ (0, import_jsx_runtime127.jsx)("div", {
|
|
36112
36078
|
className: "c-rte-link-editor-preview-attr",
|
|
36113
36079
|
children: rel
|
|
36114
36080
|
}),
|
|
36115
|
-
target && /* @__PURE__ */ (0,
|
|
36081
|
+
target && /* @__PURE__ */ (0, import_jsx_runtime127.jsx)("div", {
|
|
36116
36082
|
className: "c-rte-link-editor-preview-attr",
|
|
36117
36083
|
children: target
|
|
36118
36084
|
})
|
|
@@ -36120,20 +36086,21 @@ function FloatingLinkEditor({
|
|
|
36120
36086
|
}) : null
|
|
36121
36087
|
]
|
|
36122
36088
|
}),
|
|
36123
|
-
/* @__PURE__ */ (0,
|
|
36124
|
-
children: /* @__PURE__ */ (0,
|
|
36089
|
+
/* @__PURE__ */ (0, import_jsx_runtime127.jsx)("div", {
|
|
36090
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(IconButton, {
|
|
36125
36091
|
size: "sm",
|
|
36126
36092
|
tabIndex: 0,
|
|
36127
36093
|
onMouseDown: (event) => event.preventDefault(),
|
|
36128
36094
|
onClick: () => setEditMode(true),
|
|
36129
36095
|
"aria-label": tr("linkEditorEdit"),
|
|
36130
|
-
|
|
36096
|
+
"data-testid": "link-editor-edit",
|
|
36097
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(Icon.Edit, {})
|
|
36131
36098
|
})
|
|
36132
36099
|
})
|
|
36133
36100
|
]
|
|
36134
36101
|
}),
|
|
36135
|
-
/* @__PURE__ */ (0,
|
|
36136
|
-
children: /* @__PURE__ */ (0,
|
|
36102
|
+
/* @__PURE__ */ (0, import_jsx_runtime127.jsx)("div", {
|
|
36103
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(LinkPreview, {
|
|
36137
36104
|
url: linkUrl
|
|
36138
36105
|
})
|
|
36139
36106
|
})
|
|
@@ -36142,9 +36109,9 @@ function FloatingLinkEditor({
|
|
|
36142
36109
|
});
|
|
36143
36110
|
}
|
|
36144
36111
|
function useFloatingLinkEditorToolbar(editor, anchorElem) {
|
|
36145
|
-
const [activeEditor, setActiveEditor] = (0,
|
|
36146
|
-
const [isLink, setIsLink] = (0,
|
|
36147
|
-
const updateToolbar = (0,
|
|
36112
|
+
const [activeEditor, setActiveEditor] = (0, import_react111.useState)(editor);
|
|
36113
|
+
const [isLink, setIsLink] = (0, import_react111.useState)(false);
|
|
36114
|
+
const updateToolbar = (0, import_react111.useCallback)(() => {
|
|
36148
36115
|
const selection = (0, import_lexical8.$getSelection)();
|
|
36149
36116
|
if ((0, import_lexical8.$isRangeSelection)(selection)) {
|
|
36150
36117
|
const node = getSelectedNode(selection);
|
|
@@ -36157,7 +36124,7 @@ function useFloatingLinkEditorToolbar(editor, anchorElem) {
|
|
|
36157
36124
|
}
|
|
36158
36125
|
}
|
|
36159
36126
|
}, []);
|
|
36160
|
-
(0,
|
|
36127
|
+
(0, import_react111.useEffect)(() => {
|
|
36161
36128
|
return editor.registerCommand(
|
|
36162
36129
|
import_lexical8.SELECTION_CHANGE_COMMAND,
|
|
36163
36130
|
(_payload, newEditor) => {
|
|
@@ -36169,7 +36136,7 @@ function useFloatingLinkEditorToolbar(editor, anchorElem) {
|
|
|
36169
36136
|
);
|
|
36170
36137
|
}, [editor, updateToolbar]);
|
|
36171
36138
|
return isLink ? (0, import_react_dom3.createPortal)(
|
|
36172
|
-
/* @__PURE__ */ (0,
|
|
36139
|
+
/* @__PURE__ */ (0, import_jsx_runtime127.jsx)(FloatingLinkEditor, {
|
|
36173
36140
|
editor: activeEditor,
|
|
36174
36141
|
isLink,
|
|
36175
36142
|
anchorElem,
|
|
@@ -36186,7 +36153,7 @@ function FloatingLinkEditorPlugin({
|
|
|
36186
36153
|
}
|
|
36187
36154
|
|
|
36188
36155
|
// src/rich-text-editor/plugins/FloatingTextFormatToolbarPlugin/index.tsx
|
|
36189
|
-
var
|
|
36156
|
+
var import_react112 = require("react");
|
|
36190
36157
|
var React5 = require("react");
|
|
36191
36158
|
var import_lexical9 = require("lexical");
|
|
36192
36159
|
var import_react_dom4 = require("react-dom");
|
|
@@ -36228,7 +36195,7 @@ function getDOMRangeRect(nativeSelection, rootElement) {
|
|
|
36228
36195
|
}
|
|
36229
36196
|
|
|
36230
36197
|
// src/rich-text-editor/plugins/FloatingTextFormatToolbarPlugin/index.tsx
|
|
36231
|
-
var
|
|
36198
|
+
var import_jsx_runtime128 = require("react/jsx-runtime");
|
|
36232
36199
|
function TextFormatFloatingToolbar({
|
|
36233
36200
|
editor,
|
|
36234
36201
|
anchorElem,
|
|
@@ -36241,16 +36208,16 @@ function TextFormatFloatingToolbar({
|
|
|
36241
36208
|
isSubscript,
|
|
36242
36209
|
isSuperscript
|
|
36243
36210
|
}) {
|
|
36244
|
-
const popupCharStylesEditorRef = (0,
|
|
36211
|
+
const popupCharStylesEditorRef = (0, import_react112.useRef)(null);
|
|
36245
36212
|
const tr = useTr();
|
|
36246
|
-
const insertLink = (0,
|
|
36213
|
+
const insertLink = (0, import_react112.useCallback)(() => {
|
|
36247
36214
|
if (!isLink) {
|
|
36248
36215
|
editor.dispatchCommand(import_link5.TOGGLE_LINK_COMMAND, "https://");
|
|
36249
36216
|
} else {
|
|
36250
36217
|
editor.dispatchCommand(import_link5.TOGGLE_LINK_COMMAND, null);
|
|
36251
36218
|
}
|
|
36252
36219
|
}, [editor, isLink]);
|
|
36253
|
-
const updateTextFormatFloatingToolbar = (0,
|
|
36220
|
+
const updateTextFormatFloatingToolbar = (0, import_react112.useCallback)(() => {
|
|
36254
36221
|
const selection = (0, import_lexical9.$getSelection)();
|
|
36255
36222
|
const popupCharStylesEditorElem = popupCharStylesEditorRef.current;
|
|
36256
36223
|
const nativeSelection = window.getSelection();
|
|
@@ -36263,7 +36230,7 @@ function TextFormatFloatingToolbar({
|
|
|
36263
36230
|
setFloatingElemPosition(rangeRect, popupCharStylesEditorElem, anchorElem);
|
|
36264
36231
|
}
|
|
36265
36232
|
}, [editor, anchorElem]);
|
|
36266
|
-
(0,
|
|
36233
|
+
(0, import_react112.useEffect)(() => {
|
|
36267
36234
|
const scrollerElem = anchorElem.parentElement;
|
|
36268
36235
|
const update = () => {
|
|
36269
36236
|
editor.getEditorState().read(() => {
|
|
@@ -36281,7 +36248,7 @@ function TextFormatFloatingToolbar({
|
|
|
36281
36248
|
}
|
|
36282
36249
|
};
|
|
36283
36250
|
}, [editor, updateTextFormatFloatingToolbar, anchorElem]);
|
|
36284
|
-
(0,
|
|
36251
|
+
(0, import_react112.useEffect)(() => {
|
|
36285
36252
|
editor.getEditorState().read(() => {
|
|
36286
36253
|
updateTextFormatFloatingToolbar();
|
|
36287
36254
|
});
|
|
@@ -36302,110 +36269,110 @@ function TextFormatFloatingToolbar({
|
|
|
36302
36269
|
);
|
|
36303
36270
|
}, [editor, updateTextFormatFloatingToolbar]);
|
|
36304
36271
|
if (!editor.isEditable()) {
|
|
36305
|
-
return /* @__PURE__ */ (0,
|
|
36272
|
+
return /* @__PURE__ */ (0, import_jsx_runtime128.jsx)("span", {});
|
|
36306
36273
|
}
|
|
36307
|
-
return /* @__PURE__ */ (0,
|
|
36274
|
+
return /* @__PURE__ */ (0, import_jsx_runtime128.jsxs)("div", {
|
|
36308
36275
|
ref: popupCharStylesEditorRef,
|
|
36309
36276
|
className: "c-rte-floating-text-format-tb-plugin",
|
|
36310
36277
|
children: [
|
|
36311
|
-
/* @__PURE__ */ (0,
|
|
36278
|
+
/* @__PURE__ */ (0, import_jsx_runtime128.jsx)(IconButton, {
|
|
36312
36279
|
onClick: () => {
|
|
36313
36280
|
editor.dispatchCommand(import_lexical9.FORMAT_TEXT_COMMAND, "bold");
|
|
36314
36281
|
},
|
|
36315
36282
|
style: { padding: 0, overflow: "hidden" },
|
|
36316
36283
|
title: tr(IS_APPLE ? "actionFormatAsStrongTitleApple" : "actionFormatAsStrongTitle"),
|
|
36317
36284
|
"aria-label": tr("actionFormatAsStrongLabel"),
|
|
36318
|
-
children: /* @__PURE__ */ (0,
|
|
36285
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime128.jsx)("i", {
|
|
36319
36286
|
className: `c-rte-icon-bold c-rte-floating-text-format-tb-plugin__format-icon ${isBold ? "selected" : ""}`
|
|
36320
36287
|
})
|
|
36321
36288
|
}),
|
|
36322
|
-
/* @__PURE__ */ (0,
|
|
36289
|
+
/* @__PURE__ */ (0, import_jsx_runtime128.jsx)(IconButton, {
|
|
36323
36290
|
style: { padding: 0, overflow: "hidden" },
|
|
36324
36291
|
onClick: () => {
|
|
36325
36292
|
editor.dispatchCommand(import_lexical9.FORMAT_TEXT_COMMAND, "italic");
|
|
36326
36293
|
},
|
|
36327
36294
|
title: tr("actionFormatAsEmphasizedTitle"),
|
|
36328
36295
|
"aria-label": tr("actionFormatAsEmphasizedLabel"),
|
|
36329
|
-
children: /* @__PURE__ */ (0,
|
|
36296
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime128.jsx)("i", {
|
|
36330
36297
|
className: `c-rte-icon-italic c-rte-floating-text-format-tb-plugin__format-icon ${isItalic ? "selected" : ""}`
|
|
36331
36298
|
})
|
|
36332
36299
|
}),
|
|
36333
|
-
/* @__PURE__ */ (0,
|
|
36300
|
+
/* @__PURE__ */ (0, import_jsx_runtime128.jsx)(IconButton, {
|
|
36334
36301
|
style: { padding: 0, overflow: "hidden" },
|
|
36335
36302
|
onClick: () => {
|
|
36336
36303
|
editor.dispatchCommand(import_lexical9.FORMAT_TEXT_COMMAND, "underline");
|
|
36337
36304
|
},
|
|
36338
36305
|
title: tr("actionFormatAsUnderlinedTitle"),
|
|
36339
36306
|
"aria-label": tr("actionFormatAsUnderlinedLabel"),
|
|
36340
|
-
children: /* @__PURE__ */ (0,
|
|
36307
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime128.jsx)("i", {
|
|
36341
36308
|
className: `c-rte-icon-underline c-rte-floating-text-format-tb-plugin__format-icon ${isUnderline ? "selected" : ""}`
|
|
36342
36309
|
})
|
|
36343
36310
|
}),
|
|
36344
|
-
/* @__PURE__ */ (0,
|
|
36311
|
+
/* @__PURE__ */ (0, import_jsx_runtime128.jsx)(IconButton, {
|
|
36312
|
+
style: { padding: 0, overflow: "hidden" },
|
|
36313
|
+
onClick: () => {
|
|
36314
|
+
editor.dispatchCommand(import_lexical9.FORMAT_TEXT_COMMAND, "code");
|
|
36315
|
+
},
|
|
36316
|
+
"aria-label": tr("actionInsertCodeBlock"),
|
|
36317
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime128.jsx)("i", {
|
|
36318
|
+
className: `c-rte-icon-code c-rte-floating-text-format-tb-plugin__format-icon ${isCode ? "selected" : ""}`
|
|
36319
|
+
})
|
|
36320
|
+
}),
|
|
36321
|
+
/* @__PURE__ */ (0, import_jsx_runtime128.jsx)(IconButton, {
|
|
36322
|
+
style: { padding: 0, overflow: "hidden" },
|
|
36323
|
+
onClick: insertLink,
|
|
36324
|
+
"aria-label": tr("actionInsertlink"),
|
|
36325
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime128.jsx)("i", {
|
|
36326
|
+
className: `c-rte-icon-link c-rte-floating-text-format-tb-plugin__format-icon ${isLink ? "selected" : ""}`
|
|
36327
|
+
})
|
|
36328
|
+
}),
|
|
36329
|
+
/* @__PURE__ */ (0, import_jsx_runtime128.jsx)(IconButton, {
|
|
36345
36330
|
style: { padding: 0, overflow: "hidden" },
|
|
36346
36331
|
onClick: () => {
|
|
36347
36332
|
editor.dispatchCommand(import_lexical9.FORMAT_TEXT_COMMAND, "strikethrough");
|
|
36348
36333
|
},
|
|
36349
36334
|
title: tr("actionFormatWithStrikethroughTitle"),
|
|
36350
36335
|
"aria-label": tr("actionFormatWithStrikethroughLabel"),
|
|
36351
|
-
children: /* @__PURE__ */ (0,
|
|
36336
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime128.jsx)("i", {
|
|
36352
36337
|
className: `c-rte-icon-strikethrough c-rte-floating-text-format-tb-plugin__format-icon ${isStrikethrough ? "selected" : ""}`
|
|
36353
36338
|
})
|
|
36354
36339
|
}),
|
|
36355
|
-
/* @__PURE__ */ (0,
|
|
36340
|
+
/* @__PURE__ */ (0, import_jsx_runtime128.jsx)(IconButton, {
|
|
36356
36341
|
style: { padding: 0, overflow: "hidden" },
|
|
36357
36342
|
onClick: () => {
|
|
36358
36343
|
editor.dispatchCommand(import_lexical9.FORMAT_TEXT_COMMAND, "subscript");
|
|
36359
36344
|
},
|
|
36360
36345
|
title: tr("actionFormatWithSubscriptTitle"),
|
|
36361
36346
|
"aria-label": tr("actionFormatWithSubscriptLabel"),
|
|
36362
|
-
children: /* @__PURE__ */ (0,
|
|
36347
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime128.jsx)("i", {
|
|
36363
36348
|
className: `c-rte-icon-subscript c-rte-floating-text-format-tb-plugin__format-icon ${isSubscript ? "selected" : ""}`
|
|
36364
36349
|
})
|
|
36365
36350
|
}),
|
|
36366
|
-
/* @__PURE__ */ (0,
|
|
36351
|
+
/* @__PURE__ */ (0, import_jsx_runtime128.jsx)(IconButton, {
|
|
36367
36352
|
style: { padding: 0, overflow: "hidden" },
|
|
36368
36353
|
onClick: () => {
|
|
36369
36354
|
editor.dispatchCommand(import_lexical9.FORMAT_TEXT_COMMAND, "superscript");
|
|
36370
36355
|
},
|
|
36371
36356
|
title: tr("actionFormatWithSuperscriptTitle"),
|
|
36372
36357
|
"aria-label": tr("actionFormatWithSuperscriptLabel"),
|
|
36373
|
-
children: /* @__PURE__ */ (0,
|
|
36358
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime128.jsx)("i", {
|
|
36374
36359
|
className: `c-rte-icon-superscript c-rte-floating-text-format-tb-plugin__format-icon ${isSuperscript ? "selected" : ""}`
|
|
36375
36360
|
})
|
|
36376
|
-
}),
|
|
36377
|
-
/* @__PURE__ */ (0, import_jsx_runtime129.jsx)(IconButton, {
|
|
36378
|
-
style: { padding: 0, overflow: "hidden" },
|
|
36379
|
-
onClick: () => {
|
|
36380
|
-
editor.dispatchCommand(import_lexical9.FORMAT_TEXT_COMMAND, "code");
|
|
36381
|
-
},
|
|
36382
|
-
"aria-label": tr("actionInsertCodeBlock"),
|
|
36383
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime129.jsx)("i", {
|
|
36384
|
-
className: `c-rte-icon-code c-rte-floating-text-format-tb-plugin__format-icon ${isCode ? "selected" : ""}`
|
|
36385
|
-
})
|
|
36386
|
-
}),
|
|
36387
|
-
/* @__PURE__ */ (0, import_jsx_runtime129.jsx)(IconButton, {
|
|
36388
|
-
style: { padding: 0, overflow: "hidden" },
|
|
36389
|
-
onClick: insertLink,
|
|
36390
|
-
"aria-label": tr("actionInsertlink"),
|
|
36391
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime129.jsx)("i", {
|
|
36392
|
-
className: `c-rte-icon-link c-rte-floating-text-format-tb-plugin__format-icon ${isLink ? "selected" : ""}`
|
|
36393
|
-
})
|
|
36394
36361
|
})
|
|
36395
36362
|
]
|
|
36396
36363
|
});
|
|
36397
36364
|
}
|
|
36398
36365
|
function useFloatingTextFormatToolbar(editor, anchorElem) {
|
|
36399
|
-
const [isText, setIsText] = (0,
|
|
36400
|
-
const [isLink, setIsLink] = (0,
|
|
36401
|
-
const [isBold, setIsBold] = (0,
|
|
36402
|
-
const [isItalic, setIsItalic] = (0,
|
|
36403
|
-
const [isUnderline, setIsUnderline] = (0,
|
|
36404
|
-
const [isStrikethrough, setIsStrikethrough] = (0,
|
|
36405
|
-
const [isSubscript, setIsSubscript] = (0,
|
|
36406
|
-
const [isSuperscript, setIsSuperscript] = (0,
|
|
36407
|
-
const [isCode, setIsCode] = (0,
|
|
36408
|
-
const updatePopup = (0,
|
|
36366
|
+
const [isText, setIsText] = (0, import_react112.useState)(false);
|
|
36367
|
+
const [isLink, setIsLink] = (0, import_react112.useState)(false);
|
|
36368
|
+
const [isBold, setIsBold] = (0, import_react112.useState)(false);
|
|
36369
|
+
const [isItalic, setIsItalic] = (0, import_react112.useState)(false);
|
|
36370
|
+
const [isUnderline, setIsUnderline] = (0, import_react112.useState)(false);
|
|
36371
|
+
const [isStrikethrough, setIsStrikethrough] = (0, import_react112.useState)(false);
|
|
36372
|
+
const [isSubscript, setIsSubscript] = (0, import_react112.useState)(false);
|
|
36373
|
+
const [isSuperscript, setIsSuperscript] = (0, import_react112.useState)(false);
|
|
36374
|
+
const [isCode, setIsCode] = (0, import_react112.useState)(false);
|
|
36375
|
+
const updatePopup = (0, import_react112.useCallback)(() => {
|
|
36409
36376
|
editor.getEditorState().read(() => {
|
|
36410
36377
|
if (editor.isComposing()) {
|
|
36411
36378
|
return;
|
|
@@ -36441,13 +36408,13 @@ function useFloatingTextFormatToolbar(editor, anchorElem) {
|
|
|
36441
36408
|
}
|
|
36442
36409
|
});
|
|
36443
36410
|
}, [editor]);
|
|
36444
|
-
(0,
|
|
36411
|
+
(0, import_react112.useEffect)(() => {
|
|
36445
36412
|
document.addEventListener("selectionchange", updatePopup);
|
|
36446
36413
|
return () => {
|
|
36447
36414
|
document.removeEventListener("selectionchange", updatePopup);
|
|
36448
36415
|
};
|
|
36449
36416
|
}, [updatePopup]);
|
|
36450
|
-
(0,
|
|
36417
|
+
(0, import_react112.useEffect)(() => {
|
|
36451
36418
|
return (0, import_utils2.mergeRegister)(
|
|
36452
36419
|
editor.registerUpdateListener(() => {
|
|
36453
36420
|
updatePopup();
|
|
@@ -36463,7 +36430,7 @@ function useFloatingTextFormatToolbar(editor, anchorElem) {
|
|
|
36463
36430
|
return null;
|
|
36464
36431
|
}
|
|
36465
36432
|
return (0, import_react_dom4.createPortal)(
|
|
36466
|
-
/* @__PURE__ */ (0,
|
|
36433
|
+
/* @__PURE__ */ (0, import_jsx_runtime128.jsx)(TextFormatFloatingToolbar, {
|
|
36467
36434
|
editor,
|
|
36468
36435
|
anchorElem,
|
|
36469
36436
|
isLink,
|
|
@@ -36488,15 +36455,15 @@ function FloatingTextFormatToolbarPlugin({
|
|
|
36488
36455
|
// src/rich-text-editor/plugins/LinkPlugin/index.tsx
|
|
36489
36456
|
var React6 = require("react");
|
|
36490
36457
|
var import_LexicalLinkPlugin = require("@lexical/react/LexicalLinkPlugin");
|
|
36491
|
-
var
|
|
36458
|
+
var import_jsx_runtime129 = require("react/jsx-runtime");
|
|
36492
36459
|
function LinkPlugin() {
|
|
36493
|
-
return /* @__PURE__ */ (0,
|
|
36460
|
+
return /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(import_LexicalLinkPlugin.LinkPlugin, {
|
|
36494
36461
|
validateUrl
|
|
36495
36462
|
});
|
|
36496
36463
|
}
|
|
36497
36464
|
|
|
36498
36465
|
// src/rich-text-editor/plugins/ListMaxIndentLevelPlugin/index.ts
|
|
36499
|
-
var
|
|
36466
|
+
var import_react113 = require("react");
|
|
36500
36467
|
var import_lexical10 = require("lexical");
|
|
36501
36468
|
var import_list4 = require("@lexical/list");
|
|
36502
36469
|
var import_LexicalComposerContext6 = require("@lexical/react/LexicalComposerContext");
|
|
@@ -36529,7 +36496,7 @@ function isIndentPermitted(maxDepth) {
|
|
|
36529
36496
|
}
|
|
36530
36497
|
function ListMaxIndentLevelPlugin({ maxDepth }) {
|
|
36531
36498
|
const [editor] = (0, import_LexicalComposerContext6.useLexicalComposerContext)();
|
|
36532
|
-
(0,
|
|
36499
|
+
(0, import_react113.useEffect)(() => {
|
|
36533
36500
|
return editor.registerCommand(
|
|
36534
36501
|
import_lexical10.INDENT_CONTENT_COMMAND,
|
|
36535
36502
|
() => !isIndentPermitted(maxDepth ?? 7),
|
|
@@ -36540,7 +36507,7 @@ function ListMaxIndentLevelPlugin({ maxDepth }) {
|
|
|
36540
36507
|
}
|
|
36541
36508
|
|
|
36542
36509
|
// src/rich-text-editor/plugins/MaxLengthPlugin/index.tsx
|
|
36543
|
-
var
|
|
36510
|
+
var import_react114 = require("react");
|
|
36544
36511
|
var import_lexical11 = require("lexical");
|
|
36545
36512
|
var import_LexicalComposerContext7 = require("@lexical/react/LexicalComposerContext");
|
|
36546
36513
|
var import_selection3 = require("@lexical/selection");
|
|
@@ -36582,7 +36549,7 @@ ${content}
|
|
|
36582
36549
|
// src/rich-text-editor/plugins/MaxLengthPlugin/index.tsx
|
|
36583
36550
|
function MaxLengthPlugin({ maxLength }) {
|
|
36584
36551
|
const [editor] = (0, import_LexicalComposerContext7.useLexicalComposerContext)();
|
|
36585
|
-
(0,
|
|
36552
|
+
(0, import_react114.useEffect)(() => {
|
|
36586
36553
|
let lastRestoredEditorState = null;
|
|
36587
36554
|
return editor.registerUpdateListener(({ editorState, prevEditorState }) => {
|
|
36588
36555
|
editor.update(() => {
|
|
@@ -36612,7 +36579,7 @@ function MaxLengthPlugin({ maxLength }) {
|
|
|
36612
36579
|
}
|
|
36613
36580
|
|
|
36614
36581
|
// src/rich-text-editor/plugins/TabFocusPlugin/index.tsx
|
|
36615
|
-
var
|
|
36582
|
+
var import_react115 = require("react");
|
|
36616
36583
|
var import_lexical12 = require("lexical");
|
|
36617
36584
|
var import_LexicalComposerContext8 = require("@lexical/react/LexicalComposerContext");
|
|
36618
36585
|
var COMMAND_PRIORITY_LOW3 = 1;
|
|
@@ -36632,7 +36599,7 @@ function registerKeyTimeStampTracker() {
|
|
|
36632
36599
|
}
|
|
36633
36600
|
function TabFocusPlugin() {
|
|
36634
36601
|
const [editor] = (0, import_LexicalComposerContext8.useLexicalComposerContext)();
|
|
36635
|
-
(0,
|
|
36602
|
+
(0, import_react115.useEffect)(() => {
|
|
36636
36603
|
if (!hasRegisteredKeyDownListener) {
|
|
36637
36604
|
registerKeyTimeStampTracker();
|
|
36638
36605
|
hasRegisteredKeyDownListener = true;
|
|
@@ -36655,22 +36622,22 @@ function TabFocusPlugin() {
|
|
|
36655
36622
|
}
|
|
36656
36623
|
|
|
36657
36624
|
// src/rich-text-editor/plugins/TableActionMenuPlugin/index.tsx
|
|
36658
|
-
var
|
|
36625
|
+
var import_react116 = require("react");
|
|
36659
36626
|
var import_lexical13 = require("lexical");
|
|
36660
36627
|
var import_react_dom5 = require("react-dom");
|
|
36661
36628
|
var import_LexicalComposerContext9 = require("@lexical/react/LexicalComposerContext");
|
|
36662
36629
|
var import_useLexicalEditable = __toESM(require("@lexical/react/useLexicalEditable"));
|
|
36663
36630
|
var import_table4 = require("@lexical/table");
|
|
36664
|
-
var
|
|
36631
|
+
var import_jsx_runtime130 = require("react/jsx-runtime");
|
|
36665
36632
|
function TableActionMenu({ tableCellNode: _tableCellNode, tableStats }) {
|
|
36666
36633
|
const [editor] = (0, import_LexicalComposerContext9.useLexicalComposerContext)();
|
|
36667
|
-
const [tableCellNode, updateTableCellNode] = (0,
|
|
36668
|
-
const [selectionCounts, updateSelectionCounts] = (0,
|
|
36634
|
+
const [tableCellNode, updateTableCellNode] = (0, import_react116.useState)(_tableCellNode);
|
|
36635
|
+
const [selectionCounts, updateSelectionCounts] = (0, import_react116.useState)({
|
|
36669
36636
|
columns: 1,
|
|
36670
36637
|
rows: 1
|
|
36671
36638
|
});
|
|
36672
36639
|
const tr = useTr();
|
|
36673
|
-
(0,
|
|
36640
|
+
(0, import_react116.useEffect)(() => {
|
|
36674
36641
|
return editor.registerMutationListener(import_table4.TableCellNode, (nodeMutations) => {
|
|
36675
36642
|
const nodeUpdated = nodeMutations.get(tableCellNode.getKey()) === "updated";
|
|
36676
36643
|
if (nodeUpdated) {
|
|
@@ -36680,7 +36647,7 @@ function TableActionMenu({ tableCellNode: _tableCellNode, tableStats }) {
|
|
|
36680
36647
|
}
|
|
36681
36648
|
});
|
|
36682
36649
|
}, [editor, tableCellNode]);
|
|
36683
|
-
(0,
|
|
36650
|
+
(0, import_react116.useEffect)(() => {
|
|
36684
36651
|
editor.getEditorState().read(() => {
|
|
36685
36652
|
const selection = (0, import_lexical13.$getSelection)();
|
|
36686
36653
|
if ((0, import_lexical13.DEPRECATED_$isGridSelection)(selection)) {
|
|
@@ -36692,7 +36659,7 @@ function TableActionMenu({ tableCellNode: _tableCellNode, tableStats }) {
|
|
|
36692
36659
|
}
|
|
36693
36660
|
});
|
|
36694
36661
|
}, [editor]);
|
|
36695
|
-
const clearTableSelection = (0,
|
|
36662
|
+
const clearTableSelection = (0, import_react116.useCallback)(() => {
|
|
36696
36663
|
editor.update(() => {
|
|
36697
36664
|
if (tableCellNode.isAttached()) {
|
|
36698
36665
|
const tableNode = (0, import_table4.$getTableNodeFromLexicalNodeOrThrow)(tableCellNode);
|
|
@@ -36711,7 +36678,7 @@ function TableActionMenu({ tableCellNode: _tableCellNode, tableStats }) {
|
|
|
36711
36678
|
rootNode.selectStart();
|
|
36712
36679
|
});
|
|
36713
36680
|
}, [editor, tableCellNode]);
|
|
36714
|
-
const insertTableRowAtSelection = (0,
|
|
36681
|
+
const insertTableRowAtSelection = (0, import_react116.useCallback)(
|
|
36715
36682
|
(shouldInsertAfter) => {
|
|
36716
36683
|
editor.update(() => {
|
|
36717
36684
|
const selection = (0, import_lexical13.$getSelection)();
|
|
@@ -36730,7 +36697,7 @@ function TableActionMenu({ tableCellNode: _tableCellNode, tableStats }) {
|
|
|
36730
36697
|
},
|
|
36731
36698
|
[editor, tableCellNode, selectionCounts.rows, clearTableSelection]
|
|
36732
36699
|
);
|
|
36733
|
-
const insertTableColumnAtSelection = (0,
|
|
36700
|
+
const insertTableColumnAtSelection = (0, import_react116.useCallback)(
|
|
36734
36701
|
(shouldInsertAfter) => {
|
|
36735
36702
|
editor.update(() => {
|
|
36736
36703
|
const selection = (0, import_lexical13.$getSelection)();
|
|
@@ -36749,7 +36716,7 @@ function TableActionMenu({ tableCellNode: _tableCellNode, tableStats }) {
|
|
|
36749
36716
|
},
|
|
36750
36717
|
[editor, tableCellNode, selectionCounts.columns, clearTableSelection]
|
|
36751
36718
|
);
|
|
36752
|
-
const deleteTableRowAtSelection = (0,
|
|
36719
|
+
const deleteTableRowAtSelection = (0, import_react116.useCallback)(() => {
|
|
36753
36720
|
editor.update(() => {
|
|
36754
36721
|
const tableNode = (0, import_table4.$getTableNodeFromLexicalNodeOrThrow)(tableCellNode);
|
|
36755
36722
|
const tableRowIndex = (0, import_table4.$getTableRowIndexFromTableCellNode)(tableCellNode);
|
|
@@ -36757,14 +36724,14 @@ function TableActionMenu({ tableCellNode: _tableCellNode, tableStats }) {
|
|
|
36757
36724
|
clearTableSelection();
|
|
36758
36725
|
});
|
|
36759
36726
|
}, [editor, tableCellNode, clearTableSelection]);
|
|
36760
|
-
const deleteTableAtSelection = (0,
|
|
36727
|
+
const deleteTableAtSelection = (0, import_react116.useCallback)(() => {
|
|
36761
36728
|
editor.update(() => {
|
|
36762
36729
|
const tableNode = (0, import_table4.$getTableNodeFromLexicalNodeOrThrow)(tableCellNode);
|
|
36763
36730
|
tableNode.remove();
|
|
36764
36731
|
clearTableSelection();
|
|
36765
36732
|
});
|
|
36766
36733
|
}, [editor, tableCellNode, clearTableSelection]);
|
|
36767
|
-
const deleteTableColumnAtSelection = (0,
|
|
36734
|
+
const deleteTableColumnAtSelection = (0, import_react116.useCallback)(() => {
|
|
36768
36735
|
editor.update(() => {
|
|
36769
36736
|
const tableNode = (0, import_table4.$getTableNodeFromLexicalNodeOrThrow)(tableCellNode);
|
|
36770
36737
|
const tableColumnIndex = (0, import_table4.$getTableColumnIndexFromTableCellNode)(tableCellNode);
|
|
@@ -36772,7 +36739,7 @@ function TableActionMenu({ tableCellNode: _tableCellNode, tableStats }) {
|
|
|
36772
36739
|
clearTableSelection();
|
|
36773
36740
|
});
|
|
36774
36741
|
}, [editor, tableCellNode, clearTableSelection]);
|
|
36775
|
-
const toggleTableRowIsHeader = (0,
|
|
36742
|
+
const toggleTableRowIsHeader = (0, import_react116.useCallback)(() => {
|
|
36776
36743
|
editor.update(() => {
|
|
36777
36744
|
const tableNode = (0, import_table4.$getTableNodeFromLexicalNodeOrThrow)(tableCellNode);
|
|
36778
36745
|
const tableRowIndex = (0, import_table4.$getTableRowIndexFromTableCellNode)(tableCellNode);
|
|
@@ -36793,7 +36760,7 @@ function TableActionMenu({ tableCellNode: _tableCellNode, tableStats }) {
|
|
|
36793
36760
|
clearTableSelection();
|
|
36794
36761
|
});
|
|
36795
36762
|
}, [editor, tableCellNode, clearTableSelection]);
|
|
36796
|
-
const toggleTableColumnIsHeader = (0,
|
|
36763
|
+
const toggleTableColumnIsHeader = (0, import_react116.useCallback)(() => {
|
|
36797
36764
|
editor.update(() => {
|
|
36798
36765
|
const tableNode = (0, import_table4.$getTableNodeFromLexicalNodeOrThrow)(tableCellNode);
|
|
36799
36766
|
const tableColumnIndex = (0, import_table4.$getTableColumnIndexFromTableCellNode)(tableCellNode);
|
|
@@ -36816,46 +36783,46 @@ function TableActionMenu({ tableCellNode: _tableCellNode, tableStats }) {
|
|
|
36816
36783
|
clearTableSelection();
|
|
36817
36784
|
});
|
|
36818
36785
|
}, [editor, tableCellNode, clearTableSelection]);
|
|
36819
|
-
return /* @__PURE__ */ (0,
|
|
36786
|
+
return /* @__PURE__ */ (0, import_jsx_runtime130.jsxs)(import_jsx_runtime130.Fragment, {
|
|
36820
36787
|
children: [
|
|
36821
|
-
/* @__PURE__ */ (0,
|
|
36788
|
+
/* @__PURE__ */ (0, import_jsx_runtime130.jsx)(DropdownMenu.Item, {
|
|
36822
36789
|
onSelect: () => insertTableRowAtSelection(false),
|
|
36823
36790
|
children: tr("actionTableInsertRowsAbove", selectionCounts.rows)
|
|
36824
36791
|
}),
|
|
36825
|
-
/* @__PURE__ */ (0,
|
|
36792
|
+
/* @__PURE__ */ (0, import_jsx_runtime130.jsx)(DropdownMenu.Item, {
|
|
36826
36793
|
onSelect: () => insertTableRowAtSelection(true),
|
|
36827
36794
|
children: tr("actionTableInsertRowsBelow", selectionCounts.rows)
|
|
36828
36795
|
}),
|
|
36829
|
-
/* @__PURE__ */ (0,
|
|
36796
|
+
/* @__PURE__ */ (0, import_jsx_runtime130.jsx)(DropdownMenu.Item, {
|
|
36830
36797
|
onSelect: () => insertTableColumnAtSelection(false),
|
|
36831
36798
|
children: tr("actionTableInsertColumnsBefore", selectionCounts.columns)
|
|
36832
36799
|
}),
|
|
36833
|
-
/* @__PURE__ */ (0,
|
|
36800
|
+
/* @__PURE__ */ (0, import_jsx_runtime130.jsx)(DropdownMenu.Item, {
|
|
36834
36801
|
onSelect: () => insertTableColumnAtSelection(true),
|
|
36835
36802
|
children: tr("actionTableInsertColumnsAfter", selectionCounts.columns)
|
|
36836
36803
|
}),
|
|
36837
|
-
/* @__PURE__ */ (0,
|
|
36804
|
+
/* @__PURE__ */ (0, import_jsx_runtime130.jsx)(DropdownMenu.Item, {
|
|
36838
36805
|
onSelect: () => toggleTableRowIsHeader(),
|
|
36839
36806
|
children: tr(
|
|
36840
36807
|
(tableCellNode.__headerState & import_table4.TableCellHeaderStates.ROW) === import_table4.TableCellHeaderStates.ROW ? "actionTableRemoveRowHeader" : "actionTableAddRowHeader"
|
|
36841
36808
|
)
|
|
36842
36809
|
}),
|
|
36843
|
-
/* @__PURE__ */ (0,
|
|
36810
|
+
/* @__PURE__ */ (0, import_jsx_runtime130.jsx)(DropdownMenu.Item, {
|
|
36844
36811
|
onSelect: () => toggleTableColumnIsHeader(),
|
|
36845
36812
|
children: tr(
|
|
36846
36813
|
(tableCellNode.__headerState & import_table4.TableCellHeaderStates.COLUMN) === import_table4.TableCellHeaderStates.COLUMN ? "actionTableRemoveColumnHeader" : "actionTableAddColumnHeader"
|
|
36847
36814
|
)
|
|
36848
36815
|
}),
|
|
36849
|
-
/* @__PURE__ */ (0,
|
|
36850
|
-
tableStats.columns > 1 && /* @__PURE__ */ (0,
|
|
36816
|
+
/* @__PURE__ */ (0, import_jsx_runtime130.jsx)(DropdownMenu.Separator, {}),
|
|
36817
|
+
tableStats.columns > 1 && /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(DropdownMenu.Item, {
|
|
36851
36818
|
onSelect: () => deleteTableColumnAtSelection(),
|
|
36852
36819
|
children: tr("actionTableDeleteColumn")
|
|
36853
36820
|
}),
|
|
36854
|
-
tableStats.rows > 1 && /* @__PURE__ */ (0,
|
|
36821
|
+
tableStats.rows > 1 && /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(DropdownMenu.Item, {
|
|
36855
36822
|
onSelect: () => deleteTableRowAtSelection(),
|
|
36856
36823
|
children: tr("actionTableDeleteRow")
|
|
36857
36824
|
}),
|
|
36858
|
-
/* @__PURE__ */ (0,
|
|
36825
|
+
/* @__PURE__ */ (0, import_jsx_runtime130.jsx)(DropdownMenu.Item, {
|
|
36859
36826
|
onSelect: () => deleteTableAtSelection(),
|
|
36860
36827
|
children: tr("actionTableDeleteTable")
|
|
36861
36828
|
})
|
|
@@ -36865,11 +36832,11 @@ function TableActionMenu({ tableCellNode: _tableCellNode, tableStats }) {
|
|
|
36865
36832
|
function TableCellActionMenuContainer({ anchorElem }) {
|
|
36866
36833
|
const [editor] = (0, import_LexicalComposerContext9.useLexicalComposerContext)();
|
|
36867
36834
|
const tr = useTr();
|
|
36868
|
-
const menuButtonRef = (0,
|
|
36869
|
-
const [isMenuOpen, setIsMenuOpen] = (0,
|
|
36870
|
-
const [tableCellNode, setTableMenuCellNode] = (0,
|
|
36871
|
-
const [tableStats, setTablestats] = (0,
|
|
36872
|
-
const moveMenu = (0,
|
|
36835
|
+
const menuButtonRef = (0, import_react116.useRef)(null);
|
|
36836
|
+
const [isMenuOpen, setIsMenuOpen] = (0, import_react116.useState)(false);
|
|
36837
|
+
const [tableCellNode, setTableMenuCellNode] = (0, import_react116.useState)(null);
|
|
36838
|
+
const [tableStats, setTablestats] = (0, import_react116.useState)({ rows: 1, columns: 1 });
|
|
36839
|
+
const moveMenu = (0, import_react116.useCallback)(() => {
|
|
36873
36840
|
if (isMenuOpen) {
|
|
36874
36841
|
return;
|
|
36875
36842
|
}
|
|
@@ -36912,14 +36879,14 @@ function TableCellActionMenuContainer({ anchorElem }) {
|
|
|
36912
36879
|
setTableMenuCellNode(null);
|
|
36913
36880
|
}
|
|
36914
36881
|
}, [editor, isMenuOpen]);
|
|
36915
|
-
(0,
|
|
36882
|
+
(0, import_react116.useEffect)(() => {
|
|
36916
36883
|
return editor.registerUpdateListener(() => {
|
|
36917
36884
|
editor.getEditorState().read(() => {
|
|
36918
36885
|
moveMenu();
|
|
36919
36886
|
});
|
|
36920
36887
|
});
|
|
36921
36888
|
});
|
|
36922
|
-
(0,
|
|
36889
|
+
(0, import_react116.useEffect)(() => {
|
|
36923
36890
|
const menuButtonDOM = menuButtonRef.current;
|
|
36924
36891
|
if (menuButtonDOM != null && tableCellNode != null) {
|
|
36925
36892
|
const tableCellNodeDOM = editor.getElementByKey(tableCellNode.getKey());
|
|
@@ -36937,19 +36904,19 @@ function TableCellActionMenuContainer({ anchorElem }) {
|
|
|
36937
36904
|
}
|
|
36938
36905
|
}
|
|
36939
36906
|
}, [menuButtonRef, tableCellNode, editor, anchorElem]);
|
|
36940
|
-
return /* @__PURE__ */ (0,
|
|
36907
|
+
return /* @__PURE__ */ (0, import_jsx_runtime130.jsx)("div", {
|
|
36941
36908
|
className: "c-rte-table-cell-action-button-container",
|
|
36942
36909
|
ref: menuButtonRef,
|
|
36943
|
-
children: tableCellNode != null && /* @__PURE__ */ (0,
|
|
36910
|
+
children: tableCellNode != null && /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(DropdownMenu.Root, {
|
|
36944
36911
|
onOpenChange: (isOpen) => setIsMenuOpen(isOpen),
|
|
36945
|
-
content: /* @__PURE__ */ (0,
|
|
36912
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(TableActionMenu, {
|
|
36946
36913
|
tableCellNode,
|
|
36947
36914
|
tableStats
|
|
36948
36915
|
}),
|
|
36949
|
-
children: /* @__PURE__ */ (0,
|
|
36916
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(IconButton, {
|
|
36950
36917
|
size: "xs",
|
|
36951
36918
|
"aria-label": tr("actionTableOpenOptions"),
|
|
36952
|
-
children: /* @__PURE__ */ (0,
|
|
36919
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(Icon.Arrow, {})
|
|
36953
36920
|
})
|
|
36954
36921
|
})
|
|
36955
36922
|
});
|
|
@@ -36958,13 +36925,13 @@ function TableActionMenuPlugin({
|
|
|
36958
36925
|
anchorElem = document.body
|
|
36959
36926
|
}) {
|
|
36960
36927
|
const isEditable = (0, import_useLexicalEditable.default)();
|
|
36961
|
-
return (0, import_react_dom5.createPortal)(isEditable ? /* @__PURE__ */ (0,
|
|
36928
|
+
return (0, import_react_dom5.createPortal)(isEditable ? /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(TableCellActionMenuContainer, {
|
|
36962
36929
|
anchorElem
|
|
36963
36930
|
}) : null, anchorElem);
|
|
36964
36931
|
}
|
|
36965
36932
|
|
|
36966
36933
|
// src/rich-text-editor/plugins/ToolbarPlugin/index.tsx
|
|
36967
|
-
var
|
|
36934
|
+
var import_react118 = require("react");
|
|
36968
36935
|
var import_lexical15 = require("lexical");
|
|
36969
36936
|
var import_code9 = require("@lexical/code");
|
|
36970
36937
|
var import_link6 = require("@lexical/link");
|
|
@@ -36977,10 +36944,9 @@ var import_selection4 = require("@lexical/selection");
|
|
|
36977
36944
|
var import_utils4 = require("@lexical/utils");
|
|
36978
36945
|
|
|
36979
36946
|
// src/rich-text-editor/plugins/ActionsPlugin/index.tsx
|
|
36980
|
-
var import_react118 = require("react");
|
|
36981
36947
|
var import_lexical14 = require("lexical");
|
|
36982
36948
|
var import_LexicalComposerContext10 = require("@lexical/react/LexicalComposerContext");
|
|
36983
|
-
var
|
|
36949
|
+
var import_jsx_runtime131 = require("react/jsx-runtime");
|
|
36984
36950
|
async function copyJson(editor) {
|
|
36985
36951
|
const json = lexicalToCrystallizeRichText({ editor, editorState: editor.getEditorState() });
|
|
36986
36952
|
try {
|
|
@@ -36995,47 +36961,41 @@ function ActionsPlugin({
|
|
|
36995
36961
|
}) {
|
|
36996
36962
|
const [editor] = (0, import_LexicalComposerContext10.useLexicalComposerContext)();
|
|
36997
36963
|
const tr = useTr();
|
|
36998
|
-
|
|
36999
|
-
|
|
37000
|
-
|
|
37001
|
-
|
|
37002
|
-
|
|
37003
|
-
|
|
37004
|
-
|
|
37005
|
-
|
|
37006
|
-
|
|
37007
|
-
|
|
37008
|
-
|
|
37009
|
-
|
|
37010
|
-
|
|
37011
|
-
|
|
37012
|
-
|
|
37013
|
-
|
|
37014
|
-
|
|
37015
|
-
|
|
37016
|
-
|
|
37017
|
-
|
|
37018
|
-
|
|
37019
|
-
|
|
37020
|
-
|
|
37021
|
-
|
|
37022
|
-
|
|
37023
|
-
onSelect: actionItem.action,
|
|
37024
|
-
className: actionItem.type === "danger" ? "danger" : "",
|
|
37025
|
-
children: actionItem.title
|
|
37026
|
-
}, actionItem.title))
|
|
37027
|
-
]
|
|
37028
|
-
})
|
|
36964
|
+
return /* @__PURE__ */ (0, import_jsx_runtime131.jsxs)(ActionMenu, {
|
|
36965
|
+
children: [
|
|
36966
|
+
!prepend ? null : prepend.map((actionItem) => /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(ActionMenu.Item, {
|
|
36967
|
+
onSelect: actionItem.action,
|
|
36968
|
+
className: actionItem.type === "danger" ? "danger" : "",
|
|
36969
|
+
children: actionItem.title
|
|
36970
|
+
}, actionItem.title)),
|
|
36971
|
+
/* @__PURE__ */ (0, import_jsx_runtime131.jsx)(ActionMenu.Item, {
|
|
36972
|
+
onSelect: () => copyJson(editor),
|
|
36973
|
+
children: tr("actionCopyJSON")
|
|
36974
|
+
}),
|
|
36975
|
+
/* @__PURE__ */ (0, import_jsx_runtime131.jsx)(ActionMenu.Item, {
|
|
36976
|
+
className: "danger",
|
|
36977
|
+
onSelect: () => {
|
|
36978
|
+
editor.dispatchCommand(import_lexical14.CLEAR_EDITOR_COMMAND, void 0);
|
|
36979
|
+
editor.focus();
|
|
36980
|
+
},
|
|
36981
|
+
children: tr("actionClear")
|
|
36982
|
+
}),
|
|
36983
|
+
!append ? null : append.map((actionItem) => /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(ActionMenu.Item, {
|
|
36984
|
+
onSelect: actionItem.action,
|
|
36985
|
+
className: actionItem.type === "danger" ? "danger" : "",
|
|
36986
|
+
children: actionItem.title
|
|
36987
|
+
}, actionItem.title))
|
|
36988
|
+
]
|
|
37029
36989
|
});
|
|
37030
36990
|
}
|
|
37031
36991
|
|
|
37032
36992
|
// src/rich-text-editor/plugins/ToolbarPlugin/insert-table.tsx
|
|
37033
|
-
var
|
|
36993
|
+
var import_react117 = require("react");
|
|
37034
36994
|
var import_table5 = require("@lexical/table");
|
|
37035
|
-
var
|
|
36995
|
+
var import_jsx_runtime132 = require("react/jsx-runtime");
|
|
37036
36996
|
function InsertTableDialog({ activeEditor }) {
|
|
37037
|
-
const [rows, setRows] = (0,
|
|
37038
|
-
const [columns, setColumns] = (0,
|
|
36997
|
+
const [rows, setRows] = (0, import_react117.useState)("5");
|
|
36998
|
+
const [columns, setColumns] = (0, import_react117.useState)("5");
|
|
37039
36999
|
const tr = useTr();
|
|
37040
37000
|
const onClick = () => {
|
|
37041
37001
|
if (parseInt(rows) < 1 || parseInt(columns) < 1) {
|
|
@@ -37050,13 +37010,13 @@ function InsertTableDialog({ activeEditor }) {
|
|
|
37050
37010
|
}
|
|
37051
37011
|
});
|
|
37052
37012
|
};
|
|
37053
|
-
return /* @__PURE__ */ (0,
|
|
37013
|
+
return /* @__PURE__ */ (0, import_jsx_runtime132.jsxs)("div", {
|
|
37054
37014
|
className: "c-rte-insert-table",
|
|
37055
37015
|
children: [
|
|
37056
|
-
/* @__PURE__ */ (0,
|
|
37016
|
+
/* @__PURE__ */ (0, import_jsx_runtime132.jsxs)("div", {
|
|
37057
37017
|
className: "c-rte-insert-table__dimensions",
|
|
37058
37018
|
children: [
|
|
37059
|
-
/* @__PURE__ */ (0,
|
|
37019
|
+
/* @__PURE__ */ (0, import_jsx_runtime132.jsx)(InputWithLabel, {
|
|
37060
37020
|
label: tr("insertTableRows"),
|
|
37061
37021
|
value: rows,
|
|
37062
37022
|
placeholder: "0",
|
|
@@ -37064,10 +37024,10 @@ function InsertTableDialog({ activeEditor }) {
|
|
|
37064
37024
|
inputMode: "numeric",
|
|
37065
37025
|
onChange: (e) => setRows(e.target.value)
|
|
37066
37026
|
}),
|
|
37067
|
-
/* @__PURE__ */ (0,
|
|
37027
|
+
/* @__PURE__ */ (0, import_jsx_runtime132.jsx)("span", {
|
|
37068
37028
|
className: "c-rte-insert-table__dimensions__separator"
|
|
37069
37029
|
}),
|
|
37070
|
-
/* @__PURE__ */ (0,
|
|
37030
|
+
/* @__PURE__ */ (0, import_jsx_runtime132.jsx)(InputWithLabel, {
|
|
37071
37031
|
type: "text",
|
|
37072
37032
|
label: tr("insertTableColumns"),
|
|
37073
37033
|
placeholder: "0",
|
|
@@ -37077,9 +37037,9 @@ function InsertTableDialog({ activeEditor }) {
|
|
|
37077
37037
|
})
|
|
37078
37038
|
]
|
|
37079
37039
|
}),
|
|
37080
|
-
/* @__PURE__ */ (0,
|
|
37040
|
+
/* @__PURE__ */ (0, import_jsx_runtime132.jsx)("div", {
|
|
37081
37041
|
className: "c-rte-insert-table__actions",
|
|
37082
|
-
children: /* @__PURE__ */ (0,
|
|
37042
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(Button, {
|
|
37083
37043
|
as: Dialog.Close,
|
|
37084
37044
|
size: "sm",
|
|
37085
37045
|
intent: "action",
|
|
@@ -37093,7 +37053,7 @@ function InsertTableDialog({ activeEditor }) {
|
|
|
37093
37053
|
}
|
|
37094
37054
|
|
|
37095
37055
|
// src/rich-text-editor/plugins/ToolbarPlugin/index.tsx
|
|
37096
|
-
var
|
|
37056
|
+
var import_jsx_runtime133 = require("react/jsx-runtime");
|
|
37097
37057
|
var headingTypeToBlockName = {
|
|
37098
37058
|
h1: "Heading 1",
|
|
37099
37059
|
h2: "Heading 2",
|
|
@@ -37197,80 +37157,80 @@ function BlockFormatDropDown({
|
|
|
37197
37157
|
});
|
|
37198
37158
|
}
|
|
37199
37159
|
};
|
|
37200
|
-
return /* @__PURE__ */ (0,
|
|
37160
|
+
return /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(DropdownMenu.Root, {
|
|
37201
37161
|
disabled,
|
|
37202
37162
|
style: { zIndex: 1 },
|
|
37203
|
-
content: /* @__PURE__ */ (0,
|
|
37163
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)(import_jsx_runtime133.Fragment, {
|
|
37204
37164
|
children: [
|
|
37205
|
-
/* @__PURE__ */ (0,
|
|
37165
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsxs)(DropdownMenu.Item, {
|
|
37206
37166
|
onClick: formatParagraph,
|
|
37207
37167
|
children: [
|
|
37208
|
-
/* @__PURE__ */ (0,
|
|
37168
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)("i", {
|
|
37209
37169
|
className: `c-rte-icon-paragraph c-rte-toolbar__block-format__icon ${blockType === "paragraph" ? "selected" : ""}`
|
|
37210
37170
|
}),
|
|
37211
|
-
/* @__PURE__ */ (0,
|
|
37171
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)("span", {
|
|
37212
37172
|
className: `c-rte-toolbar__block-format__text ${blockType === "paragraph" ? "selected" : ""}`,
|
|
37213
37173
|
children: "Normal"
|
|
37214
37174
|
})
|
|
37215
37175
|
]
|
|
37216
37176
|
}),
|
|
37217
|
-
headings.map((headingSize) => /* @__PURE__ */ (0,
|
|
37177
|
+
headings.map((headingSize) => /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)(DropdownMenu.Item, {
|
|
37218
37178
|
onClick: () => formatHeading(headingSize),
|
|
37219
37179
|
children: [
|
|
37220
|
-
/* @__PURE__ */ (0,
|
|
37180
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)("i", {
|
|
37221
37181
|
className: `c-rte-icon-${headingSize} c-rte-toolbar__block-format__icon ${blockType === headingSize ? "selected" : ""}`
|
|
37222
37182
|
}),
|
|
37223
|
-
/* @__PURE__ */ (0,
|
|
37183
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)("span", {
|
|
37224
37184
|
className: `c-rte-toolbar__block-format__text ${blockType === headingSize ? "selected" : ""}`,
|
|
37225
37185
|
children: headingTypeToBlockName[headingSize]
|
|
37226
37186
|
})
|
|
37227
37187
|
]
|
|
37228
37188
|
}, headingSize)),
|
|
37229
|
-
/* @__PURE__ */ (0,
|
|
37189
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsxs)(DropdownMenu.Item, {
|
|
37230
37190
|
onClick: formatBulletList,
|
|
37231
37191
|
children: [
|
|
37232
|
-
/* @__PURE__ */ (0,
|
|
37192
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)("i", {
|
|
37233
37193
|
className: `c-rte-icon-bullet-list c-rte-toolbar__block-format__icon ${blockType === "bullet" ? "selected" : ""}`
|
|
37234
37194
|
}),
|
|
37235
|
-
/* @__PURE__ */ (0,
|
|
37195
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)("span", {
|
|
37236
37196
|
className: `c-rte-toolbar__block-format__text ${blockType === "bullet" ? "selected" : ""}`,
|
|
37237
37197
|
children: "Bullet List"
|
|
37238
37198
|
})
|
|
37239
37199
|
]
|
|
37240
37200
|
}),
|
|
37241
|
-
/* @__PURE__ */ (0,
|
|
37201
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsxs)(DropdownMenu.Item, {
|
|
37242
37202
|
onClick: formatNumberedList,
|
|
37243
37203
|
children: [
|
|
37244
|
-
/* @__PURE__ */ (0,
|
|
37204
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)("i", {
|
|
37245
37205
|
className: `c-rte-icon-numbered-list c-rte-toolbar__block-format__icon ${blockType === "number" ? "selected" : ""}`
|
|
37246
37206
|
}),
|
|
37247
|
-
/* @__PURE__ */ (0,
|
|
37207
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)("span", {
|
|
37248
37208
|
className: `c-rte-toolbar__block-format__text ${blockType === "number" ? "selected" : ""}`,
|
|
37249
37209
|
children: "Numbered List"
|
|
37250
37210
|
})
|
|
37251
37211
|
]
|
|
37252
37212
|
}),
|
|
37253
|
-
/* @__PURE__ */ (0,
|
|
37213
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsxs)(DropdownMenu.Item, {
|
|
37254
37214
|
onClick: formatQuote,
|
|
37255
37215
|
"data-testid": "toggle-block-format-quote",
|
|
37256
37216
|
children: [
|
|
37257
|
-
/* @__PURE__ */ (0,
|
|
37217
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)("i", {
|
|
37258
37218
|
className: `c-rte-icon-quote c-rte-toolbar__block-format__icon ${blockType === "quote" ? "selected" : ""}`
|
|
37259
37219
|
}),
|
|
37260
|
-
/* @__PURE__ */ (0,
|
|
37220
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)("span", {
|
|
37261
37221
|
className: `c-rte-toolbar__block-format__text ${blockType === "quote" ? "selected" : ""}`,
|
|
37262
37222
|
children: "Quote"
|
|
37263
37223
|
})
|
|
37264
37224
|
]
|
|
37265
37225
|
}),
|
|
37266
|
-
/* @__PURE__ */ (0,
|
|
37226
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsxs)(DropdownMenu.Item, {
|
|
37267
37227
|
onClick: formatCode,
|
|
37268
37228
|
"data-testid": "toggle-block-format-code",
|
|
37269
37229
|
children: [
|
|
37270
|
-
/* @__PURE__ */ (0,
|
|
37230
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)("i", {
|
|
37271
37231
|
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" : ""}`
|
|
37272
37232
|
}),
|
|
37273
|
-
/* @__PURE__ */ (0,
|
|
37233
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)("span", {
|
|
37274
37234
|
className: `c-rte-toolbar__block-format__text ${blockType === "code" ? "selected" : ""}`,
|
|
37275
37235
|
children: "Code block"
|
|
37276
37236
|
})
|
|
@@ -37278,21 +37238,21 @@ function BlockFormatDropDown({
|
|
|
37278
37238
|
})
|
|
37279
37239
|
]
|
|
37280
37240
|
}),
|
|
37281
|
-
children: /* @__PURE__ */ (0,
|
|
37241
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)(Button, {
|
|
37282
37242
|
style: { backgroundColor: "transparent", padding: "0 8px" },
|
|
37283
37243
|
"aria-label": "Formatting options for text style",
|
|
37284
37244
|
"data-testid": "toggle-block-format",
|
|
37285
37245
|
children: [
|
|
37286
|
-
/* @__PURE__ */ (0,
|
|
37246
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)("i", {
|
|
37287
37247
|
className: `c-rte-toolbar__toggle-icon c-rte-icon-${blockType}`
|
|
37288
37248
|
}),
|
|
37289
|
-
/* @__PURE__ */ (0,
|
|
37249
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)(Icon.Arrow, {})
|
|
37290
37250
|
]
|
|
37291
37251
|
})
|
|
37292
37252
|
});
|
|
37293
37253
|
}
|
|
37294
37254
|
function Divider() {
|
|
37295
|
-
return /* @__PURE__ */ (0,
|
|
37255
|
+
return /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("div", {
|
|
37296
37256
|
className: "c-rte-toolbar__divider"
|
|
37297
37257
|
});
|
|
37298
37258
|
}
|
|
@@ -37301,23 +37261,23 @@ function ToolbarPlugin({
|
|
|
37301
37261
|
actionsMenuAppend
|
|
37302
37262
|
}) {
|
|
37303
37263
|
const [editor] = (0, import_LexicalComposerContext11.useLexicalComposerContext)();
|
|
37304
|
-
const [activeEditor, setActiveEditor] = (0,
|
|
37305
|
-
const [blockType, setBlockType] = (0,
|
|
37306
|
-
const [selectedElementKey, setSelectedElementKey] = (0,
|
|
37307
|
-
const [isLink, setIsLink] = (0,
|
|
37308
|
-
const [isBold, setIsBold] = (0,
|
|
37309
|
-
const [isItalic, setIsItalic] = (0,
|
|
37310
|
-
const [isUnderline, setIsUnderline] = (0,
|
|
37311
|
-
const [isStrikethrough, setIsStrikethrough] = (0,
|
|
37312
|
-
const [isSubscript, setIsSubscript] = (0,
|
|
37313
|
-
const [isSuperscript, setIsSuperscript] = (0,
|
|
37314
|
-
const [isCode, setIsCode] = (0,
|
|
37315
|
-
const [canUndo, setCanUndo] = (0,
|
|
37316
|
-
const [canRedo, setCanRedo] = (0,
|
|
37264
|
+
const [activeEditor, setActiveEditor] = (0, import_react118.useState)(editor);
|
|
37265
|
+
const [blockType, setBlockType] = (0, import_react118.useState)("paragraph");
|
|
37266
|
+
const [selectedElementKey, setSelectedElementKey] = (0, import_react118.useState)(null);
|
|
37267
|
+
const [isLink, setIsLink] = (0, import_react118.useState)(false);
|
|
37268
|
+
const [isBold, setIsBold] = (0, import_react118.useState)(false);
|
|
37269
|
+
const [isItalic, setIsItalic] = (0, import_react118.useState)(false);
|
|
37270
|
+
const [isUnderline, setIsUnderline] = (0, import_react118.useState)(false);
|
|
37271
|
+
const [isStrikethrough, setIsStrikethrough] = (0, import_react118.useState)(false);
|
|
37272
|
+
const [isSubscript, setIsSubscript] = (0, import_react118.useState)(false);
|
|
37273
|
+
const [isSuperscript, setIsSuperscript] = (0, import_react118.useState)(false);
|
|
37274
|
+
const [isCode, setIsCode] = (0, import_react118.useState)(false);
|
|
37275
|
+
const [canUndo, setCanUndo] = (0, import_react118.useState)(false);
|
|
37276
|
+
const [canRedo, setCanRedo] = (0, import_react118.useState)(false);
|
|
37317
37277
|
const tr = useTr();
|
|
37318
|
-
const [codeLanguage, setCodeLanguage] = (0,
|
|
37319
|
-
const [isEditable, setIsEditable] = (0,
|
|
37320
|
-
const updateToolbar = (0,
|
|
37278
|
+
const [codeLanguage, setCodeLanguage] = (0, import_react118.useState)("");
|
|
37279
|
+
const [isEditable, setIsEditable] = (0, import_react118.useState)(() => editor.isEditable());
|
|
37280
|
+
const updateToolbar = (0, import_react118.useCallback)(() => {
|
|
37321
37281
|
const selection = (0, import_lexical15.$getSelection)();
|
|
37322
37282
|
if ((0, import_lexical15.$isRangeSelection)(selection)) {
|
|
37323
37283
|
const anchorNode = selection.anchor.getNode();
|
|
@@ -37364,7 +37324,7 @@ function ToolbarPlugin({
|
|
|
37364
37324
|
}
|
|
37365
37325
|
}
|
|
37366
37326
|
}, [activeEditor]);
|
|
37367
|
-
(0,
|
|
37327
|
+
(0, import_react118.useEffect)(() => {
|
|
37368
37328
|
return editor.registerCommand(
|
|
37369
37329
|
import_lexical15.SELECTION_CHANGE_COMMAND,
|
|
37370
37330
|
(_payload, newEditor) => {
|
|
@@ -37375,7 +37335,7 @@ function ToolbarPlugin({
|
|
|
37375
37335
|
import_lexical15.COMMAND_PRIORITY_CRITICAL
|
|
37376
37336
|
);
|
|
37377
37337
|
}, [editor, updateToolbar]);
|
|
37378
|
-
(0,
|
|
37338
|
+
(0, import_react118.useEffect)(() => {
|
|
37379
37339
|
return (0, import_utils4.mergeRegister)(
|
|
37380
37340
|
editor.registerEditableListener((editable) => {
|
|
37381
37341
|
setIsEditable(editable);
|
|
@@ -37403,7 +37363,7 @@ function ToolbarPlugin({
|
|
|
37403
37363
|
)
|
|
37404
37364
|
);
|
|
37405
37365
|
}, [activeEditor, editor, updateToolbar]);
|
|
37406
|
-
const clearFormatting = (0,
|
|
37366
|
+
const clearFormatting = (0, import_react118.useCallback)(() => {
|
|
37407
37367
|
activeEditor.update(() => {
|
|
37408
37368
|
const selection = (0, import_lexical15.$getSelection)();
|
|
37409
37369
|
if ((0, import_lexical15.$isRangeSelection)(selection)) {
|
|
@@ -37421,14 +37381,14 @@ function ToolbarPlugin({
|
|
|
37421
37381
|
}
|
|
37422
37382
|
});
|
|
37423
37383
|
}, [activeEditor]);
|
|
37424
|
-
const insertLink = (0,
|
|
37384
|
+
const insertLink = (0, import_react118.useCallback)(() => {
|
|
37425
37385
|
if (!isLink) {
|
|
37426
37386
|
editor.dispatchCommand(import_link6.TOGGLE_LINK_COMMAND, sanitizeUrl("https://"));
|
|
37427
37387
|
} else {
|
|
37428
37388
|
editor.dispatchCommand(import_link6.TOGGLE_LINK_COMMAND, null);
|
|
37429
37389
|
}
|
|
37430
37390
|
}, [editor, isLink]);
|
|
37431
|
-
const onCodeLanguageSelect = (0,
|
|
37391
|
+
const onCodeLanguageSelect = (0, import_react118.useCallback)(
|
|
37432
37392
|
(value) => {
|
|
37433
37393
|
activeEditor.update(() => {
|
|
37434
37394
|
if (selectedElementKey !== null) {
|
|
@@ -37441,13 +37401,13 @@ function ToolbarPlugin({
|
|
|
37441
37401
|
},
|
|
37442
37402
|
[activeEditor, selectedElementKey]
|
|
37443
37403
|
);
|
|
37444
|
-
return /* @__PURE__ */ (0,
|
|
37404
|
+
return /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)("div", {
|
|
37445
37405
|
className: "c-rte-toolbar",
|
|
37446
37406
|
children: [
|
|
37447
|
-
/* @__PURE__ */ (0,
|
|
37407
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsxs)("div", {
|
|
37448
37408
|
className: "c-rte-toolbar__inner",
|
|
37449
37409
|
children: [
|
|
37450
|
-
/* @__PURE__ */ (0,
|
|
37410
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)(IconButton, {
|
|
37451
37411
|
disabled: !canUndo || !isEditable,
|
|
37452
37412
|
onClick: () => {
|
|
37453
37413
|
activeEditor.dispatchCommand(import_lexical15.UNDO_COMMAND, void 0);
|
|
@@ -37455,12 +37415,13 @@ function ToolbarPlugin({
|
|
|
37455
37415
|
type: "button",
|
|
37456
37416
|
title: tr(IS_APPLE ? "actionUndoTitleApple" : "actionUndoTitle"),
|
|
37457
37417
|
"aria-label": tr("actionUndoLabel"),
|
|
37458
|
-
|
|
37418
|
+
"data-testid": "rich-text-undo-button",
|
|
37419
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("i", {
|
|
37459
37420
|
className: `c-rte-icon-undo c-rte-toolbar__icon ${!canUndo ? "disabled" : ""}
|
|
37460
37421
|
`
|
|
37461
37422
|
})
|
|
37462
37423
|
}),
|
|
37463
|
-
/* @__PURE__ */ (0,
|
|
37424
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)(IconButton, {
|
|
37464
37425
|
disabled: !canRedo || !isEditable,
|
|
37465
37426
|
onClick: () => {
|
|
37466
37427
|
activeEditor.dispatchCommand(import_lexical15.REDO_COMMAND, void 0);
|
|
@@ -37468,51 +37429,51 @@ function ToolbarPlugin({
|
|
|
37468
37429
|
type: "button",
|
|
37469
37430
|
title: tr(IS_APPLE ? "actionRedoTitleApple" : "actionRedoTitle"),
|
|
37470
37431
|
"aria-label": tr("actionRedoLabel"),
|
|
37471
|
-
children: /* @__PURE__ */ (0,
|
|
37432
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("i", {
|
|
37472
37433
|
className: `c-rte-icon-redo c-rte-toolbar__icon ${!canRedo ? "disabled" : ""}`
|
|
37473
37434
|
})
|
|
37474
37435
|
}),
|
|
37475
|
-
/* @__PURE__ */ (0,
|
|
37476
|
-
blockType in blockTypeToBlockName && activeEditor === editor && /* @__PURE__ */ (0,
|
|
37436
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)(Divider, {}),
|
|
37437
|
+
blockType in blockTypeToBlockName && activeEditor === editor && /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)(import_jsx_runtime133.Fragment, {
|
|
37477
37438
|
children: [
|
|
37478
|
-
/* @__PURE__ */ (0,
|
|
37439
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)(BlockFormatDropDown, {
|
|
37479
37440
|
disabled: !isEditable,
|
|
37480
37441
|
blockType,
|
|
37481
37442
|
editor
|
|
37482
37443
|
}),
|
|
37483
|
-
/* @__PURE__ */ (0,
|
|
37444
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)(Divider, {})
|
|
37484
37445
|
]
|
|
37485
37446
|
}),
|
|
37486
|
-
blockType === "code" ? /* @__PURE__ */ (0,
|
|
37487
|
-
children: /* @__PURE__ */ (0,
|
|
37447
|
+
blockType === "code" ? /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(import_jsx_runtime133.Fragment, {
|
|
37448
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(DropdownMenu.Root, {
|
|
37488
37449
|
disabled: !isEditable,
|
|
37489
37450
|
style: { zIndex: 1 },
|
|
37490
|
-
content: /* @__PURE__ */ (0,
|
|
37451
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(import_jsx_runtime133.Fragment, {
|
|
37491
37452
|
children: CODE_LANGUAGE_OPTIONS.map(([value, name]) => {
|
|
37492
|
-
return /* @__PURE__ */ (0,
|
|
37453
|
+
return /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(DropdownMenu.Item, {
|
|
37493
37454
|
className: `item ${dropDownActiveClass(value === codeLanguage)}`,
|
|
37494
37455
|
onClick: () => onCodeLanguageSelect(value),
|
|
37495
|
-
children: /* @__PURE__ */ (0,
|
|
37456
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("span", {
|
|
37496
37457
|
className: `c-rte-toolbar__code-lang__sel-item ${dropDownActiveClass(value === codeLanguage) ? "selected" : ""}`,
|
|
37497
37458
|
children: name
|
|
37498
37459
|
})
|
|
37499
37460
|
}, value);
|
|
37500
37461
|
})
|
|
37501
37462
|
}),
|
|
37502
|
-
children: /* @__PURE__ */ (0,
|
|
37463
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(Button, {
|
|
37503
37464
|
"aria-label": tr("codeSelectLanguage"),
|
|
37504
|
-
append: /* @__PURE__ */ (0,
|
|
37505
|
-
children: /* @__PURE__ */ (0,
|
|
37465
|
+
append: /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(Icon.Arrow, {}),
|
|
37466
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("span", {
|
|
37506
37467
|
className: "c-rte-toolbar__code-lang__button-text",
|
|
37507
37468
|
children: (0, import_code9.getLanguageFriendlyName)(codeLanguage)
|
|
37508
37469
|
})
|
|
37509
37470
|
})
|
|
37510
37471
|
})
|
|
37511
|
-
}) : /* @__PURE__ */ (0,
|
|
37512
|
-
children: /* @__PURE__ */ (0,
|
|
37472
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(Dialog, {
|
|
37473
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)("div", {
|
|
37513
37474
|
className: "c-rte-toolbar__actions-rest",
|
|
37514
37475
|
children: [
|
|
37515
|
-
/* @__PURE__ */ (0,
|
|
37476
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)(IconButton, {
|
|
37516
37477
|
disabled: !isEditable,
|
|
37517
37478
|
className: `c-rte-toolbar__icon-btn ${isBold ? "selected" : ""}`,
|
|
37518
37479
|
type: "button",
|
|
@@ -37522,11 +37483,11 @@ function ToolbarPlugin({
|
|
|
37522
37483
|
onClick: () => {
|
|
37523
37484
|
activeEditor.dispatchCommand(import_lexical15.FORMAT_TEXT_COMMAND, "bold");
|
|
37524
37485
|
},
|
|
37525
|
-
children: /* @__PURE__ */ (0,
|
|
37486
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("i", {
|
|
37526
37487
|
className: `c-rte-toolbar__icon-btn__icon c-rte-icon-bold`
|
|
37527
37488
|
})
|
|
37528
37489
|
}),
|
|
37529
|
-
/* @__PURE__ */ (0,
|
|
37490
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)(IconButton, {
|
|
37530
37491
|
className: `c-rte-toolbar__icon-btn ${isItalic ? "selected" : ""}`,
|
|
37531
37492
|
disabled: !isEditable,
|
|
37532
37493
|
onClick: () => {
|
|
@@ -37536,11 +37497,11 @@ function ToolbarPlugin({
|
|
|
37536
37497
|
title: tr(IS_APPLE ? "actionFormatAsEmphasizedTitleApple" : "actionFormatAsEmphasizedTitle"),
|
|
37537
37498
|
"aria-label": tr("actionFormatAsEmphasizedLabel"),
|
|
37538
37499
|
"data-testid": "toggle-format-emphasized",
|
|
37539
|
-
children: /* @__PURE__ */ (0,
|
|
37500
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("i", {
|
|
37540
37501
|
className: `c-rte-toolbar__icon-btn__icon c-rte-icon-italic`
|
|
37541
37502
|
})
|
|
37542
37503
|
}),
|
|
37543
|
-
/* @__PURE__ */ (0,
|
|
37504
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)(IconButton, {
|
|
37544
37505
|
className: `c-rte-toolbar__icon-btn ${isUnderline ? "selected" : ""}`,
|
|
37545
37506
|
disabled: !isEditable,
|
|
37546
37507
|
onClick: () => {
|
|
@@ -37550,11 +37511,11 @@ function ToolbarPlugin({
|
|
|
37550
37511
|
title: tr(IS_APPLE ? "actionFormatAsUnderlinedTitleApple" : "actionFormatAsUnderlinedTitle"),
|
|
37551
37512
|
"aria-label": tr("actionFormatAsUnderlinedLabel"),
|
|
37552
37513
|
"data-testid": "toggle-format-underlined",
|
|
37553
|
-
children: /* @__PURE__ */ (0,
|
|
37514
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("i", {
|
|
37554
37515
|
className: `c-rte-toolbar__icon-btn__icon c-rte-icon-underline`
|
|
37555
37516
|
})
|
|
37556
37517
|
}),
|
|
37557
|
-
/* @__PURE__ */ (0,
|
|
37518
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)(IconButton, {
|
|
37558
37519
|
className: `c-rte-toolbar__icon-btn ${isCode ? "selected" : ""}`,
|
|
37559
37520
|
disabled: !isEditable,
|
|
37560
37521
|
onClick: () => {
|
|
@@ -37563,132 +37524,131 @@ function ToolbarPlugin({
|
|
|
37563
37524
|
type: "button",
|
|
37564
37525
|
title: tr("actionInsertCodeBlock"),
|
|
37565
37526
|
"aria-label": tr("actionInsertCodeBlock"),
|
|
37566
|
-
|
|
37527
|
+
"data-testid": "toggle-format-code",
|
|
37528
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("i", {
|
|
37567
37529
|
className: `c-rte-toolbar__icon-btn__icon c-rte-icon-code`
|
|
37568
37530
|
})
|
|
37569
37531
|
}),
|
|
37570
|
-
/* @__PURE__ */ (0,
|
|
37532
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)(IconButton, {
|
|
37571
37533
|
className: `c-rte-toolbar__icon-btn ${isLink ? "selected" : ""}`,
|
|
37572
37534
|
disabled: !isEditable,
|
|
37573
37535
|
onClick: insertLink,
|
|
37574
37536
|
type: "button",
|
|
37575
37537
|
"aria-label": tr("actionInsertlink"),
|
|
37576
37538
|
title: tr("actionInsertlink"),
|
|
37577
|
-
children: /* @__PURE__ */ (0,
|
|
37539
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("i", {
|
|
37578
37540
|
className: `c-rte-toolbar__icon-btn__icon c-rte-icon-link`
|
|
37579
37541
|
})
|
|
37580
37542
|
}),
|
|
37581
|
-
/* @__PURE__ */ (0,
|
|
37543
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)(DropdownMenu.Root, {
|
|
37582
37544
|
disabled: !isEditable,
|
|
37583
37545
|
style: { zIndex: 1 },
|
|
37584
|
-
content: /* @__PURE__ */ (0,
|
|
37546
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)(import_jsx_runtime133.Fragment, {
|
|
37585
37547
|
children: [
|
|
37586
|
-
/* @__PURE__ */ (0,
|
|
37587
|
-
|
|
37588
|
-
|
|
37589
|
-
},
|
|
37548
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsxs)(DropdownMenu.Item, {
|
|
37549
|
+
disabled: !isEditable,
|
|
37550
|
+
onClick: () => activeEditor.dispatchCommand(import_lexical15.FORMAT_TEXT_COMMAND, "strikethrough"),
|
|
37590
37551
|
title: tr("actionFormatWithStrikethroughTitle"),
|
|
37591
37552
|
"aria-label": tr("actionFormatWithStrikethroughLabel"),
|
|
37592
37553
|
children: [
|
|
37593
|
-
/* @__PURE__ */ (0,
|
|
37554
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)("i", {
|
|
37594
37555
|
className: `c-rte-icon-strikethrough c-rte-toolbar__dd-item__icon ${isStrikethrough ? "selected" : ""}`
|
|
37595
37556
|
}),
|
|
37596
|
-
/* @__PURE__ */ (0,
|
|
37557
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)("span", {
|
|
37597
37558
|
className: `c-rte-toolbar__dd-item__text ${isStrikethrough ? "selected" : ""}`,
|
|
37598
|
-
children: tr("
|
|
37559
|
+
children: tr("actionFormatWithStrikethroughTitle")
|
|
37599
37560
|
})
|
|
37600
37561
|
]
|
|
37601
37562
|
}),
|
|
37602
|
-
/* @__PURE__ */ (0,
|
|
37603
|
-
|
|
37604
|
-
|
|
37605
|
-
},
|
|
37563
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsxs)(DropdownMenu.Item, {
|
|
37564
|
+
disabled: !isEditable,
|
|
37565
|
+
onClick: () => activeEditor.dispatchCommand(import_lexical15.FORMAT_TEXT_COMMAND, "subscript"),
|
|
37606
37566
|
title: tr("actionFormatWithSubscriptTitle"),
|
|
37607
37567
|
"aria-label": tr("actionFormatWithSubscriptLabel"),
|
|
37608
37568
|
children: [
|
|
37609
|
-
/* @__PURE__ */ (0,
|
|
37569
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)("i", {
|
|
37610
37570
|
className: `c-rte-icon-subscript c-rte-toolbar__dd-item__icon ${isSubscript ? "selected" : ""}`
|
|
37611
37571
|
}),
|
|
37612
|
-
/* @__PURE__ */ (0,
|
|
37572
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)("span", {
|
|
37613
37573
|
className: `c-rte-toolbar__dd-item__text ${isSubscript ? "selected" : ""}`,
|
|
37614
37574
|
children: tr("actionFormatWithSubscriptTitle")
|
|
37615
37575
|
})
|
|
37616
37576
|
]
|
|
37617
37577
|
}),
|
|
37618
|
-
/* @__PURE__ */ (0,
|
|
37619
|
-
|
|
37620
|
-
|
|
37621
|
-
},
|
|
37578
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsxs)(DropdownMenu.Item, {
|
|
37579
|
+
disabled: !isEditable,
|
|
37580
|
+
onClick: () => activeEditor.dispatchCommand(import_lexical15.FORMAT_TEXT_COMMAND, "superscript"),
|
|
37622
37581
|
title: tr("actionFormatWithSuperscriptTitle"),
|
|
37623
37582
|
"aria-label": tr("actionFormatWithSuperscriptLabel"),
|
|
37624
37583
|
children: [
|
|
37625
|
-
/* @__PURE__ */ (0,
|
|
37584
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)("i", {
|
|
37626
37585
|
className: `c-rte-icon-superscript c-rte-toolbar__dd-item__icon ${isSuperscript ? "selected" : ""}`
|
|
37627
37586
|
}),
|
|
37628
|
-
/* @__PURE__ */ (0,
|
|
37587
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)("span", {
|
|
37629
37588
|
className: `c-rte-toolbar__dd-item__text ${isSuperscript ? "selected" : ""}`,
|
|
37630
37589
|
children: tr("actionFormatWithSuperscriptTitle")
|
|
37631
37590
|
})
|
|
37632
37591
|
]
|
|
37633
37592
|
}),
|
|
37634
|
-
/* @__PURE__ */ (0,
|
|
37593
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsxs)(DropdownMenu.Item, {
|
|
37594
|
+
disabled: !isEditable,
|
|
37635
37595
|
onClick: clearFormatting,
|
|
37636
37596
|
className: "item",
|
|
37637
37597
|
title: tr("actionClearTextFormatting"),
|
|
37638
37598
|
"aria-label": tr("actionClearTextFormatting"),
|
|
37639
37599
|
children: [
|
|
37640
|
-
/* @__PURE__ */ (0,
|
|
37600
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)("i", {
|
|
37641
37601
|
className: "c-rte-icon-clear c-rte-toolbar__dd-item__icon"
|
|
37642
37602
|
}),
|
|
37643
|
-
/* @__PURE__ */ (0,
|
|
37603
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)("span", {
|
|
37644
37604
|
className: "c-rte-toolbar__dd-item__text--clear",
|
|
37645
|
-
children: "
|
|
37605
|
+
children: tr("actionFormatClear")
|
|
37646
37606
|
})
|
|
37647
37607
|
]
|
|
37648
37608
|
})
|
|
37649
37609
|
]
|
|
37650
37610
|
}),
|
|
37651
|
-
children: /* @__PURE__ */ (0,
|
|
37611
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)(Button, {
|
|
37652
37612
|
style: { backgroundColor: "transparent", padding: "0 8px" },
|
|
37653
37613
|
"aria-label": tr("actionTextFormattingOptions"),
|
|
37654
37614
|
children: [
|
|
37655
|
-
/* @__PURE__ */ (0,
|
|
37615
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)("i", {
|
|
37656
37616
|
className: `c-rte-icon-dropdown-more c-rte-toolbar__toggle-icon`
|
|
37657
37617
|
}),
|
|
37658
|
-
/* @__PURE__ */ (0,
|
|
37618
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)(Icon.Arrow, {})
|
|
37659
37619
|
]
|
|
37660
37620
|
})
|
|
37661
37621
|
}),
|
|
37662
|
-
/* @__PURE__ */ (0,
|
|
37663
|
-
/* @__PURE__ */ (0,
|
|
37622
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)(Divider, {}),
|
|
37623
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)(DropdownMenu.Root, {
|
|
37664
37624
|
style: { zIndex: 1 },
|
|
37665
37625
|
disabled: !isEditable,
|
|
37666
|
-
content: /* @__PURE__ */ (0,
|
|
37626
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)(import_jsx_runtime133.Fragment, {
|
|
37667
37627
|
children: [
|
|
37668
|
-
/* @__PURE__ */ (0,
|
|
37628
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsxs)(DropdownMenu.Item, {
|
|
37669
37629
|
onClick: () => {
|
|
37670
37630
|
activeEditor.dispatchCommand(import_LexicalHorizontalRuleNode4.INSERT_HORIZONTAL_RULE_COMMAND, void 0);
|
|
37671
37631
|
},
|
|
37672
37632
|
children: [
|
|
37673
|
-
/* @__PURE__ */ (0,
|
|
37633
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)("i", {
|
|
37674
37634
|
className: "c-rte-toolbar__dd-item__icon c-rte-icon-horizontal-rule"
|
|
37675
37635
|
}),
|
|
37676
|
-
/* @__PURE__ */ (0,
|
|
37636
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)("span", {
|
|
37677
37637
|
className: "c-rte-toolbar__dd-item__text",
|
|
37678
37638
|
children: tr("horizontalRule")
|
|
37679
37639
|
})
|
|
37680
37640
|
]
|
|
37681
37641
|
}),
|
|
37682
|
-
/* @__PURE__ */ (0,
|
|
37683
|
-
children: /* @__PURE__ */ (0,
|
|
37642
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)(DropdownMenu.Item, {
|
|
37643
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(Dialog.Trigger, {
|
|
37684
37644
|
asChild: true,
|
|
37685
|
-
children: /* @__PURE__ */ (0,
|
|
37645
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)("div", {
|
|
37686
37646
|
className: "c-rte-toolbar__dd-item--table",
|
|
37687
37647
|
children: [
|
|
37688
|
-
/* @__PURE__ */ (0,
|
|
37648
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)("i", {
|
|
37689
37649
|
className: "c-rte-toolbar__dd-item__icon c-rte-icon-table"
|
|
37690
37650
|
}),
|
|
37691
|
-
/* @__PURE__ */ (0,
|
|
37651
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)("span", {
|
|
37692
37652
|
className: "c-rte-toolbar__dd-item__text",
|
|
37693
37653
|
children: tr("table")
|
|
37694
37654
|
})
|
|
@@ -37698,21 +37658,21 @@ function ToolbarPlugin({
|
|
|
37698
37658
|
})
|
|
37699
37659
|
]
|
|
37700
37660
|
}),
|
|
37701
|
-
children: /* @__PURE__ */ (0,
|
|
37702
|
-
children: /* @__PURE__ */ (0,
|
|
37661
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(IconButton, {
|
|
37662
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("i", {
|
|
37703
37663
|
className: "c-rte-icon-plus c-rte-toolbar__plus"
|
|
37704
37664
|
})
|
|
37705
37665
|
})
|
|
37706
37666
|
}),
|
|
37707
|
-
/* @__PURE__ */ (0,
|
|
37667
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsxs)(Dialog.Content, {
|
|
37708
37668
|
children: [
|
|
37709
|
-
/* @__PURE__ */ (0,
|
|
37669
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)(Dialog.Title, {
|
|
37710
37670
|
children: tr("insertTableTitle")
|
|
37711
37671
|
}),
|
|
37712
|
-
/* @__PURE__ */ (0,
|
|
37672
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)(Dialog.Description, {
|
|
37713
37673
|
children: tr("insertTableDescription")
|
|
37714
37674
|
}),
|
|
37715
|
-
/* @__PURE__ */ (0,
|
|
37675
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)(InsertTableDialog, {
|
|
37716
37676
|
activeEditor
|
|
37717
37677
|
})
|
|
37718
37678
|
]
|
|
@@ -37722,7 +37682,7 @@ function ToolbarPlugin({
|
|
|
37722
37682
|
})
|
|
37723
37683
|
]
|
|
37724
37684
|
}),
|
|
37725
|
-
/* @__PURE__ */ (0,
|
|
37685
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)(ActionsPlugin, {
|
|
37726
37686
|
prepend: actionsMenuPrepend,
|
|
37727
37687
|
append: actionsMenuAppend
|
|
37728
37688
|
})
|
|
@@ -37833,33 +37793,31 @@ var theme = {
|
|
|
37833
37793
|
var CrystallizeRTEditorTheme_default = theme;
|
|
37834
37794
|
|
|
37835
37795
|
// src/rich-text-editor/rich-text-editor.tsx
|
|
37836
|
-
var
|
|
37796
|
+
var import_jsx_runtime134 = require("react/jsx-runtime");
|
|
37837
37797
|
function RichTextEditor({
|
|
37838
37798
|
initialData,
|
|
37839
37799
|
language = "en",
|
|
37840
37800
|
labelTranslations,
|
|
37841
37801
|
...rest
|
|
37842
37802
|
}) {
|
|
37843
|
-
return /* @__PURE__ */ (0,
|
|
37803
|
+
return /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(import_LexicalComposer.LexicalComposer, {
|
|
37844
37804
|
initialConfig: {
|
|
37845
37805
|
editable: !rest.disabled,
|
|
37846
37806
|
namespace: "crystallize-rich-text-editor",
|
|
37847
37807
|
nodes: [...BaseNodes],
|
|
37808
|
+
theme: CrystallizeRTEditorTheme_default,
|
|
37809
|
+
editorState: initialData ? composeInitialState({ richText: initialData }) : void 0,
|
|
37848
37810
|
onError: (error) => {
|
|
37849
37811
|
throw error;
|
|
37850
|
-
}
|
|
37851
|
-
theme: CrystallizeRTEditorTheme_default,
|
|
37852
|
-
editorState: initialData ? composeInitialState({
|
|
37853
|
-
richText: initialData
|
|
37854
|
-
}) : void 0
|
|
37812
|
+
}
|
|
37855
37813
|
},
|
|
37856
|
-
children: /* @__PURE__ */ (0,
|
|
37814
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(I18nProvider, {
|
|
37857
37815
|
language,
|
|
37858
37816
|
labelTranslations,
|
|
37859
|
-
children: /* @__PURE__ */ (0,
|
|
37860
|
-
children: /* @__PURE__ */ (0,
|
|
37817
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(SharedHistoryContext, {
|
|
37818
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("div", {
|
|
37861
37819
|
className: "c-rich-text-editor",
|
|
37862
|
-
children: /* @__PURE__ */ (0,
|
|
37820
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(RichTextEditorWithoutContext, {
|
|
37863
37821
|
...rest
|
|
37864
37822
|
})
|
|
37865
37823
|
})
|
|
@@ -37881,20 +37839,19 @@ function RichTextEditorWithoutContext({
|
|
|
37881
37839
|
}) {
|
|
37882
37840
|
const editable = !disabled;
|
|
37883
37841
|
const { historyState } = useSharedHistoryContext();
|
|
37884
|
-
const placeholder = /* @__PURE__ */ (0,
|
|
37842
|
+
const placeholder = /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("div", {
|
|
37885
37843
|
className: "c-rte-placeholder",
|
|
37886
37844
|
children: placeholderText ?? ""
|
|
37887
37845
|
});
|
|
37888
37846
|
const [editor] = (0, import_LexicalComposerContext12.useLexicalComposerContext)();
|
|
37889
|
-
const [floatingAnchorElem, setFloatingAnchorElem] = (0,
|
|
37890
|
-
const
|
|
37891
|
-
const firstOnChangeTriggeredRef = (0, import_react121.useRef)(!autoFocus);
|
|
37847
|
+
const [floatingAnchorElem, setFloatingAnchorElem] = (0, import_react119.useState)(null);
|
|
37848
|
+
const firstOnChangeTriggeredRef = (0, import_react119.useRef)(!autoFocus);
|
|
37892
37849
|
const onRef = (_floatingAnchorElem) => {
|
|
37893
37850
|
if (_floatingAnchorElem !== null) {
|
|
37894
37851
|
setFloatingAnchorElem(_floatingAnchorElem);
|
|
37895
37852
|
}
|
|
37896
37853
|
};
|
|
37897
|
-
(0,
|
|
37854
|
+
(0, import_react119.useEffect)(() => {
|
|
37898
37855
|
editor.setEditable(editable || false);
|
|
37899
37856
|
}, [editable, editor]);
|
|
37900
37857
|
function onLocalChange(editorState) {
|
|
@@ -37905,39 +37862,36 @@ function RichTextEditorWithoutContext({
|
|
|
37905
37862
|
}
|
|
37906
37863
|
firstOnChangeTriggeredRef.current = true;
|
|
37907
37864
|
}
|
|
37908
|
-
return /* @__PURE__ */ (0,
|
|
37865
|
+
return /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)(import_jsx_runtime134.Fragment, {
|
|
37909
37866
|
children: [
|
|
37910
|
-
/* @__PURE__ */ (0,
|
|
37867
|
+
/* @__PURE__ */ (0, import_jsx_runtime134.jsx)(import_LexicalOnChangePlugin.OnChangePlugin, {
|
|
37911
37868
|
onChange: onLocalChange,
|
|
37912
37869
|
ignoreSelectionChange: true
|
|
37913
37870
|
}),
|
|
37914
|
-
/* @__PURE__ */ (0,
|
|
37915
|
-
onChange: (d) => setIsSmallWidthViewport(d.isSmallWidth)
|
|
37916
|
-
}),
|
|
37917
|
-
isSmallWidthViewport ? null : /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(ToolbarPlugin, {
|
|
37871
|
+
/* @__PURE__ */ (0, import_jsx_runtime134.jsx)(ToolbarPlugin, {
|
|
37918
37872
|
actionsMenuPrepend,
|
|
37919
37873
|
actionsMenuAppend
|
|
37920
37874
|
}),
|
|
37921
37875
|
slotPreContent,
|
|
37922
|
-
/* @__PURE__ */ (0,
|
|
37876
|
+
/* @__PURE__ */ (0, import_jsx_runtime134.jsxs)("div", {
|
|
37923
37877
|
className: `c-rte-editor-container ${disabled ? "disabled" : ""}`,
|
|
37924
37878
|
children: [
|
|
37925
|
-
maxLength != null ? /* @__PURE__ */ (0,
|
|
37879
|
+
maxLength != null ? /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(MaxLengthPlugin, {
|
|
37926
37880
|
maxLength
|
|
37927
37881
|
}) : null,
|
|
37928
|
-
!autoFocus ? null : /* @__PURE__ */ (0,
|
|
37929
|
-
/* @__PURE__ */ (0,
|
|
37930
|
-
/* @__PURE__ */ (0,
|
|
37931
|
-
/* @__PURE__ */ (0,
|
|
37882
|
+
!autoFocus ? null : /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(import_LexicalAutoFocusPlugin.AutoFocusPlugin, {}),
|
|
37883
|
+
/* @__PURE__ */ (0, import_jsx_runtime134.jsx)(import_LexicalClearEditorPlugin.ClearEditorPlugin, {}),
|
|
37884
|
+
/* @__PURE__ */ (0, import_jsx_runtime134.jsx)(LexicalAutoLinkPlugin, {}),
|
|
37885
|
+
/* @__PURE__ */ (0, import_jsx_runtime134.jsx)(import_LexicalHistoryPlugin2.HistoryPlugin, {
|
|
37932
37886
|
externalHistoryState: historyState
|
|
37933
37887
|
}),
|
|
37934
|
-
/* @__PURE__ */ (0,
|
|
37935
|
-
contentEditable: /* @__PURE__ */ (0,
|
|
37888
|
+
/* @__PURE__ */ (0, import_jsx_runtime134.jsx)(import_LexicalRichTextPlugin.RichTextPlugin, {
|
|
37889
|
+
contentEditable: /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("div", {
|
|
37936
37890
|
className: "c-rte-editor-scroller",
|
|
37937
|
-
children: /* @__PURE__ */ (0,
|
|
37891
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("div", {
|
|
37938
37892
|
className: "c-rte-editor",
|
|
37939
37893
|
ref: onRef,
|
|
37940
|
-
children: /* @__PURE__ */ (0,
|
|
37894
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(import_LexicalContentEditable.ContentEditable, {
|
|
37941
37895
|
className: "c-rte-contenteditable-root",
|
|
37942
37896
|
id
|
|
37943
37897
|
})
|
|
@@ -37946,28 +37900,28 @@ function RichTextEditorWithoutContext({
|
|
|
37946
37900
|
placeholder,
|
|
37947
37901
|
ErrorBoundary: import_LexicalErrorBoundary.default
|
|
37948
37902
|
}),
|
|
37949
|
-
/* @__PURE__ */ (0,
|
|
37950
|
-
/* @__PURE__ */ (0,
|
|
37951
|
-
/* @__PURE__ */ (0,
|
|
37903
|
+
/* @__PURE__ */ (0, import_jsx_runtime134.jsx)(CodeHighlightPlugin, {}),
|
|
37904
|
+
/* @__PURE__ */ (0, import_jsx_runtime134.jsx)(import_LexicalListPlugin.ListPlugin, {}),
|
|
37905
|
+
/* @__PURE__ */ (0, import_jsx_runtime134.jsx)(ListMaxIndentLevelPlugin, {
|
|
37952
37906
|
maxDepth: 7
|
|
37953
37907
|
}),
|
|
37954
|
-
/* @__PURE__ */ (0,
|
|
37955
|
-
/* @__PURE__ */ (0,
|
|
37956
|
-
/* @__PURE__ */ (0,
|
|
37957
|
-
/* @__PURE__ */ (0,
|
|
37958
|
-
/* @__PURE__ */ (0,
|
|
37959
|
-
floatingAnchorElem &&
|
|
37908
|
+
/* @__PURE__ */ (0, import_jsx_runtime134.jsx)(import_LexicalTablePlugin.TablePlugin, {}),
|
|
37909
|
+
/* @__PURE__ */ (0, import_jsx_runtime134.jsx)(LinkPlugin, {}),
|
|
37910
|
+
/* @__PURE__ */ (0, import_jsx_runtime134.jsx)(import_LexicalHorizontalRulePlugin.HorizontalRulePlugin, {}),
|
|
37911
|
+
/* @__PURE__ */ (0, import_jsx_runtime134.jsx)(TabFocusPlugin, {}),
|
|
37912
|
+
/* @__PURE__ */ (0, import_jsx_runtime134.jsx)(import_LexicalTabIndentationPlugin.TabIndentationPlugin, {}),
|
|
37913
|
+
floatingAnchorElem && /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)(import_jsx_runtime134.Fragment, {
|
|
37960
37914
|
children: [
|
|
37961
|
-
/* @__PURE__ */ (0,
|
|
37915
|
+
/* @__PURE__ */ (0, import_jsx_runtime134.jsx)(CodeActionMenuPlugin, {
|
|
37962
37916
|
anchorElem: floatingAnchorElem
|
|
37963
37917
|
}),
|
|
37964
|
-
/* @__PURE__ */ (0,
|
|
37918
|
+
/* @__PURE__ */ (0, import_jsx_runtime134.jsx)(FloatingLinkEditorPlugin, {
|
|
37965
37919
|
anchorElem: floatingAnchorElem
|
|
37966
37920
|
}),
|
|
37967
|
-
/* @__PURE__ */ (0,
|
|
37921
|
+
/* @__PURE__ */ (0, import_jsx_runtime134.jsx)(TableActionMenuPlugin, {
|
|
37968
37922
|
anchorElem: floatingAnchorElem
|
|
37969
37923
|
}),
|
|
37970
|
-
/* @__PURE__ */ (0,
|
|
37924
|
+
/* @__PURE__ */ (0, import_jsx_runtime134.jsx)(FloatingTextFormatToolbarPlugin, {
|
|
37971
37925
|
anchorElem: floatingAnchorElem
|
|
37972
37926
|
})
|
|
37973
37927
|
]
|
|
@@ -37980,12 +37934,12 @@ function RichTextEditorWithoutContext({
|
|
|
37980
37934
|
|
|
37981
37935
|
// src/switch/switch.tsx
|
|
37982
37936
|
var RadixSwitch = __toESM(require("@radix-ui/react-switch"));
|
|
37983
|
-
var
|
|
37937
|
+
var import_jsx_runtime135 = require("react/jsx-runtime");
|
|
37984
37938
|
function Switch2(props) {
|
|
37985
|
-
return /* @__PURE__ */ (0,
|
|
37939
|
+
return /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(RadixSwitch.Root, {
|
|
37986
37940
|
...props,
|
|
37987
37941
|
className: "c-switch-root",
|
|
37988
|
-
children: /* @__PURE__ */ (0,
|
|
37942
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(RadixSwitch.Thumb, {
|
|
37989
37943
|
className: "c-switch-thumb"
|
|
37990
37944
|
})
|
|
37991
37945
|
});
|