@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.mjs
CHANGED
|
@@ -272,8 +272,9 @@ var DropdownMenu = {
|
|
|
272
272
|
// src/action-menu/action-item.tsx
|
|
273
273
|
import { cx as cx3 } from "class-variance-authority";
|
|
274
274
|
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
275
|
-
function Item2({ children, className, onSelect }) {
|
|
275
|
+
function Item2({ children, className, onSelect, ...delegated }) {
|
|
276
276
|
return /* @__PURE__ */ jsx7(DropdownMenu.Item, {
|
|
277
|
+
...delegated,
|
|
277
278
|
onClick: onSelect,
|
|
278
279
|
className: cx3(className, ["c-action-menu-item"]),
|
|
279
280
|
children
|
|
@@ -5917,7 +5918,7 @@ function Tag({ children, className, variant, size, prepend, onRemove, ...delegat
|
|
|
5917
5918
|
}
|
|
5918
5919
|
|
|
5919
5920
|
// src/rich-text-editor/rich-text-editor.tsx
|
|
5920
|
-
import { useEffect as
|
|
5921
|
+
import { useEffect as useEffect11, useRef as useRef5, useState as useState10 } from "react";
|
|
5921
5922
|
import { AutoFocusPlugin } from "@lexical/react/LexicalAutoFocusPlugin";
|
|
5922
5923
|
import { ClearEditorPlugin } from "@lexical/react/LexicalClearEditorPlugin";
|
|
5923
5924
|
import { LexicalComposer } from "@lexical/react/LexicalComposer";
|
|
@@ -5970,6 +5971,7 @@ var translations = {
|
|
|
5970
5971
|
actionFormatWithSubscriptTitle: "Subscript",
|
|
5971
5972
|
actionFormatWithSuperscriptLabel: "Format text as superscript",
|
|
5972
5973
|
actionFormatWithSuperscriptTitle: "Superscript",
|
|
5974
|
+
actionFormatClear: "Clear formatting",
|
|
5973
5975
|
actionInsertCodeBlock: "Insert code block",
|
|
5974
5976
|
actionInsertlink: "Insert link",
|
|
5975
5977
|
actionCopyJSON: "Copy JSON",
|
|
@@ -6811,45 +6813,8 @@ function CodeHighlightPlugin() {
|
|
|
6811
6813
|
return null;
|
|
6812
6814
|
}
|
|
6813
6815
|
|
|
6814
|
-
// src/rich-text-editor/plugins/DimensionsDetectorPlugin/index.tsx
|
|
6815
|
-
import { useEffect as useEffect3, useRef as useRef2, useState as useState4 } from "react";
|
|
6816
|
-
import { jsx as jsx126 } from "react/jsx-runtime";
|
|
6817
|
-
function DimensionDetectorPlugin({ onChange }) {
|
|
6818
|
-
const [dimensions, setDimensions] = useState4();
|
|
6819
|
-
const ref = useRef2(null);
|
|
6820
|
-
useEffect3(() => {
|
|
6821
|
-
if (ref.current) {
|
|
6822
|
-
const el = ref.current;
|
|
6823
|
-
const resizeObserver = new ResizeObserver((entries) => {
|
|
6824
|
-
const [first] = entries;
|
|
6825
|
-
if (first) {
|
|
6826
|
-
const [contentBox] = first.contentBoxSize;
|
|
6827
|
-
if (contentBox) {
|
|
6828
|
-
const width = contentBox.inlineSize;
|
|
6829
|
-
setDimensions({
|
|
6830
|
-
width,
|
|
6831
|
-
isSmallWidth: width < 600
|
|
6832
|
-
});
|
|
6833
|
-
}
|
|
6834
|
-
}
|
|
6835
|
-
});
|
|
6836
|
-
resizeObserver.observe(el);
|
|
6837
|
-
return () => resizeObserver.disconnect();
|
|
6838
|
-
}
|
|
6839
|
-
}, []);
|
|
6840
|
-
useEffect3(() => {
|
|
6841
|
-
if (dimensions) {
|
|
6842
|
-
onChange(dimensions);
|
|
6843
|
-
}
|
|
6844
|
-
}, [dimensions, onChange]);
|
|
6845
|
-
return /* @__PURE__ */ jsx126("div", {
|
|
6846
|
-
ref,
|
|
6847
|
-
style: { height: 1, marginTop: -1 }
|
|
6848
|
-
});
|
|
6849
|
-
}
|
|
6850
|
-
|
|
6851
6816
|
// src/rich-text-editor/plugins/FloatingLinkEditorPlugin/index.tsx
|
|
6852
|
-
import { useCallback, useEffect as
|
|
6817
|
+
import { useCallback, useEffect as useEffect4, useRef as useRef2, useState as useState5 } from "react";
|
|
6853
6818
|
import "react";
|
|
6854
6819
|
import {
|
|
6855
6820
|
$getSelection as $getSelection3,
|
|
@@ -6866,10 +6831,10 @@ import { useLexicalComposerContext as useLexicalComposerContext4 } from "@lexica
|
|
|
6866
6831
|
import { $findMatchingParent, mergeRegister } from "@lexical/utils";
|
|
6867
6832
|
|
|
6868
6833
|
// src/rich-text-editor/ui/LinkPreview.tsx
|
|
6869
|
-
import { Suspense, useEffect as
|
|
6834
|
+
import { Suspense, useEffect as useEffect3, useState as useState4 } from "react";
|
|
6870
6835
|
import { $getSelection as $getSelection2, $isTextNode as $isTextNode3 } from "lexical";
|
|
6871
6836
|
import { useLexicalComposerContext as useLexicalComposerContext3 } from "@lexical/react/LexicalComposerContext";
|
|
6872
|
-
import { Fragment as Fragment3, jsx as
|
|
6837
|
+
import { Fragment as Fragment3, jsx as jsx126, jsxs as jsxs104 } from "react/jsx-runtime";
|
|
6873
6838
|
var PREVIEW_CACHE = {};
|
|
6874
6839
|
var URL_MATCHER2 = /((https?:\/\/(www\.)?)|(www\.))[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)/;
|
|
6875
6840
|
function useSuspenseRequest(url) {
|
|
@@ -6893,12 +6858,12 @@ function useSuspenseRequest(url) {
|
|
|
6893
6858
|
function LinkPreviewContent({
|
|
6894
6859
|
url
|
|
6895
6860
|
}) {
|
|
6896
|
-
const [textContent, setTextContent] =
|
|
6861
|
+
const [textContent, setTextContent] = useState4("");
|
|
6897
6862
|
const { preview } = useSuspenseRequest(url);
|
|
6898
6863
|
const [editor] = useLexicalComposerContext3();
|
|
6899
6864
|
const tr = useTr();
|
|
6900
6865
|
const hasPreview = preview !== null && preview.google?.title;
|
|
6901
|
-
|
|
6866
|
+
useEffect3(() => {
|
|
6902
6867
|
editor.update(() => {
|
|
6903
6868
|
const sel = $getSelection2();
|
|
6904
6869
|
const nodes = sel?.getNodes();
|
|
@@ -6929,23 +6894,23 @@ function LinkPreviewContent({
|
|
|
6929
6894
|
return /* @__PURE__ */ jsxs104("div", {
|
|
6930
6895
|
className: "c-rte-link-preview",
|
|
6931
6896
|
children: [
|
|
6932
|
-
preview.google.image && /* @__PURE__ */
|
|
6897
|
+
preview.google.image && /* @__PURE__ */ jsx126("div", {
|
|
6933
6898
|
className: "c-rte-link-preview-image-wrapper",
|
|
6934
|
-
children: /* @__PURE__ */
|
|
6899
|
+
children: /* @__PURE__ */ jsx126("img", {
|
|
6935
6900
|
src: preview.google.image,
|
|
6936
6901
|
alt: preview.google.title,
|
|
6937
6902
|
className: "c-rte-link-preview-image"
|
|
6938
6903
|
})
|
|
6939
6904
|
}),
|
|
6940
|
-
preview.google.title && /* @__PURE__ */
|
|
6905
|
+
preview.google.title && /* @__PURE__ */ jsx126("div", {
|
|
6941
6906
|
className: "c-rte-link-preview-title",
|
|
6942
6907
|
children: preview.google.title
|
|
6943
6908
|
}),
|
|
6944
|
-
preview.google.description && /* @__PURE__ */
|
|
6909
|
+
preview.google.description && /* @__PURE__ */ jsx126("div", {
|
|
6945
6910
|
className: "c-rte-link-preview-description",
|
|
6946
6911
|
children: preview.google.description
|
|
6947
6912
|
}),
|
|
6948
|
-
textContent && textContent !== preview.google.title ? /* @__PURE__ */
|
|
6913
|
+
textContent && textContent !== preview.google.title ? /* @__PURE__ */ jsx126(Button, {
|
|
6949
6914
|
className: "c-rte-link-preview__replace-text-btn",
|
|
6950
6915
|
onClick: useTitleForText,
|
|
6951
6916
|
children: tr("linkPreviewReplaceTextWithTitle")
|
|
@@ -6954,7 +6919,7 @@ function LinkPreviewContent({
|
|
|
6954
6919
|
});
|
|
6955
6920
|
}
|
|
6956
6921
|
function Glimmer(props) {
|
|
6957
|
-
return /* @__PURE__ */
|
|
6922
|
+
return /* @__PURE__ */ jsx126("div", {
|
|
6958
6923
|
className: "c-rte-link-preview-glimmer",
|
|
6959
6924
|
...props,
|
|
6960
6925
|
style: {
|
|
@@ -6966,24 +6931,24 @@ function Glimmer(props) {
|
|
|
6966
6931
|
function LinkPreview({
|
|
6967
6932
|
url
|
|
6968
6933
|
}) {
|
|
6969
|
-
return /* @__PURE__ */
|
|
6934
|
+
return /* @__PURE__ */ jsx126(Suspense, {
|
|
6970
6935
|
fallback: /* @__PURE__ */ jsxs104(Fragment3, {
|
|
6971
6936
|
children: [
|
|
6972
|
-
/* @__PURE__ */
|
|
6937
|
+
/* @__PURE__ */ jsx126(Glimmer, {
|
|
6973
6938
|
style: { height: "80px" },
|
|
6974
6939
|
index: 0
|
|
6975
6940
|
}),
|
|
6976
|
-
/* @__PURE__ */
|
|
6941
|
+
/* @__PURE__ */ jsx126(Glimmer, {
|
|
6977
6942
|
style: { width: "60%" },
|
|
6978
6943
|
index: 1
|
|
6979
6944
|
}),
|
|
6980
|
-
/* @__PURE__ */
|
|
6945
|
+
/* @__PURE__ */ jsx126(Glimmer, {
|
|
6981
6946
|
style: { width: "80%" },
|
|
6982
6947
|
index: 2
|
|
6983
6948
|
})
|
|
6984
6949
|
]
|
|
6985
6950
|
}),
|
|
6986
|
-
children: /* @__PURE__ */
|
|
6951
|
+
children: /* @__PURE__ */ jsx126(LinkPreviewContent, {
|
|
6987
6952
|
url
|
|
6988
6953
|
})
|
|
6989
6954
|
});
|
|
@@ -7051,20 +7016,20 @@ function validateUrl(url) {
|
|
|
7051
7016
|
}
|
|
7052
7017
|
|
|
7053
7018
|
// src/rich-text-editor/plugins/FloatingLinkEditorPlugin/index.tsx
|
|
7054
|
-
import { Fragment as Fragment4, jsx as
|
|
7019
|
+
import { Fragment as Fragment4, jsx as jsx127, jsxs as jsxs105 } from "react/jsx-runtime";
|
|
7055
7020
|
function FloatingLinkEditor({
|
|
7056
7021
|
editor,
|
|
7057
7022
|
isLink,
|
|
7058
7023
|
setIsLink,
|
|
7059
7024
|
anchorElem
|
|
7060
7025
|
}) {
|
|
7061
|
-
const editorRef =
|
|
7062
|
-
const inputRef =
|
|
7063
|
-
const [linkUrl, setLinkUrl] =
|
|
7064
|
-
const [rel, setRel] =
|
|
7065
|
-
const [target, setTarget] =
|
|
7066
|
-
const [isEditMode, setEditMode] =
|
|
7067
|
-
const [lastSelection, setLastSelection] =
|
|
7026
|
+
const editorRef = useRef2(null);
|
|
7027
|
+
const inputRef = useRef2(null);
|
|
7028
|
+
const [linkUrl, setLinkUrl] = useState5("");
|
|
7029
|
+
const [rel, setRel] = useState5(null);
|
|
7030
|
+
const [target, setTarget] = useState5(null);
|
|
7031
|
+
const [isEditMode, setEditMode] = useState5(false);
|
|
7032
|
+
const [lastSelection, setLastSelection] = useState5(null);
|
|
7068
7033
|
const tr = useTr();
|
|
7069
7034
|
const updateLinkEditor = useCallback(() => {
|
|
7070
7035
|
const selection = $getSelection3();
|
|
@@ -7116,7 +7081,7 @@ function FloatingLinkEditor({
|
|
|
7116
7081
|
}
|
|
7117
7082
|
return true;
|
|
7118
7083
|
}, [anchorElem, editor]);
|
|
7119
|
-
|
|
7084
|
+
useEffect4(() => {
|
|
7120
7085
|
const scrollerElem = anchorElem.parentElement;
|
|
7121
7086
|
const update = () => {
|
|
7122
7087
|
editor.getEditorState().read(() => {
|
|
@@ -7134,7 +7099,7 @@ function FloatingLinkEditor({
|
|
|
7134
7099
|
}
|
|
7135
7100
|
};
|
|
7136
7101
|
}, [anchorElem.parentElement, editor, updateLinkEditor]);
|
|
7137
|
-
|
|
7102
|
+
useEffect4(() => {
|
|
7138
7103
|
return mergeRegister(
|
|
7139
7104
|
editor.registerUpdateListener(({ editorState }) => {
|
|
7140
7105
|
editorState.read(() => {
|
|
@@ -7162,51 +7127,53 @@ function FloatingLinkEditor({
|
|
|
7162
7127
|
)
|
|
7163
7128
|
);
|
|
7164
7129
|
}, [editor, updateLinkEditor, setIsLink, isLink]);
|
|
7165
|
-
|
|
7130
|
+
useEffect4(() => {
|
|
7166
7131
|
editor.getEditorState().read(() => {
|
|
7167
7132
|
updateLinkEditor();
|
|
7168
7133
|
});
|
|
7169
7134
|
}, [editor, updateLinkEditor]);
|
|
7170
|
-
|
|
7135
|
+
useEffect4(() => {
|
|
7171
7136
|
if (isEditMode && inputRef.current) {
|
|
7172
7137
|
inputRef.current.focus();
|
|
7173
7138
|
}
|
|
7174
7139
|
}, [isEditMode]);
|
|
7175
|
-
return /* @__PURE__ */
|
|
7140
|
+
return /* @__PURE__ */ jsx127("div", {
|
|
7176
7141
|
ref: editorRef,
|
|
7177
7142
|
className: "c-rte-link-editor",
|
|
7143
|
+
"data-testid": "rich-text-link-editor",
|
|
7178
7144
|
children: isEditMode ? /* @__PURE__ */ jsxs105("div", {
|
|
7179
7145
|
children: [
|
|
7180
|
-
/* @__PURE__ */
|
|
7146
|
+
/* @__PURE__ */ jsx127("div", {
|
|
7181
7147
|
className: "c-rte-link-editor-input-group",
|
|
7182
|
-
children: /* @__PURE__ */
|
|
7148
|
+
children: /* @__PURE__ */ jsx127(InputWithLabel, {
|
|
7183
7149
|
label: tr("linkEditorLink"),
|
|
7184
7150
|
type: "text",
|
|
7185
7151
|
value: linkUrl,
|
|
7186
7152
|
onChange: (e) => setLinkUrl(e.target.value)
|
|
7187
7153
|
})
|
|
7188
7154
|
}),
|
|
7189
|
-
/* @__PURE__ */
|
|
7155
|
+
/* @__PURE__ */ jsx127("div", {
|
|
7190
7156
|
className: "c-rte-link-editor-input-group",
|
|
7191
|
-
children: /* @__PURE__ */
|
|
7157
|
+
children: /* @__PURE__ */ jsx127(InputWithLabel, {
|
|
7192
7158
|
label: tr("linkEditorRel"),
|
|
7193
7159
|
type: "text",
|
|
7194
7160
|
value: rel ?? "",
|
|
7195
7161
|
onChange: (e) => setRel(e.target.value)
|
|
7196
7162
|
})
|
|
7197
7163
|
}),
|
|
7198
|
-
/* @__PURE__ */
|
|
7164
|
+
/* @__PURE__ */ jsx127("div", {
|
|
7199
7165
|
className: "c-rte-link-editor-input-group",
|
|
7200
|
-
children: /* @__PURE__ */
|
|
7166
|
+
children: /* @__PURE__ */ jsx127(InputWithLabel, {
|
|
7201
7167
|
label: tr("linkEditorTarget"),
|
|
7202
7168
|
type: "text",
|
|
7203
7169
|
value: target ?? "",
|
|
7204
7170
|
onChange: (e) => setTarget(e.target.value)
|
|
7205
7171
|
})
|
|
7206
7172
|
}),
|
|
7207
|
-
/* @__PURE__ */
|
|
7173
|
+
/* @__PURE__ */ jsx127("div", {
|
|
7208
7174
|
className: "c-rte-link-editor-button-wrap",
|
|
7209
|
-
children: /* @__PURE__ */
|
|
7175
|
+
children: /* @__PURE__ */ jsx127(Button, {
|
|
7176
|
+
"data-testid": "link-editor-save-button",
|
|
7210
7177
|
onClick: () => {
|
|
7211
7178
|
if (lastSelection !== null) {
|
|
7212
7179
|
if (linkUrl !== "") {
|
|
@@ -7231,7 +7198,7 @@ function FloatingLinkEditor({
|
|
|
7231
7198
|
/* @__PURE__ */ jsxs105("div", {
|
|
7232
7199
|
className: "c-rte-link-editor-link-preview",
|
|
7233
7200
|
children: [
|
|
7234
|
-
/* @__PURE__ */
|
|
7201
|
+
/* @__PURE__ */ jsx127("a", {
|
|
7235
7202
|
href: linkUrl,
|
|
7236
7203
|
target: "_blank",
|
|
7237
7204
|
rel: "noopener noreferrer",
|
|
@@ -7240,11 +7207,11 @@ function FloatingLinkEditor({
|
|
|
7240
7207
|
rel || target ? /* @__PURE__ */ jsxs105("div", {
|
|
7241
7208
|
className: "c-rte-link-editor-preview-attrs",
|
|
7242
7209
|
children: [
|
|
7243
|
-
rel && /* @__PURE__ */
|
|
7210
|
+
rel && /* @__PURE__ */ jsx127("div", {
|
|
7244
7211
|
className: "c-rte-link-editor-preview-attr",
|
|
7245
7212
|
children: rel
|
|
7246
7213
|
}),
|
|
7247
|
-
target && /* @__PURE__ */
|
|
7214
|
+
target && /* @__PURE__ */ jsx127("div", {
|
|
7248
7215
|
className: "c-rte-link-editor-preview-attr",
|
|
7249
7216
|
children: target
|
|
7250
7217
|
})
|
|
@@ -7252,20 +7219,21 @@ function FloatingLinkEditor({
|
|
|
7252
7219
|
}) : null
|
|
7253
7220
|
]
|
|
7254
7221
|
}),
|
|
7255
|
-
/* @__PURE__ */
|
|
7256
|
-
children: /* @__PURE__ */
|
|
7222
|
+
/* @__PURE__ */ jsx127("div", {
|
|
7223
|
+
children: /* @__PURE__ */ jsx127(IconButton, {
|
|
7257
7224
|
size: "sm",
|
|
7258
7225
|
tabIndex: 0,
|
|
7259
7226
|
onMouseDown: (event) => event.preventDefault(),
|
|
7260
7227
|
onClick: () => setEditMode(true),
|
|
7261
7228
|
"aria-label": tr("linkEditorEdit"),
|
|
7262
|
-
|
|
7229
|
+
"data-testid": "link-editor-edit",
|
|
7230
|
+
children: /* @__PURE__ */ jsx127(Icon.Edit, {})
|
|
7263
7231
|
})
|
|
7264
7232
|
})
|
|
7265
7233
|
]
|
|
7266
7234
|
}),
|
|
7267
|
-
/* @__PURE__ */
|
|
7268
|
-
children: /* @__PURE__ */
|
|
7235
|
+
/* @__PURE__ */ jsx127("div", {
|
|
7236
|
+
children: /* @__PURE__ */ jsx127(LinkPreview, {
|
|
7269
7237
|
url: linkUrl
|
|
7270
7238
|
})
|
|
7271
7239
|
})
|
|
@@ -7274,8 +7242,8 @@ function FloatingLinkEditor({
|
|
|
7274
7242
|
});
|
|
7275
7243
|
}
|
|
7276
7244
|
function useFloatingLinkEditorToolbar(editor, anchorElem) {
|
|
7277
|
-
const [activeEditor, setActiveEditor] =
|
|
7278
|
-
const [isLink, setIsLink] =
|
|
7245
|
+
const [activeEditor, setActiveEditor] = useState5(editor);
|
|
7246
|
+
const [isLink, setIsLink] = useState5(false);
|
|
7279
7247
|
const updateToolbar = useCallback(() => {
|
|
7280
7248
|
const selection = $getSelection3();
|
|
7281
7249
|
if ($isRangeSelection(selection)) {
|
|
@@ -7289,7 +7257,7 @@ function useFloatingLinkEditorToolbar(editor, anchorElem) {
|
|
|
7289
7257
|
}
|
|
7290
7258
|
}
|
|
7291
7259
|
}, []);
|
|
7292
|
-
|
|
7260
|
+
useEffect4(() => {
|
|
7293
7261
|
return editor.registerCommand(
|
|
7294
7262
|
SELECTION_CHANGE_COMMAND,
|
|
7295
7263
|
(_payload, newEditor) => {
|
|
@@ -7301,7 +7269,7 @@ function useFloatingLinkEditorToolbar(editor, anchorElem) {
|
|
|
7301
7269
|
);
|
|
7302
7270
|
}, [editor, updateToolbar]);
|
|
7303
7271
|
return isLink ? createPortal2(
|
|
7304
|
-
/* @__PURE__ */
|
|
7272
|
+
/* @__PURE__ */ jsx127(FloatingLinkEditor, {
|
|
7305
7273
|
editor: activeEditor,
|
|
7306
7274
|
isLink,
|
|
7307
7275
|
anchorElem,
|
|
@@ -7318,7 +7286,7 @@ function FloatingLinkEditorPlugin({
|
|
|
7318
7286
|
}
|
|
7319
7287
|
|
|
7320
7288
|
// src/rich-text-editor/plugins/FloatingTextFormatToolbarPlugin/index.tsx
|
|
7321
|
-
import { useCallback as useCallback2, useEffect as
|
|
7289
|
+
import { useCallback as useCallback2, useEffect as useEffect5, useRef as useRef3, useState as useState6 } from "react";
|
|
7322
7290
|
import "react";
|
|
7323
7291
|
import {
|
|
7324
7292
|
$getSelection as $getSelection4,
|
|
@@ -7367,7 +7335,7 @@ function getDOMRangeRect(nativeSelection, rootElement) {
|
|
|
7367
7335
|
}
|
|
7368
7336
|
|
|
7369
7337
|
// src/rich-text-editor/plugins/FloatingTextFormatToolbarPlugin/index.tsx
|
|
7370
|
-
import { jsx as
|
|
7338
|
+
import { jsx as jsx128, jsxs as jsxs106 } from "react/jsx-runtime";
|
|
7371
7339
|
function TextFormatFloatingToolbar({
|
|
7372
7340
|
editor,
|
|
7373
7341
|
anchorElem,
|
|
@@ -7380,7 +7348,7 @@ function TextFormatFloatingToolbar({
|
|
|
7380
7348
|
isSubscript,
|
|
7381
7349
|
isSuperscript
|
|
7382
7350
|
}) {
|
|
7383
|
-
const popupCharStylesEditorRef =
|
|
7351
|
+
const popupCharStylesEditorRef = useRef3(null);
|
|
7384
7352
|
const tr = useTr();
|
|
7385
7353
|
const insertLink = useCallback2(() => {
|
|
7386
7354
|
if (!isLink) {
|
|
@@ -7402,7 +7370,7 @@ function TextFormatFloatingToolbar({
|
|
|
7402
7370
|
setFloatingElemPosition(rangeRect, popupCharStylesEditorElem, anchorElem);
|
|
7403
7371
|
}
|
|
7404
7372
|
}, [editor, anchorElem]);
|
|
7405
|
-
|
|
7373
|
+
useEffect5(() => {
|
|
7406
7374
|
const scrollerElem = anchorElem.parentElement;
|
|
7407
7375
|
const update = () => {
|
|
7408
7376
|
editor.getEditorState().read(() => {
|
|
@@ -7420,7 +7388,7 @@ function TextFormatFloatingToolbar({
|
|
|
7420
7388
|
}
|
|
7421
7389
|
};
|
|
7422
7390
|
}, [editor, updateTextFormatFloatingToolbar, anchorElem]);
|
|
7423
|
-
|
|
7391
|
+
useEffect5(() => {
|
|
7424
7392
|
editor.getEditorState().read(() => {
|
|
7425
7393
|
updateTextFormatFloatingToolbar();
|
|
7426
7394
|
});
|
|
@@ -7441,109 +7409,109 @@ function TextFormatFloatingToolbar({
|
|
|
7441
7409
|
);
|
|
7442
7410
|
}, [editor, updateTextFormatFloatingToolbar]);
|
|
7443
7411
|
if (!editor.isEditable()) {
|
|
7444
|
-
return /* @__PURE__ */
|
|
7412
|
+
return /* @__PURE__ */ jsx128("span", {});
|
|
7445
7413
|
}
|
|
7446
7414
|
return /* @__PURE__ */ jsxs106("div", {
|
|
7447
7415
|
ref: popupCharStylesEditorRef,
|
|
7448
7416
|
className: "c-rte-floating-text-format-tb-plugin",
|
|
7449
7417
|
children: [
|
|
7450
|
-
/* @__PURE__ */
|
|
7418
|
+
/* @__PURE__ */ jsx128(IconButton, {
|
|
7451
7419
|
onClick: () => {
|
|
7452
7420
|
editor.dispatchCommand(FORMAT_TEXT_COMMAND, "bold");
|
|
7453
7421
|
},
|
|
7454
7422
|
style: { padding: 0, overflow: "hidden" },
|
|
7455
7423
|
title: tr(IS_APPLE ? "actionFormatAsStrongTitleApple" : "actionFormatAsStrongTitle"),
|
|
7456
7424
|
"aria-label": tr("actionFormatAsStrongLabel"),
|
|
7457
|
-
children: /* @__PURE__ */
|
|
7425
|
+
children: /* @__PURE__ */ jsx128("i", {
|
|
7458
7426
|
className: `c-rte-icon-bold c-rte-floating-text-format-tb-plugin__format-icon ${isBold ? "selected" : ""}`
|
|
7459
7427
|
})
|
|
7460
7428
|
}),
|
|
7461
|
-
/* @__PURE__ */
|
|
7429
|
+
/* @__PURE__ */ jsx128(IconButton, {
|
|
7462
7430
|
style: { padding: 0, overflow: "hidden" },
|
|
7463
7431
|
onClick: () => {
|
|
7464
7432
|
editor.dispatchCommand(FORMAT_TEXT_COMMAND, "italic");
|
|
7465
7433
|
},
|
|
7466
7434
|
title: tr("actionFormatAsEmphasizedTitle"),
|
|
7467
7435
|
"aria-label": tr("actionFormatAsEmphasizedLabel"),
|
|
7468
|
-
children: /* @__PURE__ */
|
|
7436
|
+
children: /* @__PURE__ */ jsx128("i", {
|
|
7469
7437
|
className: `c-rte-icon-italic c-rte-floating-text-format-tb-plugin__format-icon ${isItalic ? "selected" : ""}`
|
|
7470
7438
|
})
|
|
7471
7439
|
}),
|
|
7472
|
-
/* @__PURE__ */
|
|
7440
|
+
/* @__PURE__ */ jsx128(IconButton, {
|
|
7473
7441
|
style: { padding: 0, overflow: "hidden" },
|
|
7474
7442
|
onClick: () => {
|
|
7475
7443
|
editor.dispatchCommand(FORMAT_TEXT_COMMAND, "underline");
|
|
7476
7444
|
},
|
|
7477
7445
|
title: tr("actionFormatAsUnderlinedTitle"),
|
|
7478
7446
|
"aria-label": tr("actionFormatAsUnderlinedLabel"),
|
|
7479
|
-
children: /* @__PURE__ */
|
|
7447
|
+
children: /* @__PURE__ */ jsx128("i", {
|
|
7480
7448
|
className: `c-rte-icon-underline c-rte-floating-text-format-tb-plugin__format-icon ${isUnderline ? "selected" : ""}`
|
|
7481
7449
|
})
|
|
7482
7450
|
}),
|
|
7483
|
-
/* @__PURE__ */
|
|
7451
|
+
/* @__PURE__ */ jsx128(IconButton, {
|
|
7452
|
+
style: { padding: 0, overflow: "hidden" },
|
|
7453
|
+
onClick: () => {
|
|
7454
|
+
editor.dispatchCommand(FORMAT_TEXT_COMMAND, "code");
|
|
7455
|
+
},
|
|
7456
|
+
"aria-label": tr("actionInsertCodeBlock"),
|
|
7457
|
+
children: /* @__PURE__ */ jsx128("i", {
|
|
7458
|
+
className: `c-rte-icon-code c-rte-floating-text-format-tb-plugin__format-icon ${isCode ? "selected" : ""}`
|
|
7459
|
+
})
|
|
7460
|
+
}),
|
|
7461
|
+
/* @__PURE__ */ jsx128(IconButton, {
|
|
7462
|
+
style: { padding: 0, overflow: "hidden" },
|
|
7463
|
+
onClick: insertLink,
|
|
7464
|
+
"aria-label": tr("actionInsertlink"),
|
|
7465
|
+
children: /* @__PURE__ */ jsx128("i", {
|
|
7466
|
+
className: `c-rte-icon-link c-rte-floating-text-format-tb-plugin__format-icon ${isLink ? "selected" : ""}`
|
|
7467
|
+
})
|
|
7468
|
+
}),
|
|
7469
|
+
/* @__PURE__ */ jsx128(IconButton, {
|
|
7484
7470
|
style: { padding: 0, overflow: "hidden" },
|
|
7485
7471
|
onClick: () => {
|
|
7486
7472
|
editor.dispatchCommand(FORMAT_TEXT_COMMAND, "strikethrough");
|
|
7487
7473
|
},
|
|
7488
7474
|
title: tr("actionFormatWithStrikethroughTitle"),
|
|
7489
7475
|
"aria-label": tr("actionFormatWithStrikethroughLabel"),
|
|
7490
|
-
children: /* @__PURE__ */
|
|
7476
|
+
children: /* @__PURE__ */ jsx128("i", {
|
|
7491
7477
|
className: `c-rte-icon-strikethrough c-rte-floating-text-format-tb-plugin__format-icon ${isStrikethrough ? "selected" : ""}`
|
|
7492
7478
|
})
|
|
7493
7479
|
}),
|
|
7494
|
-
/* @__PURE__ */
|
|
7480
|
+
/* @__PURE__ */ jsx128(IconButton, {
|
|
7495
7481
|
style: { padding: 0, overflow: "hidden" },
|
|
7496
7482
|
onClick: () => {
|
|
7497
7483
|
editor.dispatchCommand(FORMAT_TEXT_COMMAND, "subscript");
|
|
7498
7484
|
},
|
|
7499
7485
|
title: tr("actionFormatWithSubscriptTitle"),
|
|
7500
7486
|
"aria-label": tr("actionFormatWithSubscriptLabel"),
|
|
7501
|
-
children: /* @__PURE__ */
|
|
7487
|
+
children: /* @__PURE__ */ jsx128("i", {
|
|
7502
7488
|
className: `c-rte-icon-subscript c-rte-floating-text-format-tb-plugin__format-icon ${isSubscript ? "selected" : ""}`
|
|
7503
7489
|
})
|
|
7504
7490
|
}),
|
|
7505
|
-
/* @__PURE__ */
|
|
7491
|
+
/* @__PURE__ */ jsx128(IconButton, {
|
|
7506
7492
|
style: { padding: 0, overflow: "hidden" },
|
|
7507
7493
|
onClick: () => {
|
|
7508
7494
|
editor.dispatchCommand(FORMAT_TEXT_COMMAND, "superscript");
|
|
7509
7495
|
},
|
|
7510
7496
|
title: tr("actionFormatWithSuperscriptTitle"),
|
|
7511
7497
|
"aria-label": tr("actionFormatWithSuperscriptLabel"),
|
|
7512
|
-
children: /* @__PURE__ */
|
|
7498
|
+
children: /* @__PURE__ */ jsx128("i", {
|
|
7513
7499
|
className: `c-rte-icon-superscript c-rte-floating-text-format-tb-plugin__format-icon ${isSuperscript ? "selected" : ""}`
|
|
7514
7500
|
})
|
|
7515
|
-
}),
|
|
7516
|
-
/* @__PURE__ */ jsx129(IconButton, {
|
|
7517
|
-
style: { padding: 0, overflow: "hidden" },
|
|
7518
|
-
onClick: () => {
|
|
7519
|
-
editor.dispatchCommand(FORMAT_TEXT_COMMAND, "code");
|
|
7520
|
-
},
|
|
7521
|
-
"aria-label": tr("actionInsertCodeBlock"),
|
|
7522
|
-
children: /* @__PURE__ */ jsx129("i", {
|
|
7523
|
-
className: `c-rte-icon-code c-rte-floating-text-format-tb-plugin__format-icon ${isCode ? "selected" : ""}`
|
|
7524
|
-
})
|
|
7525
|
-
}),
|
|
7526
|
-
/* @__PURE__ */ jsx129(IconButton, {
|
|
7527
|
-
style: { padding: 0, overflow: "hidden" },
|
|
7528
|
-
onClick: insertLink,
|
|
7529
|
-
"aria-label": tr("actionInsertlink"),
|
|
7530
|
-
children: /* @__PURE__ */ jsx129("i", {
|
|
7531
|
-
className: `c-rte-icon-link c-rte-floating-text-format-tb-plugin__format-icon ${isLink ? "selected" : ""}`
|
|
7532
|
-
})
|
|
7533
7501
|
})
|
|
7534
7502
|
]
|
|
7535
7503
|
});
|
|
7536
7504
|
}
|
|
7537
7505
|
function useFloatingTextFormatToolbar(editor, anchorElem) {
|
|
7538
|
-
const [isText, setIsText] =
|
|
7539
|
-
const [isLink, setIsLink] =
|
|
7540
|
-
const [isBold, setIsBold] =
|
|
7541
|
-
const [isItalic, setIsItalic] =
|
|
7542
|
-
const [isUnderline, setIsUnderline] =
|
|
7543
|
-
const [isStrikethrough, setIsStrikethrough] =
|
|
7544
|
-
const [isSubscript, setIsSubscript] =
|
|
7545
|
-
const [isSuperscript, setIsSuperscript] =
|
|
7546
|
-
const [isCode, setIsCode] =
|
|
7506
|
+
const [isText, setIsText] = useState6(false);
|
|
7507
|
+
const [isLink, setIsLink] = useState6(false);
|
|
7508
|
+
const [isBold, setIsBold] = useState6(false);
|
|
7509
|
+
const [isItalic, setIsItalic] = useState6(false);
|
|
7510
|
+
const [isUnderline, setIsUnderline] = useState6(false);
|
|
7511
|
+
const [isStrikethrough, setIsStrikethrough] = useState6(false);
|
|
7512
|
+
const [isSubscript, setIsSubscript] = useState6(false);
|
|
7513
|
+
const [isSuperscript, setIsSuperscript] = useState6(false);
|
|
7514
|
+
const [isCode, setIsCode] = useState6(false);
|
|
7547
7515
|
const updatePopup = useCallback2(() => {
|
|
7548
7516
|
editor.getEditorState().read(() => {
|
|
7549
7517
|
if (editor.isComposing()) {
|
|
@@ -7580,13 +7548,13 @@ function useFloatingTextFormatToolbar(editor, anchorElem) {
|
|
|
7580
7548
|
}
|
|
7581
7549
|
});
|
|
7582
7550
|
}, [editor]);
|
|
7583
|
-
|
|
7551
|
+
useEffect5(() => {
|
|
7584
7552
|
document.addEventListener("selectionchange", updatePopup);
|
|
7585
7553
|
return () => {
|
|
7586
7554
|
document.removeEventListener("selectionchange", updatePopup);
|
|
7587
7555
|
};
|
|
7588
7556
|
}, [updatePopup]);
|
|
7589
|
-
|
|
7557
|
+
useEffect5(() => {
|
|
7590
7558
|
return mergeRegister2(
|
|
7591
7559
|
editor.registerUpdateListener(() => {
|
|
7592
7560
|
updatePopup();
|
|
@@ -7602,7 +7570,7 @@ function useFloatingTextFormatToolbar(editor, anchorElem) {
|
|
|
7602
7570
|
return null;
|
|
7603
7571
|
}
|
|
7604
7572
|
return createPortal3(
|
|
7605
|
-
/* @__PURE__ */
|
|
7573
|
+
/* @__PURE__ */ jsx128(TextFormatFloatingToolbar, {
|
|
7606
7574
|
editor,
|
|
7607
7575
|
anchorElem,
|
|
7608
7576
|
isLink,
|
|
@@ -7627,15 +7595,15 @@ function FloatingTextFormatToolbarPlugin({
|
|
|
7627
7595
|
// src/rich-text-editor/plugins/LinkPlugin/index.tsx
|
|
7628
7596
|
import "react";
|
|
7629
7597
|
import { LinkPlugin as LexicalLinkPlugin } from "@lexical/react/LexicalLinkPlugin";
|
|
7630
|
-
import { jsx as
|
|
7598
|
+
import { jsx as jsx129 } from "react/jsx-runtime";
|
|
7631
7599
|
function LinkPlugin() {
|
|
7632
|
-
return /* @__PURE__ */
|
|
7600
|
+
return /* @__PURE__ */ jsx129(LexicalLinkPlugin, {
|
|
7633
7601
|
validateUrl
|
|
7634
7602
|
});
|
|
7635
7603
|
}
|
|
7636
7604
|
|
|
7637
7605
|
// src/rich-text-editor/plugins/ListMaxIndentLevelPlugin/index.ts
|
|
7638
|
-
import { useEffect as
|
|
7606
|
+
import { useEffect as useEffect6 } from "react";
|
|
7639
7607
|
import {
|
|
7640
7608
|
$getSelection as $getSelection5,
|
|
7641
7609
|
$isElementNode as $isElementNode2,
|
|
@@ -7674,7 +7642,7 @@ function isIndentPermitted(maxDepth) {
|
|
|
7674
7642
|
}
|
|
7675
7643
|
function ListMaxIndentLevelPlugin({ maxDepth }) {
|
|
7676
7644
|
const [editor] = useLexicalComposerContext6();
|
|
7677
|
-
|
|
7645
|
+
useEffect6(() => {
|
|
7678
7646
|
return editor.registerCommand(
|
|
7679
7647
|
INDENT_CONTENT_COMMAND,
|
|
7680
7648
|
() => !isIndentPermitted(maxDepth ?? 7),
|
|
@@ -7685,7 +7653,7 @@ function ListMaxIndentLevelPlugin({ maxDepth }) {
|
|
|
7685
7653
|
}
|
|
7686
7654
|
|
|
7687
7655
|
// src/rich-text-editor/plugins/MaxLengthPlugin/index.tsx
|
|
7688
|
-
import { useEffect as
|
|
7656
|
+
import { useEffect as useEffect7 } from "react";
|
|
7689
7657
|
import { $getSelection as $getSelection6, $isRangeSelection as $isRangeSelection4 } from "lexical";
|
|
7690
7658
|
import { useLexicalComposerContext as useLexicalComposerContext7 } from "@lexical/react/LexicalComposerContext";
|
|
7691
7659
|
import { trimTextContentFromAnchor } from "@lexical/selection";
|
|
@@ -7727,7 +7695,7 @@ ${content}
|
|
|
7727
7695
|
// src/rich-text-editor/plugins/MaxLengthPlugin/index.tsx
|
|
7728
7696
|
function MaxLengthPlugin({ maxLength }) {
|
|
7729
7697
|
const [editor] = useLexicalComposerContext7();
|
|
7730
|
-
|
|
7698
|
+
useEffect7(() => {
|
|
7731
7699
|
let lastRestoredEditorState = null;
|
|
7732
7700
|
return editor.registerUpdateListener(({ editorState, prevEditorState }) => {
|
|
7733
7701
|
editor.update(() => {
|
|
@@ -7757,7 +7725,7 @@ function MaxLengthPlugin({ maxLength }) {
|
|
|
7757
7725
|
}
|
|
7758
7726
|
|
|
7759
7727
|
// src/rich-text-editor/plugins/TabFocusPlugin/index.tsx
|
|
7760
|
-
import { useEffect as
|
|
7728
|
+
import { useEffect as useEffect8 } from "react";
|
|
7761
7729
|
import { $getSelection as $getSelection7, $isRangeSelection as $isRangeSelection5, $setSelection as $setSelection2, FOCUS_COMMAND } from "lexical";
|
|
7762
7730
|
import { useLexicalComposerContext as useLexicalComposerContext8 } from "@lexical/react/LexicalComposerContext";
|
|
7763
7731
|
var COMMAND_PRIORITY_LOW3 = 1;
|
|
@@ -7777,7 +7745,7 @@ function registerKeyTimeStampTracker() {
|
|
|
7777
7745
|
}
|
|
7778
7746
|
function TabFocusPlugin() {
|
|
7779
7747
|
const [editor] = useLexicalComposerContext8();
|
|
7780
|
-
|
|
7748
|
+
useEffect8(() => {
|
|
7781
7749
|
if (!hasRegisteredKeyDownListener) {
|
|
7782
7750
|
registerKeyTimeStampTracker();
|
|
7783
7751
|
hasRegisteredKeyDownListener = true;
|
|
@@ -7800,7 +7768,7 @@ function TabFocusPlugin() {
|
|
|
7800
7768
|
}
|
|
7801
7769
|
|
|
7802
7770
|
// src/rich-text-editor/plugins/TableActionMenuPlugin/index.tsx
|
|
7803
|
-
import { useCallback as useCallback3, useEffect as
|
|
7771
|
+
import { useCallback as useCallback3, useEffect as useEffect9, useRef as useRef4, useState as useState7 } from "react";
|
|
7804
7772
|
import { $getRoot as $getRoot3, $getSelection as $getSelection8, $isRangeSelection as $isRangeSelection6, DEPRECATED_$isGridSelection } from "lexical";
|
|
7805
7773
|
import { createPortal as createPortal4 } from "react-dom";
|
|
7806
7774
|
import { useLexicalComposerContext as useLexicalComposerContext9 } from "@lexical/react/LexicalComposerContext";
|
|
@@ -7822,16 +7790,16 @@ import {
|
|
|
7822
7790
|
TableCellHeaderStates,
|
|
7823
7791
|
TableCellNode as TableCellNode2
|
|
7824
7792
|
} from "@lexical/table";
|
|
7825
|
-
import { Fragment as Fragment5, jsx as
|
|
7793
|
+
import { Fragment as Fragment5, jsx as jsx130, jsxs as jsxs107 } from "react/jsx-runtime";
|
|
7826
7794
|
function TableActionMenu({ tableCellNode: _tableCellNode, tableStats }) {
|
|
7827
7795
|
const [editor] = useLexicalComposerContext9();
|
|
7828
|
-
const [tableCellNode, updateTableCellNode] =
|
|
7829
|
-
const [selectionCounts, updateSelectionCounts] =
|
|
7796
|
+
const [tableCellNode, updateTableCellNode] = useState7(_tableCellNode);
|
|
7797
|
+
const [selectionCounts, updateSelectionCounts] = useState7({
|
|
7830
7798
|
columns: 1,
|
|
7831
7799
|
rows: 1
|
|
7832
7800
|
});
|
|
7833
7801
|
const tr = useTr();
|
|
7834
|
-
|
|
7802
|
+
useEffect9(() => {
|
|
7835
7803
|
return editor.registerMutationListener(TableCellNode2, (nodeMutations) => {
|
|
7836
7804
|
const nodeUpdated = nodeMutations.get(tableCellNode.getKey()) === "updated";
|
|
7837
7805
|
if (nodeUpdated) {
|
|
@@ -7841,7 +7809,7 @@ function TableActionMenu({ tableCellNode: _tableCellNode, tableStats }) {
|
|
|
7841
7809
|
}
|
|
7842
7810
|
});
|
|
7843
7811
|
}, [editor, tableCellNode]);
|
|
7844
|
-
|
|
7812
|
+
useEffect9(() => {
|
|
7845
7813
|
editor.getEditorState().read(() => {
|
|
7846
7814
|
const selection = $getSelection8();
|
|
7847
7815
|
if (DEPRECATED_$isGridSelection(selection)) {
|
|
@@ -7979,44 +7947,44 @@ function TableActionMenu({ tableCellNode: _tableCellNode, tableStats }) {
|
|
|
7979
7947
|
}, [editor, tableCellNode, clearTableSelection]);
|
|
7980
7948
|
return /* @__PURE__ */ jsxs107(Fragment5, {
|
|
7981
7949
|
children: [
|
|
7982
|
-
/* @__PURE__ */
|
|
7950
|
+
/* @__PURE__ */ jsx130(DropdownMenu.Item, {
|
|
7983
7951
|
onSelect: () => insertTableRowAtSelection(false),
|
|
7984
7952
|
children: tr("actionTableInsertRowsAbove", selectionCounts.rows)
|
|
7985
7953
|
}),
|
|
7986
|
-
/* @__PURE__ */
|
|
7954
|
+
/* @__PURE__ */ jsx130(DropdownMenu.Item, {
|
|
7987
7955
|
onSelect: () => insertTableRowAtSelection(true),
|
|
7988
7956
|
children: tr("actionTableInsertRowsBelow", selectionCounts.rows)
|
|
7989
7957
|
}),
|
|
7990
|
-
/* @__PURE__ */
|
|
7958
|
+
/* @__PURE__ */ jsx130(DropdownMenu.Item, {
|
|
7991
7959
|
onSelect: () => insertTableColumnAtSelection(false),
|
|
7992
7960
|
children: tr("actionTableInsertColumnsBefore", selectionCounts.columns)
|
|
7993
7961
|
}),
|
|
7994
|
-
/* @__PURE__ */
|
|
7962
|
+
/* @__PURE__ */ jsx130(DropdownMenu.Item, {
|
|
7995
7963
|
onSelect: () => insertTableColumnAtSelection(true),
|
|
7996
7964
|
children: tr("actionTableInsertColumnsAfter", selectionCounts.columns)
|
|
7997
7965
|
}),
|
|
7998
|
-
/* @__PURE__ */
|
|
7966
|
+
/* @__PURE__ */ jsx130(DropdownMenu.Item, {
|
|
7999
7967
|
onSelect: () => toggleTableRowIsHeader(),
|
|
8000
7968
|
children: tr(
|
|
8001
7969
|
(tableCellNode.__headerState & TableCellHeaderStates.ROW) === TableCellHeaderStates.ROW ? "actionTableRemoveRowHeader" : "actionTableAddRowHeader"
|
|
8002
7970
|
)
|
|
8003
7971
|
}),
|
|
8004
|
-
/* @__PURE__ */
|
|
7972
|
+
/* @__PURE__ */ jsx130(DropdownMenu.Item, {
|
|
8005
7973
|
onSelect: () => toggleTableColumnIsHeader(),
|
|
8006
7974
|
children: tr(
|
|
8007
7975
|
(tableCellNode.__headerState & TableCellHeaderStates.COLUMN) === TableCellHeaderStates.COLUMN ? "actionTableRemoveColumnHeader" : "actionTableAddColumnHeader"
|
|
8008
7976
|
)
|
|
8009
7977
|
}),
|
|
8010
|
-
/* @__PURE__ */
|
|
8011
|
-
tableStats.columns > 1 && /* @__PURE__ */
|
|
7978
|
+
/* @__PURE__ */ jsx130(DropdownMenu.Separator, {}),
|
|
7979
|
+
tableStats.columns > 1 && /* @__PURE__ */ jsx130(DropdownMenu.Item, {
|
|
8012
7980
|
onSelect: () => deleteTableColumnAtSelection(),
|
|
8013
7981
|
children: tr("actionTableDeleteColumn")
|
|
8014
7982
|
}),
|
|
8015
|
-
tableStats.rows > 1 && /* @__PURE__ */
|
|
7983
|
+
tableStats.rows > 1 && /* @__PURE__ */ jsx130(DropdownMenu.Item, {
|
|
8016
7984
|
onSelect: () => deleteTableRowAtSelection(),
|
|
8017
7985
|
children: tr("actionTableDeleteRow")
|
|
8018
7986
|
}),
|
|
8019
|
-
/* @__PURE__ */
|
|
7987
|
+
/* @__PURE__ */ jsx130(DropdownMenu.Item, {
|
|
8020
7988
|
onSelect: () => deleteTableAtSelection(),
|
|
8021
7989
|
children: tr("actionTableDeleteTable")
|
|
8022
7990
|
})
|
|
@@ -8026,10 +7994,10 @@ function TableActionMenu({ tableCellNode: _tableCellNode, tableStats }) {
|
|
|
8026
7994
|
function TableCellActionMenuContainer({ anchorElem }) {
|
|
8027
7995
|
const [editor] = useLexicalComposerContext9();
|
|
8028
7996
|
const tr = useTr();
|
|
8029
|
-
const menuButtonRef =
|
|
8030
|
-
const [isMenuOpen, setIsMenuOpen] =
|
|
8031
|
-
const [tableCellNode, setTableMenuCellNode] =
|
|
8032
|
-
const [tableStats, setTablestats] =
|
|
7997
|
+
const menuButtonRef = useRef4(null);
|
|
7998
|
+
const [isMenuOpen, setIsMenuOpen] = useState7(false);
|
|
7999
|
+
const [tableCellNode, setTableMenuCellNode] = useState7(null);
|
|
8000
|
+
const [tableStats, setTablestats] = useState7({ rows: 1, columns: 1 });
|
|
8033
8001
|
const moveMenu = useCallback3(() => {
|
|
8034
8002
|
if (isMenuOpen) {
|
|
8035
8003
|
return;
|
|
@@ -8073,14 +8041,14 @@ function TableCellActionMenuContainer({ anchorElem }) {
|
|
|
8073
8041
|
setTableMenuCellNode(null);
|
|
8074
8042
|
}
|
|
8075
8043
|
}, [editor, isMenuOpen]);
|
|
8076
|
-
|
|
8044
|
+
useEffect9(() => {
|
|
8077
8045
|
return editor.registerUpdateListener(() => {
|
|
8078
8046
|
editor.getEditorState().read(() => {
|
|
8079
8047
|
moveMenu();
|
|
8080
8048
|
});
|
|
8081
8049
|
});
|
|
8082
8050
|
});
|
|
8083
|
-
|
|
8051
|
+
useEffect9(() => {
|
|
8084
8052
|
const menuButtonDOM = menuButtonRef.current;
|
|
8085
8053
|
if (menuButtonDOM != null && tableCellNode != null) {
|
|
8086
8054
|
const tableCellNodeDOM = editor.getElementByKey(tableCellNode.getKey());
|
|
@@ -8098,19 +8066,19 @@ function TableCellActionMenuContainer({ anchorElem }) {
|
|
|
8098
8066
|
}
|
|
8099
8067
|
}
|
|
8100
8068
|
}, [menuButtonRef, tableCellNode, editor, anchorElem]);
|
|
8101
|
-
return /* @__PURE__ */
|
|
8069
|
+
return /* @__PURE__ */ jsx130("div", {
|
|
8102
8070
|
className: "c-rte-table-cell-action-button-container",
|
|
8103
8071
|
ref: menuButtonRef,
|
|
8104
|
-
children: tableCellNode != null && /* @__PURE__ */
|
|
8072
|
+
children: tableCellNode != null && /* @__PURE__ */ jsx130(DropdownMenu.Root, {
|
|
8105
8073
|
onOpenChange: (isOpen) => setIsMenuOpen(isOpen),
|
|
8106
|
-
content: /* @__PURE__ */
|
|
8074
|
+
content: /* @__PURE__ */ jsx130(TableActionMenu, {
|
|
8107
8075
|
tableCellNode,
|
|
8108
8076
|
tableStats
|
|
8109
8077
|
}),
|
|
8110
|
-
children: /* @__PURE__ */
|
|
8078
|
+
children: /* @__PURE__ */ jsx130(IconButton, {
|
|
8111
8079
|
size: "xs",
|
|
8112
8080
|
"aria-label": tr("actionTableOpenOptions"),
|
|
8113
|
-
children: /* @__PURE__ */
|
|
8081
|
+
children: /* @__PURE__ */ jsx130(Icon.Arrow, {})
|
|
8114
8082
|
})
|
|
8115
8083
|
})
|
|
8116
8084
|
});
|
|
@@ -8119,13 +8087,13 @@ function TableActionMenuPlugin({
|
|
|
8119
8087
|
anchorElem = document.body
|
|
8120
8088
|
}) {
|
|
8121
8089
|
const isEditable = useLexicalEditable();
|
|
8122
|
-
return createPortal4(isEditable ? /* @__PURE__ */
|
|
8090
|
+
return createPortal4(isEditable ? /* @__PURE__ */ jsx130(TableCellActionMenuContainer, {
|
|
8123
8091
|
anchorElem
|
|
8124
8092
|
}) : null, anchorElem);
|
|
8125
8093
|
}
|
|
8126
8094
|
|
|
8127
8095
|
// src/rich-text-editor/plugins/ToolbarPlugin/index.tsx
|
|
8128
|
-
import { useCallback as useCallback4, useEffect as
|
|
8096
|
+
import { useCallback as useCallback4, useEffect as useEffect10, useState as useState9 } from "react";
|
|
8129
8097
|
import {
|
|
8130
8098
|
$createParagraphNode as $createParagraphNode2,
|
|
8131
8099
|
$getNodeByKey,
|
|
@@ -8171,10 +8139,9 @@ import {
|
|
|
8171
8139
|
} from "@lexical/utils";
|
|
8172
8140
|
|
|
8173
8141
|
// src/rich-text-editor/plugins/ActionsPlugin/index.tsx
|
|
8174
|
-
import { useRef as useRef6 } from "react";
|
|
8175
8142
|
import { CLEAR_EDITOR_COMMAND } from "lexical";
|
|
8176
8143
|
import { useLexicalComposerContext as useLexicalComposerContext10 } from "@lexical/react/LexicalComposerContext";
|
|
8177
|
-
import { jsx as
|
|
8144
|
+
import { jsx as jsx131, jsxs as jsxs108 } from "react/jsx-runtime";
|
|
8178
8145
|
async function copyJson(editor) {
|
|
8179
8146
|
const json = lexicalToCrystallizeRichText({ editor, editorState: editor.getEditorState() });
|
|
8180
8147
|
try {
|
|
@@ -8189,47 +8156,41 @@ function ActionsPlugin({
|
|
|
8189
8156
|
}) {
|
|
8190
8157
|
const [editor] = useLexicalComposerContext10();
|
|
8191
8158
|
const tr = useTr();
|
|
8192
|
-
|
|
8193
|
-
|
|
8194
|
-
|
|
8195
|
-
|
|
8196
|
-
|
|
8197
|
-
|
|
8198
|
-
|
|
8199
|
-
|
|
8200
|
-
|
|
8201
|
-
|
|
8202
|
-
|
|
8203
|
-
|
|
8204
|
-
|
|
8205
|
-
|
|
8206
|
-
|
|
8207
|
-
|
|
8208
|
-
|
|
8209
|
-
|
|
8210
|
-
|
|
8211
|
-
|
|
8212
|
-
|
|
8213
|
-
|
|
8214
|
-
|
|
8215
|
-
|
|
8216
|
-
|
|
8217
|
-
onSelect: actionItem.action,
|
|
8218
|
-
className: actionItem.type === "danger" ? "danger" : "",
|
|
8219
|
-
children: actionItem.title
|
|
8220
|
-
}, actionItem.title))
|
|
8221
|
-
]
|
|
8222
|
-
})
|
|
8159
|
+
return /* @__PURE__ */ jsxs108(ActionMenu, {
|
|
8160
|
+
children: [
|
|
8161
|
+
!prepend ? null : prepend.map((actionItem) => /* @__PURE__ */ jsx131(ActionMenu.Item, {
|
|
8162
|
+
onSelect: actionItem.action,
|
|
8163
|
+
className: actionItem.type === "danger" ? "danger" : "",
|
|
8164
|
+
children: actionItem.title
|
|
8165
|
+
}, actionItem.title)),
|
|
8166
|
+
/* @__PURE__ */ jsx131(ActionMenu.Item, {
|
|
8167
|
+
onSelect: () => copyJson(editor),
|
|
8168
|
+
children: tr("actionCopyJSON")
|
|
8169
|
+
}),
|
|
8170
|
+
/* @__PURE__ */ jsx131(ActionMenu.Item, {
|
|
8171
|
+
className: "danger",
|
|
8172
|
+
onSelect: () => {
|
|
8173
|
+
editor.dispatchCommand(CLEAR_EDITOR_COMMAND, void 0);
|
|
8174
|
+
editor.focus();
|
|
8175
|
+
},
|
|
8176
|
+
children: tr("actionClear")
|
|
8177
|
+
}),
|
|
8178
|
+
!append ? null : append.map((actionItem) => /* @__PURE__ */ jsx131(ActionMenu.Item, {
|
|
8179
|
+
onSelect: actionItem.action,
|
|
8180
|
+
className: actionItem.type === "danger" ? "danger" : "",
|
|
8181
|
+
children: actionItem.title
|
|
8182
|
+
}, actionItem.title))
|
|
8183
|
+
]
|
|
8223
8184
|
});
|
|
8224
8185
|
}
|
|
8225
8186
|
|
|
8226
8187
|
// src/rich-text-editor/plugins/ToolbarPlugin/insert-table.tsx
|
|
8227
|
-
import { useState as
|
|
8188
|
+
import { useState as useState8 } from "react";
|
|
8228
8189
|
import { INSERT_TABLE_COMMAND } from "@lexical/table";
|
|
8229
|
-
import { jsx as
|
|
8190
|
+
import { jsx as jsx132, jsxs as jsxs109 } from "react/jsx-runtime";
|
|
8230
8191
|
function InsertTableDialog({ activeEditor }) {
|
|
8231
|
-
const [rows, setRows] =
|
|
8232
|
-
const [columns, setColumns] =
|
|
8192
|
+
const [rows, setRows] = useState8("5");
|
|
8193
|
+
const [columns, setColumns] = useState8("5");
|
|
8233
8194
|
const tr = useTr();
|
|
8234
8195
|
const onClick = () => {
|
|
8235
8196
|
if (parseInt(rows) < 1 || parseInt(columns) < 1) {
|
|
@@ -8250,7 +8211,7 @@ function InsertTableDialog({ activeEditor }) {
|
|
|
8250
8211
|
/* @__PURE__ */ jsxs109("div", {
|
|
8251
8212
|
className: "c-rte-insert-table__dimensions",
|
|
8252
8213
|
children: [
|
|
8253
|
-
/* @__PURE__ */
|
|
8214
|
+
/* @__PURE__ */ jsx132(InputWithLabel, {
|
|
8254
8215
|
label: tr("insertTableRows"),
|
|
8255
8216
|
value: rows,
|
|
8256
8217
|
placeholder: "0",
|
|
@@ -8258,10 +8219,10 @@ function InsertTableDialog({ activeEditor }) {
|
|
|
8258
8219
|
inputMode: "numeric",
|
|
8259
8220
|
onChange: (e) => setRows(e.target.value)
|
|
8260
8221
|
}),
|
|
8261
|
-
/* @__PURE__ */
|
|
8222
|
+
/* @__PURE__ */ jsx132("span", {
|
|
8262
8223
|
className: "c-rte-insert-table__dimensions__separator"
|
|
8263
8224
|
}),
|
|
8264
|
-
/* @__PURE__ */
|
|
8225
|
+
/* @__PURE__ */ jsx132(InputWithLabel, {
|
|
8265
8226
|
type: "text",
|
|
8266
8227
|
label: tr("insertTableColumns"),
|
|
8267
8228
|
placeholder: "0",
|
|
@@ -8271,9 +8232,9 @@ function InsertTableDialog({ activeEditor }) {
|
|
|
8271
8232
|
})
|
|
8272
8233
|
]
|
|
8273
8234
|
}),
|
|
8274
|
-
/* @__PURE__ */
|
|
8235
|
+
/* @__PURE__ */ jsx132("div", {
|
|
8275
8236
|
className: "c-rte-insert-table__actions",
|
|
8276
|
-
children: /* @__PURE__ */
|
|
8237
|
+
children: /* @__PURE__ */ jsx132(Button, {
|
|
8277
8238
|
as: Dialog.Close,
|
|
8278
8239
|
size: "sm",
|
|
8279
8240
|
intent: "action",
|
|
@@ -8287,7 +8248,7 @@ function InsertTableDialog({ activeEditor }) {
|
|
|
8287
8248
|
}
|
|
8288
8249
|
|
|
8289
8250
|
// src/rich-text-editor/plugins/ToolbarPlugin/index.tsx
|
|
8290
|
-
import { Fragment as Fragment6, jsx as
|
|
8251
|
+
import { Fragment as Fragment6, jsx as jsx133, jsxs as jsxs110 } from "react/jsx-runtime";
|
|
8291
8252
|
var headingTypeToBlockName = {
|
|
8292
8253
|
h1: "Heading 1",
|
|
8293
8254
|
h2: "Heading 2",
|
|
@@ -8391,7 +8352,7 @@ function BlockFormatDropDown({
|
|
|
8391
8352
|
});
|
|
8392
8353
|
}
|
|
8393
8354
|
};
|
|
8394
|
-
return /* @__PURE__ */
|
|
8355
|
+
return /* @__PURE__ */ jsx133(DropdownMenu.Root, {
|
|
8395
8356
|
disabled,
|
|
8396
8357
|
style: { zIndex: 1 },
|
|
8397
8358
|
content: /* @__PURE__ */ jsxs110(Fragment6, {
|
|
@@ -8399,10 +8360,10 @@ function BlockFormatDropDown({
|
|
|
8399
8360
|
/* @__PURE__ */ jsxs110(DropdownMenu.Item, {
|
|
8400
8361
|
onClick: formatParagraph,
|
|
8401
8362
|
children: [
|
|
8402
|
-
/* @__PURE__ */
|
|
8363
|
+
/* @__PURE__ */ jsx133("i", {
|
|
8403
8364
|
className: `c-rte-icon-paragraph c-rte-toolbar__block-format__icon ${blockType === "paragraph" ? "selected" : ""}`
|
|
8404
8365
|
}),
|
|
8405
|
-
/* @__PURE__ */
|
|
8366
|
+
/* @__PURE__ */ jsx133("span", {
|
|
8406
8367
|
className: `c-rte-toolbar__block-format__text ${blockType === "paragraph" ? "selected" : ""}`,
|
|
8407
8368
|
children: "Normal"
|
|
8408
8369
|
})
|
|
@@ -8411,10 +8372,10 @@ function BlockFormatDropDown({
|
|
|
8411
8372
|
headings.map((headingSize) => /* @__PURE__ */ jsxs110(DropdownMenu.Item, {
|
|
8412
8373
|
onClick: () => formatHeading(headingSize),
|
|
8413
8374
|
children: [
|
|
8414
|
-
/* @__PURE__ */
|
|
8375
|
+
/* @__PURE__ */ jsx133("i", {
|
|
8415
8376
|
className: `c-rte-icon-${headingSize} c-rte-toolbar__block-format__icon ${blockType === headingSize ? "selected" : ""}`
|
|
8416
8377
|
}),
|
|
8417
|
-
/* @__PURE__ */
|
|
8378
|
+
/* @__PURE__ */ jsx133("span", {
|
|
8418
8379
|
className: `c-rte-toolbar__block-format__text ${blockType === headingSize ? "selected" : ""}`,
|
|
8419
8380
|
children: headingTypeToBlockName[headingSize]
|
|
8420
8381
|
})
|
|
@@ -8423,10 +8384,10 @@ function BlockFormatDropDown({
|
|
|
8423
8384
|
/* @__PURE__ */ jsxs110(DropdownMenu.Item, {
|
|
8424
8385
|
onClick: formatBulletList,
|
|
8425
8386
|
children: [
|
|
8426
|
-
/* @__PURE__ */
|
|
8387
|
+
/* @__PURE__ */ jsx133("i", {
|
|
8427
8388
|
className: `c-rte-icon-bullet-list c-rte-toolbar__block-format__icon ${blockType === "bullet" ? "selected" : ""}`
|
|
8428
8389
|
}),
|
|
8429
|
-
/* @__PURE__ */
|
|
8390
|
+
/* @__PURE__ */ jsx133("span", {
|
|
8430
8391
|
className: `c-rte-toolbar__block-format__text ${blockType === "bullet" ? "selected" : ""}`,
|
|
8431
8392
|
children: "Bullet List"
|
|
8432
8393
|
})
|
|
@@ -8435,10 +8396,10 @@ function BlockFormatDropDown({
|
|
|
8435
8396
|
/* @__PURE__ */ jsxs110(DropdownMenu.Item, {
|
|
8436
8397
|
onClick: formatNumberedList,
|
|
8437
8398
|
children: [
|
|
8438
|
-
/* @__PURE__ */
|
|
8399
|
+
/* @__PURE__ */ jsx133("i", {
|
|
8439
8400
|
className: `c-rte-icon-numbered-list c-rte-toolbar__block-format__icon ${blockType === "number" ? "selected" : ""}`
|
|
8440
8401
|
}),
|
|
8441
|
-
/* @__PURE__ */
|
|
8402
|
+
/* @__PURE__ */ jsx133("span", {
|
|
8442
8403
|
className: `c-rte-toolbar__block-format__text ${blockType === "number" ? "selected" : ""}`,
|
|
8443
8404
|
children: "Numbered List"
|
|
8444
8405
|
})
|
|
@@ -8448,10 +8409,10 @@ function BlockFormatDropDown({
|
|
|
8448
8409
|
onClick: formatQuote,
|
|
8449
8410
|
"data-testid": "toggle-block-format-quote",
|
|
8450
8411
|
children: [
|
|
8451
|
-
/* @__PURE__ */
|
|
8412
|
+
/* @__PURE__ */ jsx133("i", {
|
|
8452
8413
|
className: `c-rte-icon-quote c-rte-toolbar__block-format__icon ${blockType === "quote" ? "selected" : ""}`
|
|
8453
8414
|
}),
|
|
8454
|
-
/* @__PURE__ */
|
|
8415
|
+
/* @__PURE__ */ jsx133("span", {
|
|
8455
8416
|
className: `c-rte-toolbar__block-format__text ${blockType === "quote" ? "selected" : ""}`,
|
|
8456
8417
|
children: "Quote"
|
|
8457
8418
|
})
|
|
@@ -8461,10 +8422,10 @@ function BlockFormatDropDown({
|
|
|
8461
8422
|
onClick: formatCode,
|
|
8462
8423
|
"data-testid": "toggle-block-format-code",
|
|
8463
8424
|
children: [
|
|
8464
|
-
/* @__PURE__ */
|
|
8425
|
+
/* @__PURE__ */ jsx133("i", {
|
|
8465
8426
|
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" : ""}`
|
|
8466
8427
|
}),
|
|
8467
|
-
/* @__PURE__ */
|
|
8428
|
+
/* @__PURE__ */ jsx133("span", {
|
|
8468
8429
|
className: `c-rte-toolbar__block-format__text ${blockType === "code" ? "selected" : ""}`,
|
|
8469
8430
|
children: "Code block"
|
|
8470
8431
|
})
|
|
@@ -8477,16 +8438,16 @@ function BlockFormatDropDown({
|
|
|
8477
8438
|
"aria-label": "Formatting options for text style",
|
|
8478
8439
|
"data-testid": "toggle-block-format",
|
|
8479
8440
|
children: [
|
|
8480
|
-
/* @__PURE__ */
|
|
8441
|
+
/* @__PURE__ */ jsx133("i", {
|
|
8481
8442
|
className: `c-rte-toolbar__toggle-icon c-rte-icon-${blockType}`
|
|
8482
8443
|
}),
|
|
8483
|
-
/* @__PURE__ */
|
|
8444
|
+
/* @__PURE__ */ jsx133(Icon.Arrow, {})
|
|
8484
8445
|
]
|
|
8485
8446
|
})
|
|
8486
8447
|
});
|
|
8487
8448
|
}
|
|
8488
8449
|
function Divider() {
|
|
8489
|
-
return /* @__PURE__ */
|
|
8450
|
+
return /* @__PURE__ */ jsx133("div", {
|
|
8490
8451
|
className: "c-rte-toolbar__divider"
|
|
8491
8452
|
});
|
|
8492
8453
|
}
|
|
@@ -8495,22 +8456,22 @@ function ToolbarPlugin({
|
|
|
8495
8456
|
actionsMenuAppend
|
|
8496
8457
|
}) {
|
|
8497
8458
|
const [editor] = useLexicalComposerContext11();
|
|
8498
|
-
const [activeEditor, setActiveEditor] =
|
|
8499
|
-
const [blockType, setBlockType] =
|
|
8500
|
-
const [selectedElementKey, setSelectedElementKey] =
|
|
8501
|
-
const [isLink, setIsLink] =
|
|
8502
|
-
const [isBold, setIsBold] =
|
|
8503
|
-
const [isItalic, setIsItalic] =
|
|
8504
|
-
const [isUnderline, setIsUnderline] =
|
|
8505
|
-
const [isStrikethrough, setIsStrikethrough] =
|
|
8506
|
-
const [isSubscript, setIsSubscript] =
|
|
8507
|
-
const [isSuperscript, setIsSuperscript] =
|
|
8508
|
-
const [isCode, setIsCode] =
|
|
8509
|
-
const [canUndo, setCanUndo] =
|
|
8510
|
-
const [canRedo, setCanRedo] =
|
|
8459
|
+
const [activeEditor, setActiveEditor] = useState9(editor);
|
|
8460
|
+
const [blockType, setBlockType] = useState9("paragraph");
|
|
8461
|
+
const [selectedElementKey, setSelectedElementKey] = useState9(null);
|
|
8462
|
+
const [isLink, setIsLink] = useState9(false);
|
|
8463
|
+
const [isBold, setIsBold] = useState9(false);
|
|
8464
|
+
const [isItalic, setIsItalic] = useState9(false);
|
|
8465
|
+
const [isUnderline, setIsUnderline] = useState9(false);
|
|
8466
|
+
const [isStrikethrough, setIsStrikethrough] = useState9(false);
|
|
8467
|
+
const [isSubscript, setIsSubscript] = useState9(false);
|
|
8468
|
+
const [isSuperscript, setIsSuperscript] = useState9(false);
|
|
8469
|
+
const [isCode, setIsCode] = useState9(false);
|
|
8470
|
+
const [canUndo, setCanUndo] = useState9(false);
|
|
8471
|
+
const [canRedo, setCanRedo] = useState9(false);
|
|
8511
8472
|
const tr = useTr();
|
|
8512
|
-
const [codeLanguage, setCodeLanguage] =
|
|
8513
|
-
const [isEditable, setIsEditable] =
|
|
8473
|
+
const [codeLanguage, setCodeLanguage] = useState9("");
|
|
8474
|
+
const [isEditable, setIsEditable] = useState9(() => editor.isEditable());
|
|
8514
8475
|
const updateToolbar = useCallback4(() => {
|
|
8515
8476
|
const selection = $getSelection9();
|
|
8516
8477
|
if ($isRangeSelection7(selection)) {
|
|
@@ -8558,7 +8519,7 @@ function ToolbarPlugin({
|
|
|
8558
8519
|
}
|
|
8559
8520
|
}
|
|
8560
8521
|
}, [activeEditor]);
|
|
8561
|
-
|
|
8522
|
+
useEffect10(() => {
|
|
8562
8523
|
return editor.registerCommand(
|
|
8563
8524
|
SELECTION_CHANGE_COMMAND3,
|
|
8564
8525
|
(_payload, newEditor) => {
|
|
@@ -8569,7 +8530,7 @@ function ToolbarPlugin({
|
|
|
8569
8530
|
COMMAND_PRIORITY_CRITICAL3
|
|
8570
8531
|
);
|
|
8571
8532
|
}, [editor, updateToolbar]);
|
|
8572
|
-
|
|
8533
|
+
useEffect10(() => {
|
|
8573
8534
|
return mergeRegister3(
|
|
8574
8535
|
editor.registerEditableListener((editable) => {
|
|
8575
8536
|
setIsEditable(editable);
|
|
@@ -8641,7 +8602,7 @@ function ToolbarPlugin({
|
|
|
8641
8602
|
/* @__PURE__ */ jsxs110("div", {
|
|
8642
8603
|
className: "c-rte-toolbar__inner",
|
|
8643
8604
|
children: [
|
|
8644
|
-
/* @__PURE__ */
|
|
8605
|
+
/* @__PURE__ */ jsx133(IconButton, {
|
|
8645
8606
|
disabled: !canUndo || !isEditable,
|
|
8646
8607
|
onClick: () => {
|
|
8647
8608
|
activeEditor.dispatchCommand(UNDO_COMMAND, void 0);
|
|
@@ -8649,12 +8610,13 @@ function ToolbarPlugin({
|
|
|
8649
8610
|
type: "button",
|
|
8650
8611
|
title: tr(IS_APPLE ? "actionUndoTitleApple" : "actionUndoTitle"),
|
|
8651
8612
|
"aria-label": tr("actionUndoLabel"),
|
|
8652
|
-
|
|
8613
|
+
"data-testid": "rich-text-undo-button",
|
|
8614
|
+
children: /* @__PURE__ */ jsx133("i", {
|
|
8653
8615
|
className: `c-rte-icon-undo c-rte-toolbar__icon ${!canUndo ? "disabled" : ""}
|
|
8654
8616
|
`
|
|
8655
8617
|
})
|
|
8656
8618
|
}),
|
|
8657
|
-
/* @__PURE__ */
|
|
8619
|
+
/* @__PURE__ */ jsx133(IconButton, {
|
|
8658
8620
|
disabled: !canRedo || !isEditable,
|
|
8659
8621
|
onClick: () => {
|
|
8660
8622
|
activeEditor.dispatchCommand(REDO_COMMAND, void 0);
|
|
@@ -8662,51 +8624,51 @@ function ToolbarPlugin({
|
|
|
8662
8624
|
type: "button",
|
|
8663
8625
|
title: tr(IS_APPLE ? "actionRedoTitleApple" : "actionRedoTitle"),
|
|
8664
8626
|
"aria-label": tr("actionRedoLabel"),
|
|
8665
|
-
children: /* @__PURE__ */
|
|
8627
|
+
children: /* @__PURE__ */ jsx133("i", {
|
|
8666
8628
|
className: `c-rte-icon-redo c-rte-toolbar__icon ${!canRedo ? "disabled" : ""}`
|
|
8667
8629
|
})
|
|
8668
8630
|
}),
|
|
8669
|
-
/* @__PURE__ */
|
|
8631
|
+
/* @__PURE__ */ jsx133(Divider, {}),
|
|
8670
8632
|
blockType in blockTypeToBlockName && activeEditor === editor && /* @__PURE__ */ jsxs110(Fragment6, {
|
|
8671
8633
|
children: [
|
|
8672
|
-
/* @__PURE__ */
|
|
8634
|
+
/* @__PURE__ */ jsx133(BlockFormatDropDown, {
|
|
8673
8635
|
disabled: !isEditable,
|
|
8674
8636
|
blockType,
|
|
8675
8637
|
editor
|
|
8676
8638
|
}),
|
|
8677
|
-
/* @__PURE__ */
|
|
8639
|
+
/* @__PURE__ */ jsx133(Divider, {})
|
|
8678
8640
|
]
|
|
8679
8641
|
}),
|
|
8680
|
-
blockType === "code" ? /* @__PURE__ */
|
|
8681
|
-
children: /* @__PURE__ */
|
|
8642
|
+
blockType === "code" ? /* @__PURE__ */ jsx133(Fragment6, {
|
|
8643
|
+
children: /* @__PURE__ */ jsx133(DropdownMenu.Root, {
|
|
8682
8644
|
disabled: !isEditable,
|
|
8683
8645
|
style: { zIndex: 1 },
|
|
8684
|
-
content: /* @__PURE__ */
|
|
8646
|
+
content: /* @__PURE__ */ jsx133(Fragment6, {
|
|
8685
8647
|
children: CODE_LANGUAGE_OPTIONS.map(([value, name]) => {
|
|
8686
|
-
return /* @__PURE__ */
|
|
8648
|
+
return /* @__PURE__ */ jsx133(DropdownMenu.Item, {
|
|
8687
8649
|
className: `item ${dropDownActiveClass(value === codeLanguage)}`,
|
|
8688
8650
|
onClick: () => onCodeLanguageSelect(value),
|
|
8689
|
-
children: /* @__PURE__ */
|
|
8651
|
+
children: /* @__PURE__ */ jsx133("span", {
|
|
8690
8652
|
className: `c-rte-toolbar__code-lang__sel-item ${dropDownActiveClass(value === codeLanguage) ? "selected" : ""}`,
|
|
8691
8653
|
children: name
|
|
8692
8654
|
})
|
|
8693
8655
|
}, value);
|
|
8694
8656
|
})
|
|
8695
8657
|
}),
|
|
8696
|
-
children: /* @__PURE__ */
|
|
8658
|
+
children: /* @__PURE__ */ jsx133(Button, {
|
|
8697
8659
|
"aria-label": tr("codeSelectLanguage"),
|
|
8698
|
-
append: /* @__PURE__ */
|
|
8699
|
-
children: /* @__PURE__ */
|
|
8660
|
+
append: /* @__PURE__ */ jsx133(Icon.Arrow, {}),
|
|
8661
|
+
children: /* @__PURE__ */ jsx133("span", {
|
|
8700
8662
|
className: "c-rte-toolbar__code-lang__button-text",
|
|
8701
8663
|
children: getLanguageFriendlyName2(codeLanguage)
|
|
8702
8664
|
})
|
|
8703
8665
|
})
|
|
8704
8666
|
})
|
|
8705
|
-
}) : /* @__PURE__ */
|
|
8667
|
+
}) : /* @__PURE__ */ jsx133(Dialog, {
|
|
8706
8668
|
children: /* @__PURE__ */ jsxs110("div", {
|
|
8707
8669
|
className: "c-rte-toolbar__actions-rest",
|
|
8708
8670
|
children: [
|
|
8709
|
-
/* @__PURE__ */
|
|
8671
|
+
/* @__PURE__ */ jsx133(IconButton, {
|
|
8710
8672
|
disabled: !isEditable,
|
|
8711
8673
|
className: `c-rte-toolbar__icon-btn ${isBold ? "selected" : ""}`,
|
|
8712
8674
|
type: "button",
|
|
@@ -8716,11 +8678,11 @@ function ToolbarPlugin({
|
|
|
8716
8678
|
onClick: () => {
|
|
8717
8679
|
activeEditor.dispatchCommand(FORMAT_TEXT_COMMAND2, "bold");
|
|
8718
8680
|
},
|
|
8719
|
-
children: /* @__PURE__ */
|
|
8681
|
+
children: /* @__PURE__ */ jsx133("i", {
|
|
8720
8682
|
className: `c-rte-toolbar__icon-btn__icon c-rte-icon-bold`
|
|
8721
8683
|
})
|
|
8722
8684
|
}),
|
|
8723
|
-
/* @__PURE__ */
|
|
8685
|
+
/* @__PURE__ */ jsx133(IconButton, {
|
|
8724
8686
|
className: `c-rte-toolbar__icon-btn ${isItalic ? "selected" : ""}`,
|
|
8725
8687
|
disabled: !isEditable,
|
|
8726
8688
|
onClick: () => {
|
|
@@ -8730,11 +8692,11 @@ function ToolbarPlugin({
|
|
|
8730
8692
|
title: tr(IS_APPLE ? "actionFormatAsEmphasizedTitleApple" : "actionFormatAsEmphasizedTitle"),
|
|
8731
8693
|
"aria-label": tr("actionFormatAsEmphasizedLabel"),
|
|
8732
8694
|
"data-testid": "toggle-format-emphasized",
|
|
8733
|
-
children: /* @__PURE__ */
|
|
8695
|
+
children: /* @__PURE__ */ jsx133("i", {
|
|
8734
8696
|
className: `c-rte-toolbar__icon-btn__icon c-rte-icon-italic`
|
|
8735
8697
|
})
|
|
8736
8698
|
}),
|
|
8737
|
-
/* @__PURE__ */
|
|
8699
|
+
/* @__PURE__ */ jsx133(IconButton, {
|
|
8738
8700
|
className: `c-rte-toolbar__icon-btn ${isUnderline ? "selected" : ""}`,
|
|
8739
8701
|
disabled: !isEditable,
|
|
8740
8702
|
onClick: () => {
|
|
@@ -8744,11 +8706,11 @@ function ToolbarPlugin({
|
|
|
8744
8706
|
title: tr(IS_APPLE ? "actionFormatAsUnderlinedTitleApple" : "actionFormatAsUnderlinedTitle"),
|
|
8745
8707
|
"aria-label": tr("actionFormatAsUnderlinedLabel"),
|
|
8746
8708
|
"data-testid": "toggle-format-underlined",
|
|
8747
|
-
children: /* @__PURE__ */
|
|
8709
|
+
children: /* @__PURE__ */ jsx133("i", {
|
|
8748
8710
|
className: `c-rte-toolbar__icon-btn__icon c-rte-icon-underline`
|
|
8749
8711
|
})
|
|
8750
8712
|
}),
|
|
8751
|
-
/* @__PURE__ */
|
|
8713
|
+
/* @__PURE__ */ jsx133(IconButton, {
|
|
8752
8714
|
className: `c-rte-toolbar__icon-btn ${isCode ? "selected" : ""}`,
|
|
8753
8715
|
disabled: !isEditable,
|
|
8754
8716
|
onClick: () => {
|
|
@@ -8757,86 +8719,85 @@ function ToolbarPlugin({
|
|
|
8757
8719
|
type: "button",
|
|
8758
8720
|
title: tr("actionInsertCodeBlock"),
|
|
8759
8721
|
"aria-label": tr("actionInsertCodeBlock"),
|
|
8760
|
-
|
|
8722
|
+
"data-testid": "toggle-format-code",
|
|
8723
|
+
children: /* @__PURE__ */ jsx133("i", {
|
|
8761
8724
|
className: `c-rte-toolbar__icon-btn__icon c-rte-icon-code`
|
|
8762
8725
|
})
|
|
8763
8726
|
}),
|
|
8764
|
-
/* @__PURE__ */
|
|
8727
|
+
/* @__PURE__ */ jsx133(IconButton, {
|
|
8765
8728
|
className: `c-rte-toolbar__icon-btn ${isLink ? "selected" : ""}`,
|
|
8766
8729
|
disabled: !isEditable,
|
|
8767
8730
|
onClick: insertLink,
|
|
8768
8731
|
type: "button",
|
|
8769
8732
|
"aria-label": tr("actionInsertlink"),
|
|
8770
8733
|
title: tr("actionInsertlink"),
|
|
8771
|
-
children: /* @__PURE__ */
|
|
8734
|
+
children: /* @__PURE__ */ jsx133("i", {
|
|
8772
8735
|
className: `c-rte-toolbar__icon-btn__icon c-rte-icon-link`
|
|
8773
8736
|
})
|
|
8774
8737
|
}),
|
|
8775
|
-
/* @__PURE__ */
|
|
8738
|
+
/* @__PURE__ */ jsx133(DropdownMenu.Root, {
|
|
8776
8739
|
disabled: !isEditable,
|
|
8777
8740
|
style: { zIndex: 1 },
|
|
8778
8741
|
content: /* @__PURE__ */ jsxs110(Fragment6, {
|
|
8779
8742
|
children: [
|
|
8780
8743
|
/* @__PURE__ */ jsxs110(DropdownMenu.Item, {
|
|
8781
|
-
|
|
8782
|
-
|
|
8783
|
-
},
|
|
8744
|
+
disabled: !isEditable,
|
|
8745
|
+
onClick: () => activeEditor.dispatchCommand(FORMAT_TEXT_COMMAND2, "strikethrough"),
|
|
8784
8746
|
title: tr("actionFormatWithStrikethroughTitle"),
|
|
8785
8747
|
"aria-label": tr("actionFormatWithStrikethroughLabel"),
|
|
8786
8748
|
children: [
|
|
8787
|
-
/* @__PURE__ */
|
|
8749
|
+
/* @__PURE__ */ jsx133("i", {
|
|
8788
8750
|
className: `c-rte-icon-strikethrough c-rte-toolbar__dd-item__icon ${isStrikethrough ? "selected" : ""}`
|
|
8789
8751
|
}),
|
|
8790
|
-
/* @__PURE__ */
|
|
8752
|
+
/* @__PURE__ */ jsx133("span", {
|
|
8791
8753
|
className: `c-rte-toolbar__dd-item__text ${isStrikethrough ? "selected" : ""}`,
|
|
8792
|
-
children: tr("
|
|
8754
|
+
children: tr("actionFormatWithStrikethroughTitle")
|
|
8793
8755
|
})
|
|
8794
8756
|
]
|
|
8795
8757
|
}),
|
|
8796
8758
|
/* @__PURE__ */ jsxs110(DropdownMenu.Item, {
|
|
8797
|
-
|
|
8798
|
-
|
|
8799
|
-
},
|
|
8759
|
+
disabled: !isEditable,
|
|
8760
|
+
onClick: () => activeEditor.dispatchCommand(FORMAT_TEXT_COMMAND2, "subscript"),
|
|
8800
8761
|
title: tr("actionFormatWithSubscriptTitle"),
|
|
8801
8762
|
"aria-label": tr("actionFormatWithSubscriptLabel"),
|
|
8802
8763
|
children: [
|
|
8803
|
-
/* @__PURE__ */
|
|
8764
|
+
/* @__PURE__ */ jsx133("i", {
|
|
8804
8765
|
className: `c-rte-icon-subscript c-rte-toolbar__dd-item__icon ${isSubscript ? "selected" : ""}`
|
|
8805
8766
|
}),
|
|
8806
|
-
/* @__PURE__ */
|
|
8767
|
+
/* @__PURE__ */ jsx133("span", {
|
|
8807
8768
|
className: `c-rte-toolbar__dd-item__text ${isSubscript ? "selected" : ""}`,
|
|
8808
8769
|
children: tr("actionFormatWithSubscriptTitle")
|
|
8809
8770
|
})
|
|
8810
8771
|
]
|
|
8811
8772
|
}),
|
|
8812
8773
|
/* @__PURE__ */ jsxs110(DropdownMenu.Item, {
|
|
8813
|
-
|
|
8814
|
-
|
|
8815
|
-
},
|
|
8774
|
+
disabled: !isEditable,
|
|
8775
|
+
onClick: () => activeEditor.dispatchCommand(FORMAT_TEXT_COMMAND2, "superscript"),
|
|
8816
8776
|
title: tr("actionFormatWithSuperscriptTitle"),
|
|
8817
8777
|
"aria-label": tr("actionFormatWithSuperscriptLabel"),
|
|
8818
8778
|
children: [
|
|
8819
|
-
/* @__PURE__ */
|
|
8779
|
+
/* @__PURE__ */ jsx133("i", {
|
|
8820
8780
|
className: `c-rte-icon-superscript c-rte-toolbar__dd-item__icon ${isSuperscript ? "selected" : ""}`
|
|
8821
8781
|
}),
|
|
8822
|
-
/* @__PURE__ */
|
|
8782
|
+
/* @__PURE__ */ jsx133("span", {
|
|
8823
8783
|
className: `c-rte-toolbar__dd-item__text ${isSuperscript ? "selected" : ""}`,
|
|
8824
8784
|
children: tr("actionFormatWithSuperscriptTitle")
|
|
8825
8785
|
})
|
|
8826
8786
|
]
|
|
8827
8787
|
}),
|
|
8828
8788
|
/* @__PURE__ */ jsxs110(DropdownMenu.Item, {
|
|
8789
|
+
disabled: !isEditable,
|
|
8829
8790
|
onClick: clearFormatting,
|
|
8830
8791
|
className: "item",
|
|
8831
8792
|
title: tr("actionClearTextFormatting"),
|
|
8832
8793
|
"aria-label": tr("actionClearTextFormatting"),
|
|
8833
8794
|
children: [
|
|
8834
|
-
/* @__PURE__ */
|
|
8795
|
+
/* @__PURE__ */ jsx133("i", {
|
|
8835
8796
|
className: "c-rte-icon-clear c-rte-toolbar__dd-item__icon"
|
|
8836
8797
|
}),
|
|
8837
|
-
/* @__PURE__ */
|
|
8798
|
+
/* @__PURE__ */ jsx133("span", {
|
|
8838
8799
|
className: "c-rte-toolbar__dd-item__text--clear",
|
|
8839
|
-
children: "
|
|
8800
|
+
children: tr("actionFormatClear")
|
|
8840
8801
|
})
|
|
8841
8802
|
]
|
|
8842
8803
|
})
|
|
@@ -8846,15 +8807,15 @@ function ToolbarPlugin({
|
|
|
8846
8807
|
style: { backgroundColor: "transparent", padding: "0 8px" },
|
|
8847
8808
|
"aria-label": tr("actionTextFormattingOptions"),
|
|
8848
8809
|
children: [
|
|
8849
|
-
/* @__PURE__ */
|
|
8810
|
+
/* @__PURE__ */ jsx133("i", {
|
|
8850
8811
|
className: `c-rte-icon-dropdown-more c-rte-toolbar__toggle-icon`
|
|
8851
8812
|
}),
|
|
8852
|
-
/* @__PURE__ */
|
|
8813
|
+
/* @__PURE__ */ jsx133(Icon.Arrow, {})
|
|
8853
8814
|
]
|
|
8854
8815
|
})
|
|
8855
8816
|
}),
|
|
8856
|
-
/* @__PURE__ */
|
|
8857
|
-
/* @__PURE__ */
|
|
8817
|
+
/* @__PURE__ */ jsx133(Divider, {}),
|
|
8818
|
+
/* @__PURE__ */ jsx133(DropdownMenu.Root, {
|
|
8858
8819
|
style: { zIndex: 1 },
|
|
8859
8820
|
disabled: !isEditable,
|
|
8860
8821
|
content: /* @__PURE__ */ jsxs110(Fragment6, {
|
|
@@ -8864,25 +8825,25 @@ function ToolbarPlugin({
|
|
|
8864
8825
|
activeEditor.dispatchCommand(INSERT_HORIZONTAL_RULE_COMMAND, void 0);
|
|
8865
8826
|
},
|
|
8866
8827
|
children: [
|
|
8867
|
-
/* @__PURE__ */
|
|
8828
|
+
/* @__PURE__ */ jsx133("i", {
|
|
8868
8829
|
className: "c-rte-toolbar__dd-item__icon c-rte-icon-horizontal-rule"
|
|
8869
8830
|
}),
|
|
8870
|
-
/* @__PURE__ */
|
|
8831
|
+
/* @__PURE__ */ jsx133("span", {
|
|
8871
8832
|
className: "c-rte-toolbar__dd-item__text",
|
|
8872
8833
|
children: tr("horizontalRule")
|
|
8873
8834
|
})
|
|
8874
8835
|
]
|
|
8875
8836
|
}),
|
|
8876
|
-
/* @__PURE__ */
|
|
8877
|
-
children: /* @__PURE__ */
|
|
8837
|
+
/* @__PURE__ */ jsx133(DropdownMenu.Item, {
|
|
8838
|
+
children: /* @__PURE__ */ jsx133(Dialog.Trigger, {
|
|
8878
8839
|
asChild: true,
|
|
8879
8840
|
children: /* @__PURE__ */ jsxs110("div", {
|
|
8880
8841
|
className: "c-rte-toolbar__dd-item--table",
|
|
8881
8842
|
children: [
|
|
8882
|
-
/* @__PURE__ */
|
|
8843
|
+
/* @__PURE__ */ jsx133("i", {
|
|
8883
8844
|
className: "c-rte-toolbar__dd-item__icon c-rte-icon-table"
|
|
8884
8845
|
}),
|
|
8885
|
-
/* @__PURE__ */
|
|
8846
|
+
/* @__PURE__ */ jsx133("span", {
|
|
8886
8847
|
className: "c-rte-toolbar__dd-item__text",
|
|
8887
8848
|
children: tr("table")
|
|
8888
8849
|
})
|
|
@@ -8892,21 +8853,21 @@ function ToolbarPlugin({
|
|
|
8892
8853
|
})
|
|
8893
8854
|
]
|
|
8894
8855
|
}),
|
|
8895
|
-
children: /* @__PURE__ */
|
|
8896
|
-
children: /* @__PURE__ */
|
|
8856
|
+
children: /* @__PURE__ */ jsx133(IconButton, {
|
|
8857
|
+
children: /* @__PURE__ */ jsx133("i", {
|
|
8897
8858
|
className: "c-rte-icon-plus c-rte-toolbar__plus"
|
|
8898
8859
|
})
|
|
8899
8860
|
})
|
|
8900
8861
|
}),
|
|
8901
8862
|
/* @__PURE__ */ jsxs110(Dialog.Content, {
|
|
8902
8863
|
children: [
|
|
8903
|
-
/* @__PURE__ */
|
|
8864
|
+
/* @__PURE__ */ jsx133(Dialog.Title, {
|
|
8904
8865
|
children: tr("insertTableTitle")
|
|
8905
8866
|
}),
|
|
8906
|
-
/* @__PURE__ */
|
|
8867
|
+
/* @__PURE__ */ jsx133(Dialog.Description, {
|
|
8907
8868
|
children: tr("insertTableDescription")
|
|
8908
8869
|
}),
|
|
8909
|
-
/* @__PURE__ */
|
|
8870
|
+
/* @__PURE__ */ jsx133(InsertTableDialog, {
|
|
8910
8871
|
activeEditor
|
|
8911
8872
|
})
|
|
8912
8873
|
]
|
|
@@ -8916,7 +8877,7 @@ function ToolbarPlugin({
|
|
|
8916
8877
|
})
|
|
8917
8878
|
]
|
|
8918
8879
|
}),
|
|
8919
|
-
/* @__PURE__ */
|
|
8880
|
+
/* @__PURE__ */ jsx133(ActionsPlugin, {
|
|
8920
8881
|
prepend: actionsMenuPrepend,
|
|
8921
8882
|
append: actionsMenuAppend
|
|
8922
8883
|
})
|
|
@@ -9027,33 +8988,31 @@ var theme = {
|
|
|
9027
8988
|
var CrystallizeRTEditorTheme_default = theme;
|
|
9028
8989
|
|
|
9029
8990
|
// src/rich-text-editor/rich-text-editor.tsx
|
|
9030
|
-
import { Fragment as Fragment7, jsx as
|
|
8991
|
+
import { Fragment as Fragment7, jsx as jsx134, jsxs as jsxs111 } from "react/jsx-runtime";
|
|
9031
8992
|
function RichTextEditor({
|
|
9032
8993
|
initialData,
|
|
9033
8994
|
language = "en",
|
|
9034
8995
|
labelTranslations,
|
|
9035
8996
|
...rest
|
|
9036
8997
|
}) {
|
|
9037
|
-
return /* @__PURE__ */
|
|
8998
|
+
return /* @__PURE__ */ jsx134(LexicalComposer, {
|
|
9038
8999
|
initialConfig: {
|
|
9039
9000
|
editable: !rest.disabled,
|
|
9040
9001
|
namespace: "crystallize-rich-text-editor",
|
|
9041
9002
|
nodes: [...BaseNodes],
|
|
9003
|
+
theme: CrystallizeRTEditorTheme_default,
|
|
9004
|
+
editorState: initialData ? composeInitialState({ richText: initialData }) : void 0,
|
|
9042
9005
|
onError: (error) => {
|
|
9043
9006
|
throw error;
|
|
9044
|
-
}
|
|
9045
|
-
theme: CrystallizeRTEditorTheme_default,
|
|
9046
|
-
editorState: initialData ? composeInitialState({
|
|
9047
|
-
richText: initialData
|
|
9048
|
-
}) : void 0
|
|
9007
|
+
}
|
|
9049
9008
|
},
|
|
9050
|
-
children: /* @__PURE__ */
|
|
9009
|
+
children: /* @__PURE__ */ jsx134(I18nProvider, {
|
|
9051
9010
|
language,
|
|
9052
9011
|
labelTranslations,
|
|
9053
|
-
children: /* @__PURE__ */
|
|
9054
|
-
children: /* @__PURE__ */
|
|
9012
|
+
children: /* @__PURE__ */ jsx134(SharedHistoryContext, {
|
|
9013
|
+
children: /* @__PURE__ */ jsx134("div", {
|
|
9055
9014
|
className: "c-rich-text-editor",
|
|
9056
|
-
children: /* @__PURE__ */
|
|
9015
|
+
children: /* @__PURE__ */ jsx134(RichTextEditorWithoutContext, {
|
|
9057
9016
|
...rest
|
|
9058
9017
|
})
|
|
9059
9018
|
})
|
|
@@ -9075,20 +9034,19 @@ function RichTextEditorWithoutContext({
|
|
|
9075
9034
|
}) {
|
|
9076
9035
|
const editable = !disabled;
|
|
9077
9036
|
const { historyState } = useSharedHistoryContext();
|
|
9078
|
-
const placeholder = /* @__PURE__ */
|
|
9037
|
+
const placeholder = /* @__PURE__ */ jsx134("div", {
|
|
9079
9038
|
className: "c-rte-placeholder",
|
|
9080
9039
|
children: placeholderText ?? ""
|
|
9081
9040
|
});
|
|
9082
9041
|
const [editor] = useLexicalComposerContext12();
|
|
9083
|
-
const [floatingAnchorElem, setFloatingAnchorElem] =
|
|
9084
|
-
const
|
|
9085
|
-
const firstOnChangeTriggeredRef = useRef7(!autoFocus);
|
|
9042
|
+
const [floatingAnchorElem, setFloatingAnchorElem] = useState10(null);
|
|
9043
|
+
const firstOnChangeTriggeredRef = useRef5(!autoFocus);
|
|
9086
9044
|
const onRef = (_floatingAnchorElem) => {
|
|
9087
9045
|
if (_floatingAnchorElem !== null) {
|
|
9088
9046
|
setFloatingAnchorElem(_floatingAnchorElem);
|
|
9089
9047
|
}
|
|
9090
9048
|
};
|
|
9091
|
-
|
|
9049
|
+
useEffect11(() => {
|
|
9092
9050
|
editor.setEditable(editable || false);
|
|
9093
9051
|
}, [editable, editor]);
|
|
9094
9052
|
function onLocalChange(editorState) {
|
|
@@ -9101,14 +9059,11 @@ function RichTextEditorWithoutContext({
|
|
|
9101
9059
|
}
|
|
9102
9060
|
return /* @__PURE__ */ jsxs111(Fragment7, {
|
|
9103
9061
|
children: [
|
|
9104
|
-
/* @__PURE__ */
|
|
9062
|
+
/* @__PURE__ */ jsx134(OnChangePlugin, {
|
|
9105
9063
|
onChange: onLocalChange,
|
|
9106
9064
|
ignoreSelectionChange: true
|
|
9107
9065
|
}),
|
|
9108
|
-
/* @__PURE__ */
|
|
9109
|
-
onChange: (d) => setIsSmallWidthViewport(d.isSmallWidth)
|
|
9110
|
-
}),
|
|
9111
|
-
isSmallWidthViewport ? null : /* @__PURE__ */ jsx135(ToolbarPlugin, {
|
|
9066
|
+
/* @__PURE__ */ jsx134(ToolbarPlugin, {
|
|
9112
9067
|
actionsMenuPrepend,
|
|
9113
9068
|
actionsMenuAppend
|
|
9114
9069
|
}),
|
|
@@ -9116,22 +9071,22 @@ function RichTextEditorWithoutContext({
|
|
|
9116
9071
|
/* @__PURE__ */ jsxs111("div", {
|
|
9117
9072
|
className: `c-rte-editor-container ${disabled ? "disabled" : ""}`,
|
|
9118
9073
|
children: [
|
|
9119
|
-
maxLength != null ? /* @__PURE__ */
|
|
9074
|
+
maxLength != null ? /* @__PURE__ */ jsx134(MaxLengthPlugin, {
|
|
9120
9075
|
maxLength
|
|
9121
9076
|
}) : null,
|
|
9122
|
-
!autoFocus ? null : /* @__PURE__ */
|
|
9123
|
-
/* @__PURE__ */
|
|
9124
|
-
/* @__PURE__ */
|
|
9125
|
-
/* @__PURE__ */
|
|
9077
|
+
!autoFocus ? null : /* @__PURE__ */ jsx134(AutoFocusPlugin, {}),
|
|
9078
|
+
/* @__PURE__ */ jsx134(ClearEditorPlugin, {}),
|
|
9079
|
+
/* @__PURE__ */ jsx134(LexicalAutoLinkPlugin, {}),
|
|
9080
|
+
/* @__PURE__ */ jsx134(HistoryPlugin, {
|
|
9126
9081
|
externalHistoryState: historyState
|
|
9127
9082
|
}),
|
|
9128
|
-
/* @__PURE__ */
|
|
9129
|
-
contentEditable: /* @__PURE__ */
|
|
9083
|
+
/* @__PURE__ */ jsx134(RichTextPlugin, {
|
|
9084
|
+
contentEditable: /* @__PURE__ */ jsx134("div", {
|
|
9130
9085
|
className: "c-rte-editor-scroller",
|
|
9131
|
-
children: /* @__PURE__ */
|
|
9086
|
+
children: /* @__PURE__ */ jsx134("div", {
|
|
9132
9087
|
className: "c-rte-editor",
|
|
9133
9088
|
ref: onRef,
|
|
9134
|
-
children: /* @__PURE__ */
|
|
9089
|
+
children: /* @__PURE__ */ jsx134(ContentEditable, {
|
|
9135
9090
|
className: "c-rte-contenteditable-root",
|
|
9136
9091
|
id
|
|
9137
9092
|
})
|
|
@@ -9140,28 +9095,28 @@ function RichTextEditorWithoutContext({
|
|
|
9140
9095
|
placeholder,
|
|
9141
9096
|
ErrorBoundary: LexicalErrorBoundary
|
|
9142
9097
|
}),
|
|
9143
|
-
/* @__PURE__ */
|
|
9144
|
-
/* @__PURE__ */
|
|
9145
|
-
/* @__PURE__ */
|
|
9098
|
+
/* @__PURE__ */ jsx134(CodeHighlightPlugin, {}),
|
|
9099
|
+
/* @__PURE__ */ jsx134(ListPlugin, {}),
|
|
9100
|
+
/* @__PURE__ */ jsx134(ListMaxIndentLevelPlugin, {
|
|
9146
9101
|
maxDepth: 7
|
|
9147
9102
|
}),
|
|
9148
|
-
/* @__PURE__ */
|
|
9149
|
-
/* @__PURE__ */
|
|
9150
|
-
/* @__PURE__ */
|
|
9151
|
-
/* @__PURE__ */
|
|
9152
|
-
/* @__PURE__ */
|
|
9153
|
-
floatingAnchorElem &&
|
|
9103
|
+
/* @__PURE__ */ jsx134(TablePlugin, {}),
|
|
9104
|
+
/* @__PURE__ */ jsx134(LinkPlugin, {}),
|
|
9105
|
+
/* @__PURE__ */ jsx134(HorizontalRulePlugin, {}),
|
|
9106
|
+
/* @__PURE__ */ jsx134(TabFocusPlugin, {}),
|
|
9107
|
+
/* @__PURE__ */ jsx134(TabIndentationPlugin, {}),
|
|
9108
|
+
floatingAnchorElem && /* @__PURE__ */ jsxs111(Fragment7, {
|
|
9154
9109
|
children: [
|
|
9155
|
-
/* @__PURE__ */
|
|
9110
|
+
/* @__PURE__ */ jsx134(CodeActionMenuPlugin, {
|
|
9156
9111
|
anchorElem: floatingAnchorElem
|
|
9157
9112
|
}),
|
|
9158
|
-
/* @__PURE__ */
|
|
9113
|
+
/* @__PURE__ */ jsx134(FloatingLinkEditorPlugin, {
|
|
9159
9114
|
anchorElem: floatingAnchorElem
|
|
9160
9115
|
}),
|
|
9161
|
-
/* @__PURE__ */
|
|
9116
|
+
/* @__PURE__ */ jsx134(TableActionMenuPlugin, {
|
|
9162
9117
|
anchorElem: floatingAnchorElem
|
|
9163
9118
|
}),
|
|
9164
|
-
/* @__PURE__ */
|
|
9119
|
+
/* @__PURE__ */ jsx134(FloatingTextFormatToolbarPlugin, {
|
|
9165
9120
|
anchorElem: floatingAnchorElem
|
|
9166
9121
|
})
|
|
9167
9122
|
]
|
|
@@ -9174,12 +9129,12 @@ function RichTextEditorWithoutContext({
|
|
|
9174
9129
|
|
|
9175
9130
|
// src/switch/switch.tsx
|
|
9176
9131
|
import * as RadixSwitch from "@radix-ui/react-switch";
|
|
9177
|
-
import { jsx as
|
|
9132
|
+
import { jsx as jsx135 } from "react/jsx-runtime";
|
|
9178
9133
|
function Switch2(props) {
|
|
9179
|
-
return /* @__PURE__ */
|
|
9134
|
+
return /* @__PURE__ */ jsx135(RadixSwitch.Root, {
|
|
9180
9135
|
...props,
|
|
9181
9136
|
className: "c-switch-root",
|
|
9182
|
-
children: /* @__PURE__ */
|
|
9137
|
+
children: /* @__PURE__ */ jsx135(RadixSwitch.Thumb, {
|
|
9183
9138
|
className: "c-switch-thumb"
|
|
9184
9139
|
})
|
|
9185
9140
|
});
|