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