@crystallize/design-system 1.17.0 → 1.17.2

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