@crystallize/design-system 1.10.0 → 1.11.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.
Files changed (27) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/index.css +15 -17
  3. package/dist/index.d.ts +8 -1
  4. package/dist/index.js +522 -444
  5. package/dist/index.mjs +377 -304
  6. package/package.json +1 -1
  7. package/src/iconography/info.tsx +2 -2
  8. package/src/rich-text-editor/i18n/i18n.test.ts +14 -0
  9. package/src/rich-text-editor/i18n/index.tsx +65 -0
  10. package/src/rich-text-editor/i18n/translations/en.ts +66 -0
  11. package/src/rich-text-editor/i18n/types.ts +62 -0
  12. package/src/rich-text-editor/plugins/ActionsPlugin/index.tsx +5 -22
  13. package/src/rich-text-editor/plugins/CodeActionMenuPlugin/components/CopyButton/index.tsx +4 -1
  14. package/src/rich-text-editor/plugins/CodeActionMenuPlugin/components/PrettierButton/index.tsx +11 -1
  15. package/src/rich-text-editor/plugins/CodeActionMenuPlugin/index.tsx +2 -1
  16. package/src/rich-text-editor/plugins/FloatingLinkEditorPlugin/index.tsx +23 -5
  17. package/src/rich-text-editor/plugins/FloatingTextFormatToolbarPlugin/index.tsx +21 -10
  18. package/src/rich-text-editor/plugins/TabFocusPlugin/index.tsx +4 -12
  19. package/src/rich-text-editor/plugins/TableActionMenuPlugin/index.tsx +23 -14
  20. package/src/rich-text-editor/plugins/ToolbarPlugin/index.tsx +33 -33
  21. package/src/rich-text-editor/plugins/ToolbarPlugin/insert-table.tsx +6 -4
  22. package/src/rich-text-editor/rich-text-editor.css +6 -0
  23. package/src/rich-text-editor/rich-text-editor.stories.tsx +10 -0
  24. package/src/rich-text-editor/rich-text-editor.tsx +15 -9
  25. package/src/rich-text-editor/ui/LinkPreview.tsx +3 -1
  26. package/src/rich-text-editor/ui/ContentEditable.css +0 -13
  27. package/src/rich-text-editor/ui/ContentEditable.tsx +0 -15
package/dist/index.js CHANGED
@@ -1563,7 +1563,7 @@ var Info = (0, import_react28.forwardRef)((delegated, ref) => {
1563
1563
  }),
1564
1564
  /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("path", {
1565
1565
  fillRule: "evenodd",
1566
- "clip-rule": "evenodd",
1566
+ clipRule: "evenodd",
1567
1567
  d: "M18.253 3.85212C18.253 5.04383 17.2869 6.00991 16.0952 6.00991C14.9035 6.00991 13.9374 5.04383 13.9374 3.85212C13.9374 2.66041 14.9035 1.69434 16.0952 1.69434C17.2869 1.69434 18.253 2.66041 18.253 3.85212ZM16.0952 5.34999C16.9224 5.34999 17.5931 4.67937 17.5931 3.85212C17.5931 3.02487 16.9224 2.35425 16.0952 2.35425C15.2679 2.35425 14.5973 3.02487 14.5973 3.85212C14.5973 4.67937 15.2679 5.34999 16.0952 5.34999Z",
1568
1568
  fill: "#528693"
1569
1569
  }),
@@ -1573,7 +1573,7 @@ var Info = (0, import_react28.forwardRef)((delegated, ref) => {
1573
1573
  }),
1574
1574
  /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("path", {
1575
1575
  fillRule: "evenodd",
1576
- "clip-rule": "evenodd",
1576
+ clipRule: "evenodd",
1577
1577
  d: "M11.2842 18.976L11.3049 18.9785C11.5112 19.0031 11.7201 18.9658 11.9049 18.8714C12.0891 18.7772 12.2409 18.6306 12.3411 18.4504C12.3471 18.4394 12.352 18.4277 12.3558 18.4158C12.3317 18.4124 12.3048 18.4091 12.2731 18.4053C12.0384 18.3881 11.8084 18.33 11.5936 18.2335C11.2334 18.0797 10.9456 17.7933 10.7906 17.433C10.6341 17.0694 10.6252 16.6594 10.7658 16.2894C10.9266 15.8663 11.1487 15.4689 11.4246 15.1101L11.6291 14.8181C11.6293 14.8178 11.629 14.8184 11.6291 14.8181C12.0038 14.2802 12.4092 13.763 12.8423 13.2707L12.9418 13.1535C12.9894 13.097 13.0361 13.0418 13.0821 12.9874C13.2314 12.8108 13.3734 12.6428 13.5141 12.4665L13.5237 12.4544L13.5339 12.4428C14.107 11.7899 14.5194 11.0128 14.7386 10.1733C14.8642 9.60674 14.7724 9.1134 14.5125 8.69961C14.2452 8.27422 13.7678 7.88337 13.0466 7.60647L13.0376 7.60304C12.2034 7.26882 11.3198 7.07373 10.4221 7.02572C10.2586 7.02444 10.0952 7.03841 9.93422 7.06745L9.91342 7.0712L9.89242 7.07362C9.77981 7.08656 9.67209 7.12639 9.57839 7.18964C9.48729 7.25113 9.41209 7.33296 9.35867 7.42842C9.35249 7.44171 9.33941 7.47402 9.32659 7.52286C9.31959 7.54951 9.31383 7.57671 9.30949 7.60325C9.36308 7.61115 9.41754 7.61364 9.47206 7.61055L9.51828 7.60793L9.63538 7.61773C9.79024 7.6263 9.94419 7.64682 10.0959 7.67913L10.1211 7.68451L10.1459 7.69185C10.6213 7.83272 11.1176 8.10198 11.3044 8.65041L11.3058 8.6547C11.4603 9.11879 11.309 9.5616 11.1547 9.87197C10.9947 10.194 10.7584 10.5161 10.546 10.7961C10.1932 11.2626 9.79323 11.726 9.4222 12.1559L9.4167 12.1622L9.30686 12.2896L9.29607 12.301C8.50411 13.1358 7.82119 14.0671 7.26353 15.0728C6.95101 15.7053 6.92585 16.2828 7.10297 16.7755C7.28379 17.2785 7.70442 17.772 8.42421 18.1631L8.42623 18.1642C9.29923 18.6426 10.2687 18.9197 11.2633 18.9749L11.2842 18.976ZM6.67909 14.7659C7.26511 13.7065 7.9836 12.7256 8.81732 11.8468L8.91693 11.7313C9.29243 11.2963 9.68044 10.8467 10.0199 10.3976C10.4486 9.83253 10.8215 9.28929 10.6797 8.86312C10.5968 8.6196 10.3605 8.44373 9.9584 8.32457C9.83715 8.29874 9.71404 8.28256 9.59022 8.27617L9.50938 8.26941C9.26232 8.2834 9.01575 8.23452 8.79281 8.12735C8.54248 7.93066 8.64731 7.36817 8.77404 7.12204C8.87835 6.92966 9.02762 6.76522 9.2092 6.64266C9.39077 6.5201 9.59929 6.44304 9.81707 6.41802C10.0235 6.38077 10.2331 6.36335 10.4429 6.36598C11.4176 6.41652 12.3773 6.6275 13.2831 6.9904C14.9259 7.62106 15.7097 8.86885 15.3801 10.3284C15.1357 11.2718 14.6733 12.1451 14.0299 12.8781C13.8828 13.0625 13.7326 13.2401 13.582 13.4182C13.5366 13.4719 13.4912 13.5256 13.4458 13.5795L13.3415 13.7024C12.9232 14.1775 12.5323 14.6759 12.1707 15.1952L11.9564 15.5012C11.7156 15.8119 11.5223 16.1565 11.3827 16.5237C11.303 16.7335 11.308 16.966 11.3968 17.1721C11.4855 17.3783 11.651 17.5421 11.8583 17.6289C12.0086 17.6973 12.1701 17.7377 12.335 17.748C12.5957 17.7793 12.8648 17.8126 12.9712 18.0603C13.0139 18.1752 13.0313 18.298 13.0223 18.4203C13.0133 18.5425 12.9781 18.6615 12.9191 18.769C12.7552 19.0647 12.5066 19.305 12.2052 19.459C11.9037 19.6131 11.563 19.6739 11.2267 19.6338C10.1339 19.5731 9.0685 19.2687 8.1091 18.743C6.45171 17.8422 5.90412 16.3181 6.67909 14.7659Z",
1578
1578
  fill: "#528693"
1579
1579
  })
@@ -3601,7 +3601,7 @@ function Tag({ children, className, variant, ...delegated }) {
3601
3601
  }
3602
3602
 
3603
3603
  // src/rich-text-editor/rich-text-editor.tsx
3604
- var import_react76 = require("react");
3604
+ var import_react77 = require("react");
3605
3605
  var import_LexicalAutoFocusPlugin = require("@lexical/react/LexicalAutoFocusPlugin");
3606
3606
  var import_LexicalClearEditorPlugin = require("@lexical/react/LexicalClearEditorPlugin");
3607
3607
  var import_LexicalComposer = require("@lexical/react/LexicalComposer");
@@ -3614,6 +3614,7 @@ var import_LexicalRichTextPlugin = require("@lexical/react/LexicalRichTextPlugin
3614
3614
  var import_LexicalTabIndentationPlugin = require("@lexical/react/LexicalTabIndentationPlugin");
3615
3615
  var import_LexicalTablePlugin = require("@lexical/react/LexicalTablePlugin");
3616
3616
  var import_LexicalComposerContext12 = require("@lexical/react/LexicalComposerContext");
3617
+ var import_LexicalContentEditable = require("@lexical/react/LexicalContentEditable");
3617
3618
 
3618
3619
  // src/rich-text-editor/context/SharedHistoryContext.tsx
3619
3620
  var import_react62 = require("react");
@@ -3631,6 +3632,105 @@ var useSharedHistoryContext = () => {
3631
3632
  return (0, import_react62.useContext)(Context);
3632
3633
  };
3633
3634
 
3635
+ // src/rich-text-editor/i18n/index.tsx
3636
+ var import_react63 = require("react");
3637
+
3638
+ // src/rich-text-editor/i18n/translations/en.ts
3639
+ var translations = {
3640
+ actionClearTextFormatting: "Clear text formatting",
3641
+ actionTextFormattingOptions: "Formatting options for additional text styles",
3642
+ actionFormatAsStrongLabel: "Format text as bold",
3643
+ actionFormatAsStrongTitle: "Bold (Ctrl+B)",
3644
+ actionFormatAsStrongTitleApple: "Bold (\u2318B)",
3645
+ actionFormatAsEmphasizedLabel: "Format text as italics",
3646
+ actionFormatAsEmphasizedTitle: "Italic (Ctrl+I)",
3647
+ actionFormatAsEmphasizedTitleApple: "Italic (\u2318I)",
3648
+ actionFormatAsUnderlinedLabel: "Underline text",
3649
+ actionFormatAsUnderlinedTitle: "Underlined (Ctrl+U)",
3650
+ actionFormatAsUnderlinedTitleApple: "Underlined (\u2318U)",
3651
+ actionFormatWithStrikethroughLabel: "Format text with a strikethrough",
3652
+ actionFormatWithStrikethroughTitle: "Strikethrough",
3653
+ actionFormatWithSubscriptLabel: "Format text as subscript",
3654
+ actionFormatWithSubscriptTitle: "Subscript",
3655
+ actionFormatWithSuperscriptLabel: "Format text as superscript",
3656
+ actionFormatWithSuperscriptTitle: "Superscript",
3657
+ actionInsertCodeBlock: "Insert code block",
3658
+ actionInsertlink: "Insert link",
3659
+ actionCopyJSON: "Copy JSON",
3660
+ actionCopyCode: "Copy code",
3661
+ actionClear: "Clear editor",
3662
+ actionFormatCode: "Format code with Prettier",
3663
+ actionTableInsertRowsAbove: "Insert row above",
3664
+ actionTableInsertRowsAbove_plural: "Insert {{rows}} rows above",
3665
+ actionTableInsertRowsBelow: "Insert row above",
3666
+ actionTableInsertRowsBelow_plural: "Insert {{rows}} rows above",
3667
+ actionTableInsertColumnsBefore: "Insert column left",
3668
+ actionTableInsertColumnsBefore_plural: "Insert {{columns}} columns left",
3669
+ actionTableInsertColumnsAfter: "Insert column right",
3670
+ actionTableInsertColumnsAfter_plural: "Insert {{columns}} columns right",
3671
+ actionTableAddRowHeader: "Add row header",
3672
+ actionTableRemoveRowHeader: "Remove row header",
3673
+ actionTableAddColumnHeader: "Add column header",
3674
+ actionTableRemoveColumnHeader: "Remove column header",
3675
+ actionTableDeleteColumn: "Delete column",
3676
+ actionTableDeleteRow: "Delete row",
3677
+ actionTableDeleteTable: "Delete table",
3678
+ actionTableOpenOptions: "Open table options",
3679
+ actionUndoLabel: "Undo",
3680
+ actionUndoTitle: "Undo (Ctrl+Z)",
3681
+ actionUndoTitleApple: "Undo (\u2318Z)",
3682
+ actionRedoLabel: "Undo",
3683
+ actionRedoTitle: "Undo (Ctrl+Y)",
3684
+ actionRedoTitleApple: "Redo (\u2318Y)",
3685
+ codeSelectLanguage: "Select language",
3686
+ linkEditorLink: "Link",
3687
+ linkEditorRel: "Rel",
3688
+ linkEditorTarget: "Target",
3689
+ linkEditorCommit: "Done",
3690
+ linkEditorEdit: "Edit",
3691
+ linkPreviewReplaceTextWithTitle: "Replace link text with its title",
3692
+ horizontalRule: "Horizontal rule",
3693
+ table: "Table",
3694
+ insertTableTitle: "Insert table",
3695
+ insertTableDescription: "Define your starting point of a table, you can add and remove columns and rows after creation.",
3696
+ insertTableRows: "Rows",
3697
+ insertTableColumns: "Columns",
3698
+ insertTableCommit: "Insert table"
3699
+ };
3700
+ var en_default = translations;
3701
+
3702
+ // src/rich-text-editor/i18n/index.tsx
3703
+ var import_jsx_runtime77 = require("react/jsx-runtime");
3704
+ var I18nContext = (0, import_react63.createContext)(null);
3705
+ function I18nProvider({
3706
+ labelTranslations,
3707
+ children
3708
+ }) {
3709
+ const translations2 = labelTranslations || en_default;
3710
+ return /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(I18nContext.Provider, {
3711
+ value: translations2,
3712
+ children
3713
+ });
3714
+ }
3715
+ function replaceI18nVariablesInString(str, replaceWith) {
3716
+ return str.replace(/({{[^}]+}})/g, replaceWith);
3717
+ }
3718
+ function useTr() {
3719
+ const context = (0, import_react63.useContext)(I18nContext);
3720
+ return (key, units) => {
3721
+ const thereAreUnits = typeof units === "number";
3722
+ const keyToUse = thereAreUnits && units > 1 ? `${key}_plural` : key;
3723
+ if (context && keyToUse in context) {
3724
+ const tr = context[keyToUse];
3725
+ if (thereAreUnits) {
3726
+ return replaceI18nVariablesInString(tr, units.toString());
3727
+ }
3728
+ return tr;
3729
+ }
3730
+ return "";
3731
+ };
3732
+ }
3733
+
3634
3734
  // src/rich-text-editor/model/crystallize-to-lexical.ts
3635
3735
  var import_lexical = require("lexical");
3636
3736
  var import_code = require("@lexical/code");
@@ -4032,7 +4132,7 @@ var BaseNodes = [
4032
4132
  // src/rich-text-editor/plugins/AutoLinkPlugin/index.tsx
4033
4133
  var import_LexicalAutoLinkPlugin = require("@lexical/react/LexicalAutoLinkPlugin");
4034
4134
  var React = require("react");
4035
- var import_jsx_runtime77 = require("react/jsx-runtime");
4135
+ var import_jsx_runtime78 = require("react/jsx-runtime");
4036
4136
  var URL_MATCHER = /((https?:\/\/(www\.)?)|(www\.))[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)/;
4037
4137
  var EMAIL_MATCHER = /(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))/;
4038
4138
  var MATCHERS = [
@@ -4060,13 +4160,13 @@ var MATCHERS = [
4060
4160
  }
4061
4161
  ];
4062
4162
  function LexicalAutoLinkPlugin() {
4063
- return /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(import_LexicalAutoLinkPlugin.AutoLinkPlugin, {
4163
+ return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(import_LexicalAutoLinkPlugin.AutoLinkPlugin, {
4064
4164
  matchers: MATCHERS
4065
4165
  });
4066
4166
  }
4067
4167
 
4068
4168
  // src/rich-text-editor/plugins/CodeActionMenuPlugin/index.tsx
4069
- var import_react65 = require("react");
4169
+ var import_react66 = require("react");
4070
4170
  var import_lexical6 = require("lexical");
4071
4171
  var import_react_dom2 = require("react-dom");
4072
4172
  var import_use_debounce2 = require("use-debounce");
@@ -4075,13 +4175,14 @@ var import_LexicalComposerContext = require("@lexical/react/LexicalComposerConte
4075
4175
 
4076
4176
  // src/rich-text-editor/plugins/CodeActionMenuPlugin/components/CopyButton/index.tsx
4077
4177
  var React2 = require("react");
4078
- var import_react63 = require("react");
4178
+ var import_react64 = require("react");
4079
4179
  var import_lexical4 = require("lexical");
4080
4180
  var import_use_debounce = require("use-debounce");
4081
4181
  var import_code4 = require("@lexical/code");
4082
- var import_jsx_runtime78 = require("react/jsx-runtime");
4182
+ var import_jsx_runtime79 = require("react/jsx-runtime");
4083
4183
  function CopyButton({ editor, getCodeDOMNode }) {
4084
- const [isCopyCompleted, setCopyCompleted] = (0, import_react63.useState)(false);
4184
+ const [isCopyCompleted, setCopyCompleted] = (0, import_react64.useState)(false);
4185
+ const tr = useTr();
4085
4186
  const removeSuccessIcon = (0, import_use_debounce.useDebouncedCallback)(() => {
4086
4187
  setCopyCompleted(false);
4087
4188
  }, 1e3);
@@ -4107,13 +4208,13 @@ function CopyButton({ editor, getCodeDOMNode }) {
4107
4208
  console.error("Failed to copy: ", err);
4108
4209
  }
4109
4210
  }
4110
- return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("button", {
4211
+ return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("button", {
4111
4212
  className: "menu-item",
4112
4213
  onClick: handleClick,
4113
- "aria-label": "copy",
4114
- children: isCopyCompleted ? /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("i", {
4214
+ "aria-label": tr("actionCopyCode"),
4215
+ children: isCopyCompleted ? /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("i", {
4115
4216
  className: "format success"
4116
- }) : /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("i", {
4217
+ }) : /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("i", {
4117
4218
  className: "format copy"
4118
4219
  })
4119
4220
  });
@@ -4121,10 +4222,10 @@ function CopyButton({ editor, getCodeDOMNode }) {
4121
4222
 
4122
4223
  // src/rich-text-editor/plugins/CodeActionMenuPlugin/components/PrettierButton/index.tsx
4123
4224
  var React3 = require("react");
4124
- var import_react64 = require("react");
4225
+ var import_react65 = require("react");
4125
4226
  var import_lexical5 = require("lexical");
4126
4227
  var import_code5 = require("@lexical/code");
4127
- var import_jsx_runtime79 = require("react/jsx-runtime");
4228
+ var import_jsx_runtime80 = require("react/jsx-runtime");
4128
4229
  var PRETTIER_PARSER_MODULES = {
4129
4230
  css: () => import("prettier/parser-postcss"),
4130
4231
  html: () => import("prettier/parser-html"),
@@ -4164,8 +4265,9 @@ function getPrettierOptions(lang) {
4164
4265
  return options;
4165
4266
  }
4166
4267
  function PrettierButton({ lang, editor, getCodeDOMNode }) {
4167
- const [syntaxError, setSyntaxError] = (0, import_react64.useState)("");
4168
- const [tipsVisible, setTipsVisible] = (0, import_react64.useState)(false);
4268
+ const [syntaxError, setSyntaxError] = (0, import_react65.useState)("");
4269
+ const [tipsVisible, setTipsVisible] = (0, import_react65.useState)(false);
4270
+ const tr = useTr();
4169
4271
  async function handleClick() {
4170
4272
  const codeDOMNode = getCodeDOMNode();
4171
4273
  try {
@@ -4181,6 +4283,7 @@ function PrettierButton({ lang, editor, getCodeDOMNode }) {
4181
4283
  const content = codeNode.getTextContent();
4182
4284
  let parsed = "";
4183
4285
  parsed = format(content, options);
4286
+ parsed = parsed.replace(/[\r\n]+$/, "");
4184
4287
  if (parsed !== "") {
4185
4288
  const selection = codeNode.select(0);
4186
4289
  selection.insertText(parsed);
@@ -4208,22 +4311,22 @@ function PrettierButton({ lang, editor, getCodeDOMNode }) {
4208
4311
  setTipsVisible(false);
4209
4312
  }
4210
4313
  }
4211
- return /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)("div", {
4314
+ return /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", {
4212
4315
  className: "prettier-wrapper",
4213
4316
  children: [
4214
- /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("button", {
4317
+ /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("button", {
4215
4318
  className: "menu-item",
4216
4319
  onClick: handleClick,
4217
4320
  onMouseEnter: handleMouseEnter,
4218
4321
  onMouseLeave: handleMouseLeave,
4219
- "aria-label": "prettier",
4220
- children: syntaxError ? /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("i", {
4322
+ "aria-label": tr("actionFormatCode"),
4323
+ children: syntaxError ? /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("i", {
4221
4324
  className: "format prettier-error"
4222
- }) : /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("i", {
4325
+ }) : /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("i", {
4223
4326
  className: "format prettier"
4224
4327
  })
4225
4328
  }),
4226
- tipsVisible ? /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("pre", {
4329
+ tipsVisible ? /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("pre", {
4227
4330
  className: "code-error-tips",
4228
4331
  children: syntaxError
4229
4332
  }) : null
@@ -4232,19 +4335,19 @@ function PrettierButton({ lang, editor, getCodeDOMNode }) {
4232
4335
  }
4233
4336
 
4234
4337
  // src/rich-text-editor/plugins/CodeActionMenuPlugin/index.tsx
4235
- var import_jsx_runtime80 = require("react/jsx-runtime");
4338
+ var import_jsx_runtime81 = require("react/jsx-runtime");
4236
4339
  var CODE_PADDING = 8;
4237
4340
  function CodeActionMenuContainer({ anchorElem }) {
4238
4341
  const [editor] = (0, import_LexicalComposerContext.useLexicalComposerContext)();
4239
- const [lang, setLang] = (0, import_react65.useState)("");
4240
- const [isShown, setShown] = (0, import_react65.useState)(false);
4241
- const [shouldListenMouseMove, setShouldListenMouseMove] = (0, import_react65.useState)(false);
4242
- const [position, setPosition] = (0, import_react65.useState)({
4342
+ const [lang, setLang] = (0, import_react66.useState)("");
4343
+ const [isShown, setShown] = (0, import_react66.useState)(false);
4344
+ const [shouldListenMouseMove, setShouldListenMouseMove] = (0, import_react66.useState)(true);
4345
+ const [position, setPosition] = (0, import_react66.useState)({
4243
4346
  right: "0",
4244
4347
  top: "0"
4245
4348
  });
4246
- const codeSetRef = (0, import_react65.useRef)(/* @__PURE__ */ new Set());
4247
- const codeDOMNodeRef = (0, import_react65.useRef)(null);
4349
+ const codeSetRef = (0, import_react66.useRef)(/* @__PURE__ */ new Set());
4350
+ const codeDOMNodeRef = (0, import_react66.useRef)(null);
4248
4351
  function getCodeDOMNode() {
4249
4352
  return codeDOMNodeRef.current;
4250
4353
  }
@@ -4278,7 +4381,7 @@ function CodeActionMenuContainer({ anchorElem }) {
4278
4381
  });
4279
4382
  }
4280
4383
  }, 50);
4281
- (0, import_react65.useEffect)(() => {
4384
+ (0, import_react66.useEffect)(() => {
4282
4385
  if (!shouldListenMouseMove) {
4283
4386
  return;
4284
4387
  }
@@ -4309,20 +4412,20 @@ function CodeActionMenuContainer({ anchorElem }) {
4309
4412
  });
4310
4413
  const normalizedLang = (0, import_code6.normalizeCodeLang)(lang);
4311
4414
  const codeFriendlyName = (0, import_code6.getLanguageFriendlyName)(lang);
4312
- return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(import_jsx_runtime80.Fragment, {
4313
- children: isShown ? /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", {
4415
+ return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(import_jsx_runtime81.Fragment, {
4416
+ children: isShown ? /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("div", {
4314
4417
  className: "code-action-menu-container",
4315
4418
  style: { ...position },
4316
4419
  children: [
4317
- /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", {
4420
+ /* @__PURE__ */ (0, import_jsx_runtime81.jsx)("div", {
4318
4421
  className: "code-highlight-language",
4319
4422
  children: codeFriendlyName
4320
4423
  }),
4321
- /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(CopyButton, {
4424
+ /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(CopyButton, {
4322
4425
  editor,
4323
4426
  getCodeDOMNode
4324
4427
  }),
4325
- canBePrettier(normalizedLang) ? /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(PrettierButton, {
4428
+ canBePrettier(normalizedLang) ? /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(PrettierButton, {
4326
4429
  editor,
4327
4430
  getCodeDOMNode,
4328
4431
  lang: normalizedLang
@@ -4344,25 +4447,25 @@ function getMouseInfo(event) {
4344
4447
  function CodeActionMenuPlugin({
4345
4448
  anchorElem = document.body
4346
4449
  }) {
4347
- return (0, import_react_dom2.createPortal)(/* @__PURE__ */ (0, import_jsx_runtime80.jsx)(CodeActionMenuContainer, {
4450
+ return (0, import_react_dom2.createPortal)(/* @__PURE__ */ (0, import_jsx_runtime81.jsx)(CodeActionMenuContainer, {
4348
4451
  anchorElem
4349
4452
  }), anchorElem);
4350
4453
  }
4351
4454
 
4352
4455
  // src/rich-text-editor/plugins/CodeHighlightPlugin/index.ts
4353
- var import_react66 = require("react");
4456
+ var import_react67 = require("react");
4354
4457
  var import_code7 = require("@lexical/code");
4355
4458
  var import_LexicalComposerContext2 = require("@lexical/react/LexicalComposerContext");
4356
4459
  function CodeHighlightPlugin() {
4357
4460
  const [editor] = (0, import_LexicalComposerContext2.useLexicalComposerContext)();
4358
- (0, import_react66.useEffect)(() => {
4461
+ (0, import_react67.useEffect)(() => {
4359
4462
  return (0, import_code7.registerCodeHighlighting)(editor);
4360
4463
  }, [editor]);
4361
4464
  return null;
4362
4465
  }
4363
4466
 
4364
4467
  // src/rich-text-editor/plugins/FloatingLinkEditorPlugin/index.tsx
4365
- var import_react68 = require("react");
4468
+ var import_react69 = require("react");
4366
4469
  var React4 = require("react");
4367
4470
  var import_lexical9 = require("lexical");
4368
4471
  var import_react_dom3 = require("react-dom");
@@ -4371,10 +4474,10 @@ var import_LexicalComposerContext4 = require("@lexical/react/LexicalComposerCont
4371
4474
  var import_utils = require("@lexical/utils");
4372
4475
 
4373
4476
  // src/rich-text-editor/ui/LinkPreview.tsx
4374
- var import_react67 = require("react");
4477
+ var import_react68 = require("react");
4375
4478
  var import_lexical7 = require("lexical");
4376
4479
  var import_LexicalComposerContext3 = require("@lexical/react/LexicalComposerContext");
4377
- var import_jsx_runtime81 = require("react/jsx-runtime");
4480
+ var import_jsx_runtime82 = require("react/jsx-runtime");
4378
4481
  var PREVIEW_CACHE = {};
4379
4482
  var URL_MATCHER2 = /((https?:\/\/(www\.)?)|(www\.))[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)/;
4380
4483
  function useSuspenseRequest(url) {
@@ -4398,11 +4501,12 @@ function useSuspenseRequest(url) {
4398
4501
  function LinkPreviewContent({
4399
4502
  url
4400
4503
  }) {
4401
- const [textContent, setTextContent] = (0, import_react67.useState)("");
4504
+ const [textContent, setTextContent] = (0, import_react68.useState)("");
4402
4505
  const { preview } = useSuspenseRequest(url);
4403
4506
  const [editor] = (0, import_LexicalComposerContext3.useLexicalComposerContext)();
4507
+ const tr = useTr();
4404
4508
  const hasPreview = preview !== null && preview.google?.title;
4405
- (0, import_react67.useEffect)(() => {
4509
+ (0, import_react68.useEffect)(() => {
4406
4510
  editor.update(() => {
4407
4511
  const sel = (0, import_lexical7.$getSelection)();
4408
4512
  const nodes = sel?.getNodes();
@@ -4430,35 +4534,35 @@ function LinkPreviewContent({
4430
4534
  if (!hasPreview) {
4431
4535
  return null;
4432
4536
  }
4433
- return /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("div", {
4537
+ return /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", {
4434
4538
  className: "LinkPreview__container",
4435
4539
  children: [
4436
- preview.google.image && /* @__PURE__ */ (0, import_jsx_runtime81.jsx)("div", {
4540
+ preview.google.image && /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", {
4437
4541
  className: "LinkPreview__imageWrapper bg-purple-50-900",
4438
- children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)("img", {
4542
+ children: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("img", {
4439
4543
  src: preview.google.image,
4440
4544
  alt: preview.google.title,
4441
4545
  className: "LinkPreview__image"
4442
4546
  })
4443
4547
  }),
4444
- preview.google.title && /* @__PURE__ */ (0, import_jsx_runtime81.jsx)("div", {
4548
+ preview.google.title && /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", {
4445
4549
  className: "LinkPreview__title",
4446
4550
  children: preview.google.title
4447
4551
  }),
4448
- preview.google.description && /* @__PURE__ */ (0, import_jsx_runtime81.jsx)("div", {
4552
+ preview.google.description && /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", {
4449
4553
  className: "LinkPreview__description",
4450
4554
  children: preview.google.description
4451
4555
  }),
4452
- textContent && textContent !== preview.google.title ? /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(Button, {
4556
+ textContent && textContent !== preview.google.title ? /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(Button, {
4453
4557
  className: "mb-4 ml-5",
4454
4558
  onClick: useTitleForText,
4455
- children: "Replace link text with its title"
4559
+ children: tr("linkPreviewReplaceTextWithTitle")
4456
4560
  }) : null
4457
4561
  ]
4458
4562
  });
4459
4563
  }
4460
4564
  function Glimmer(props) {
4461
- return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)("div", {
4565
+ return /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", {
4462
4566
  className: "LinkPreview__glimmer",
4463
4567
  ...props,
4464
4568
  style: {
@@ -4470,24 +4574,24 @@ function Glimmer(props) {
4470
4574
  function LinkPreview({
4471
4575
  url
4472
4576
  }) {
4473
- return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(import_react67.Suspense, {
4474
- fallback: /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)(import_jsx_runtime81.Fragment, {
4577
+ return /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(import_react68.Suspense, {
4578
+ fallback: /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)(import_jsx_runtime82.Fragment, {
4475
4579
  children: [
4476
- /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(Glimmer, {
4580
+ /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(Glimmer, {
4477
4581
  style: { height: "80px" },
4478
4582
  index: 0
4479
4583
  }),
4480
- /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(Glimmer, {
4584
+ /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(Glimmer, {
4481
4585
  style: { width: "60%" },
4482
4586
  index: 1
4483
4587
  }),
4484
- /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(Glimmer, {
4588
+ /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(Glimmer, {
4485
4589
  style: { width: "80%" },
4486
4590
  index: 2
4487
4591
  })
4488
4592
  ]
4489
4593
  }),
4490
- children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(LinkPreviewContent, {
4594
+ children: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(LinkPreviewContent, {
4491
4595
  url
4492
4596
  })
4493
4597
  });
@@ -4556,21 +4660,22 @@ function validateUrl(url) {
4556
4660
  }
4557
4661
 
4558
4662
  // src/rich-text-editor/plugins/FloatingLinkEditorPlugin/index.tsx
4559
- var import_jsx_runtime82 = require("react/jsx-runtime");
4663
+ var import_jsx_runtime83 = require("react/jsx-runtime");
4560
4664
  function FloatingLinkEditor({
4561
4665
  editor,
4562
4666
  isLink,
4563
4667
  setIsLink,
4564
4668
  anchorElem
4565
4669
  }) {
4566
- const editorRef = (0, import_react68.useRef)(null);
4567
- const inputRef = (0, import_react68.useRef)(null);
4568
- const [linkUrl, setLinkUrl] = (0, import_react68.useState)("");
4569
- const [rel, setRel] = (0, import_react68.useState)(null);
4570
- const [target, setTarget] = (0, import_react68.useState)(null);
4571
- const [isEditMode, setEditMode] = (0, import_react68.useState)(false);
4572
- const [lastSelection, setLastSelection] = (0, import_react68.useState)(null);
4573
- const updateLinkEditor = (0, import_react68.useCallback)(() => {
4670
+ const editorRef = (0, import_react69.useRef)(null);
4671
+ const inputRef = (0, import_react69.useRef)(null);
4672
+ const [linkUrl, setLinkUrl] = (0, import_react69.useState)("");
4673
+ const [rel, setRel] = (0, import_react69.useState)(null);
4674
+ const [target, setTarget] = (0, import_react69.useState)(null);
4675
+ const [isEditMode, setEditMode] = (0, import_react69.useState)(false);
4676
+ const [lastSelection, setLastSelection] = (0, import_react69.useState)(null);
4677
+ const tr = useTr();
4678
+ const updateLinkEditor = (0, import_react69.useCallback)(() => {
4574
4679
  const selection = (0, import_lexical9.$getSelection)();
4575
4680
  if ((0, import_lexical9.$isRangeSelection)(selection)) {
4576
4681
  const node = getSelectedNode(selection);
@@ -4620,7 +4725,7 @@ function FloatingLinkEditor({
4620
4725
  }
4621
4726
  return true;
4622
4727
  }, [anchorElem, editor]);
4623
- (0, import_react68.useEffect)(() => {
4728
+ (0, import_react69.useEffect)(() => {
4624
4729
  const scrollerElem = anchorElem.parentElement;
4625
4730
  const update = () => {
4626
4731
  editor.getEditorState().read(() => {
@@ -4638,7 +4743,7 @@ function FloatingLinkEditor({
4638
4743
  }
4639
4744
  };
4640
4745
  }, [anchorElem.parentElement, editor, updateLinkEditor]);
4641
- (0, import_react68.useEffect)(() => {
4746
+ (0, import_react69.useEffect)(() => {
4642
4747
  return (0, import_utils.mergeRegister)(
4643
4748
  editor.registerUpdateListener(({ editorState }) => {
4644
4749
  editorState.read(() => {
@@ -4666,51 +4771,51 @@ function FloatingLinkEditor({
4666
4771
  )
4667
4772
  );
4668
4773
  }, [editor, updateLinkEditor, setIsLink, isLink]);
4669
- (0, import_react68.useEffect)(() => {
4774
+ (0, import_react69.useEffect)(() => {
4670
4775
  editor.getEditorState().read(() => {
4671
4776
  updateLinkEditor();
4672
4777
  });
4673
4778
  }, [editor, updateLinkEditor]);
4674
- (0, import_react68.useEffect)(() => {
4779
+ (0, import_react69.useEffect)(() => {
4675
4780
  if (isEditMode && inputRef.current) {
4676
4781
  inputRef.current.focus();
4677
4782
  }
4678
4783
  }, [isEditMode]);
4679
- return /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", {
4784
+ return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("div", {
4680
4785
  ref: editorRef,
4681
4786
  className: "link-editor",
4682
- children: isEditMode ? /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", {
4787
+ children: isEditMode ? /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("div", {
4683
4788
  children: [
4684
- /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", {
4789
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("div", {
4685
4790
  className: "border-0 border-b border-gray-100-800 border-solid px-3",
4686
- children: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(InputWithLabel, {
4687
- label: "Link",
4791
+ children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(InputWithLabel, {
4792
+ label: tr("linkEditorLink"),
4688
4793
  type: "text",
4689
4794
  value: linkUrl,
4690
4795
  onChange: (e) => setLinkUrl(e.target.value)
4691
4796
  })
4692
4797
  }),
4693
- /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", {
4798
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("div", {
4694
4799
  className: "border-0 border-b border-gray-100-800 border-solid px-3",
4695
- children: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(InputWithLabel, {
4696
- label: "Rel",
4800
+ children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(InputWithLabel, {
4801
+ label: tr("linkEditorRel"),
4697
4802
  type: "text",
4698
4803
  value: rel ?? "",
4699
4804
  onChange: (e) => setRel(e.target.value)
4700
4805
  })
4701
4806
  }),
4702
- /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", {
4807
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("div", {
4703
4808
  className: "border-0 border-b border-gray-100-800 border-solid px-3",
4704
- children: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(InputWithLabel, {
4705
- label: "Target",
4809
+ children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(InputWithLabel, {
4810
+ label: tr("linkEditorTarget"),
4706
4811
  type: "text",
4707
4812
  value: target ?? "",
4708
4813
  onChange: (e) => setTarget(e.target.value)
4709
4814
  })
4710
4815
  }),
4711
- /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", {
4816
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("div", {
4712
4817
  className: "flex px-6 py-2 justify-end",
4713
- children: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(Button, {
4818
+ children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Button, {
4714
4819
  onClick: () => {
4715
4820
  if (lastSelection !== null) {
4716
4821
  if (linkUrl !== "") {
@@ -4723,32 +4828,32 @@ function FloatingLinkEditor({
4723
4828
  setEditMode(false);
4724
4829
  }
4725
4830
  },
4726
- children: "Done"
4831
+ children: tr("linkEditorCommit")
4727
4832
  })
4728
4833
  })
4729
4834
  ]
4730
- }) : /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)(import_jsx_runtime82.Fragment, {
4835
+ }) : /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(import_jsx_runtime83.Fragment, {
4731
4836
  children: [
4732
- /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", {
4837
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("div", {
4733
4838
  className: "link-input !flex flex-nowrap justify-between items-center max-w-full ",
4734
4839
  children: [
4735
- /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", {
4736
- className: " grid",
4840
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("div", {
4841
+ className: "grid",
4737
4842
  children: [
4738
- /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("a", {
4843
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("a", {
4739
4844
  href: linkUrl,
4740
4845
  target: "_blank",
4741
4846
  rel: "noopener noreferrer",
4742
4847
  children: linkUrl
4743
4848
  }),
4744
- rel || target ? /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", {
4849
+ rel || target ? /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("div", {
4745
4850
  className: "flex mt-1 gap-1",
4746
4851
  children: [
4747
- rel && /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", {
4852
+ rel && /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("div", {
4748
4853
  className: "text-[10px] text-gray-600-300 px-1 bg-purple-50-900 rounded-md py-0.5",
4749
4854
  children: rel
4750
4855
  }),
4751
- target && /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", {
4856
+ target && /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("div", {
4752
4857
  className: "text-[10px] text-gray-600-300 px-1 bg-purple-50-900 rounded-md py-0.5",
4753
4858
  children: target
4754
4859
  })
@@ -4756,19 +4861,20 @@ function FloatingLinkEditor({
4756
4861
  }) : null
4757
4862
  ]
4758
4863
  }),
4759
- /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", {
4760
- children: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(IconButton, {
4864
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("div", {
4865
+ children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(IconButton, {
4761
4866
  size: "sm",
4762
4867
  tabIndex: 0,
4763
4868
  onMouseDown: (event) => event.preventDefault(),
4764
4869
  onClick: () => setEditMode(true),
4765
- children: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(Icon.Edit, {})
4870
+ "aria-label": tr("linkEditorEdit"),
4871
+ children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Icon.Edit, {})
4766
4872
  })
4767
4873
  })
4768
4874
  ]
4769
4875
  }),
4770
- /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", {
4771
- children: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(LinkPreview, {
4876
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("div", {
4877
+ children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(LinkPreview, {
4772
4878
  url: linkUrl
4773
4879
  })
4774
4880
  })
@@ -4777,9 +4883,9 @@ function FloatingLinkEditor({
4777
4883
  });
4778
4884
  }
4779
4885
  function useFloatingLinkEditorToolbar(editor, anchorElem) {
4780
- const [activeEditor, setActiveEditor] = (0, import_react68.useState)(editor);
4781
- const [isLink, setIsLink] = (0, import_react68.useState)(false);
4782
- const updateToolbar = (0, import_react68.useCallback)(() => {
4886
+ const [activeEditor, setActiveEditor] = (0, import_react69.useState)(editor);
4887
+ const [isLink, setIsLink] = (0, import_react69.useState)(false);
4888
+ const updateToolbar = (0, import_react69.useCallback)(() => {
4783
4889
  const selection = (0, import_lexical9.$getSelection)();
4784
4890
  if ((0, import_lexical9.$isRangeSelection)(selection)) {
4785
4891
  const node = getSelectedNode(selection);
@@ -4792,7 +4898,7 @@ function useFloatingLinkEditorToolbar(editor, anchorElem) {
4792
4898
  }
4793
4899
  }
4794
4900
  }, []);
4795
- (0, import_react68.useEffect)(() => {
4901
+ (0, import_react69.useEffect)(() => {
4796
4902
  return editor.registerCommand(
4797
4903
  import_lexical9.SELECTION_CHANGE_COMMAND,
4798
4904
  (_payload, newEditor) => {
@@ -4804,7 +4910,7 @@ function useFloatingLinkEditorToolbar(editor, anchorElem) {
4804
4910
  );
4805
4911
  }, [editor, updateToolbar]);
4806
4912
  return isLink ? (0, import_react_dom3.createPortal)(
4807
- /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(FloatingLinkEditor, {
4913
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(FloatingLinkEditor, {
4808
4914
  editor: activeEditor,
4809
4915
  isLink,
4810
4916
  anchorElem,
@@ -4821,7 +4927,7 @@ function FloatingLinkEditorPlugin({
4821
4927
  }
4822
4928
 
4823
4929
  // src/rich-text-editor/plugins/FloatingTextFormatToolbarPlugin/index.tsx
4824
- var import_react69 = require("react");
4930
+ var import_react70 = require("react");
4825
4931
  var React5 = require("react");
4826
4932
  var import_lexical10 = require("lexical");
4827
4933
  var import_react_dom4 = require("react-dom");
@@ -4830,6 +4936,9 @@ var import_link5 = require("@lexical/link");
4830
4936
  var import_LexicalComposerContext5 = require("@lexical/react/LexicalComposerContext");
4831
4937
  var import_utils2 = require("@lexical/utils");
4832
4938
 
4939
+ // src/rich-text-editor/utils/environment.ts
4940
+ var IS_APPLE = typeof navigator !== "undefined" && /Mac|iPod|iPhone|iPad/.test(navigator.platform);
4941
+
4833
4942
  // src/rich-text-editor/utils/getDOMRangeRect.ts
4834
4943
  function getDOMRangeRect(nativeSelection, rootElement) {
4835
4944
  const domRange = nativeSelection.getRangeAt(0);
@@ -4860,7 +4969,7 @@ function getDOMRangeRect(nativeSelection, rootElement) {
4860
4969
  }
4861
4970
 
4862
4971
  // src/rich-text-editor/plugins/FloatingTextFormatToolbarPlugin/index.tsx
4863
- var import_jsx_runtime83 = require("react/jsx-runtime");
4972
+ var import_jsx_runtime84 = require("react/jsx-runtime");
4864
4973
  function TextFormatFloatingToolbar({
4865
4974
  editor,
4866
4975
  anchorElem,
@@ -4873,15 +4982,16 @@ function TextFormatFloatingToolbar({
4873
4982
  isSubscript,
4874
4983
  isSuperscript
4875
4984
  }) {
4876
- const popupCharStylesEditorRef = (0, import_react69.useRef)(null);
4877
- const insertLink = (0, import_react69.useCallback)(() => {
4985
+ const popupCharStylesEditorRef = (0, import_react70.useRef)(null);
4986
+ const tr = useTr();
4987
+ const insertLink = (0, import_react70.useCallback)(() => {
4878
4988
  if (!isLink) {
4879
4989
  editor.dispatchCommand(import_link5.TOGGLE_LINK_COMMAND, "https://");
4880
4990
  } else {
4881
4991
  editor.dispatchCommand(import_link5.TOGGLE_LINK_COMMAND, null);
4882
4992
  }
4883
4993
  }, [editor, isLink]);
4884
- const updateTextFormatFloatingToolbar = (0, import_react69.useCallback)(() => {
4994
+ const updateTextFormatFloatingToolbar = (0, import_react70.useCallback)(() => {
4885
4995
  const selection = (0, import_lexical10.$getSelection)();
4886
4996
  const popupCharStylesEditorElem = popupCharStylesEditorRef.current;
4887
4997
  const nativeSelection = window.getSelection();
@@ -4894,7 +5004,7 @@ function TextFormatFloatingToolbar({
4894
5004
  setFloatingElemPosition(rangeRect, popupCharStylesEditorElem, anchorElem);
4895
5005
  }
4896
5006
  }, [editor, anchorElem]);
4897
- (0, import_react69.useEffect)(() => {
5007
+ (0, import_react70.useEffect)(() => {
4898
5008
  const scrollerElem = anchorElem.parentElement;
4899
5009
  const update = () => {
4900
5010
  editor.getEditorState().read(() => {
@@ -4912,7 +5022,7 @@ function TextFormatFloatingToolbar({
4912
5022
  }
4913
5023
  };
4914
5024
  }, [editor, updateTextFormatFloatingToolbar, anchorElem]);
4915
- (0, import_react69.useEffect)(() => {
5025
+ (0, import_react70.useEffect)(() => {
4916
5026
  editor.getEditorState().read(() => {
4917
5027
  updateTextFormatFloatingToolbar();
4918
5028
  });
@@ -4932,88 +5042,92 @@ function TextFormatFloatingToolbar({
4932
5042
  )
4933
5043
  );
4934
5044
  }, [editor, updateTextFormatFloatingToolbar]);
4935
- return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("div", {
5045
+ return /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("div", {
4936
5046
  ref: popupCharStylesEditorRef,
4937
5047
  className: "c-floating-text-format-popup gap-0.5",
4938
- children: editor.isEditable() && /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(import_jsx_runtime83.Fragment, {
5048
+ children: editor.isEditable() && /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)(import_jsx_runtime84.Fragment, {
4939
5049
  children: [
4940
- /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(IconButton, {
5050
+ /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(IconButton, {
4941
5051
  onClick: () => {
4942
5052
  editor.dispatchCommand(import_lexical10.FORMAT_TEXT_COMMAND, "bold");
4943
5053
  },
4944
5054
  style: { padding: 0, overflow: "hidden" },
4945
- "aria-label": "Format text as bold",
4946
- children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("i", {
5055
+ title: tr(IS_APPLE ? "actionFormatAsStrongTitleApple" : "actionFormatAsStrongTitle"),
5056
+ "aria-label": tr("actionFormatAsStrongLabel"),
5057
+ children: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("i", {
4947
5058
  className: `format bold w-full h-full bg-[length:18px_18px] bg-no-repeat bg-center ${isBold ? "bg-purple-50-900 opacity-100" : "opacity-60"}`
4948
5059
  })
4949
5060
  }),
4950
- /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(IconButton, {
5061
+ /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(IconButton, {
4951
5062
  style: { padding: 0, overflow: "hidden" },
4952
5063
  onClick: () => {
4953
5064
  editor.dispatchCommand(import_lexical10.FORMAT_TEXT_COMMAND, "italic");
4954
5065
  },
4955
- "aria-label": "Format text as italics",
4956
- children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("i", {
5066
+ title: tr("actionFormatAsEmphasizedTitle"),
5067
+ "aria-label": tr("actionFormatAsEmphasizedLabel"),
5068
+ children: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("i", {
4957
5069
  className: `format italic w-full h-full bg-[length:18px_18px] bg-no-repeat bg-center ${isItalic ? "bg-purple-50-900 opacity-100" : "opacity-60"}`
4958
5070
  })
4959
5071
  }),
4960
- /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(IconButton, {
5072
+ /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(IconButton, {
4961
5073
  style: { padding: 0, overflow: "hidden" },
4962
5074
  onClick: () => {
4963
5075
  editor.dispatchCommand(import_lexical10.FORMAT_TEXT_COMMAND, "underline");
4964
5076
  },
4965
- "aria-label": "Format text to underlined",
4966
- children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("i", {
5077
+ title: tr("actionFormatAsUnderlinedTitle"),
5078
+ "aria-label": tr("actionFormatAsUnderlinedLabel"),
5079
+ children: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("i", {
4967
5080
  className: `format underline w-full h-full bg-[length:18px_18px] bg-no-repeat bg-center ${isUnderline ? "bg-purple-50-900 opacity-100" : "opacity-60"}`
4968
5081
  })
4969
5082
  }),
4970
- /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(IconButton, {
5083
+ /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(IconButton, {
4971
5084
  style: { padding: 0, overflow: "hidden" },
4972
5085
  onClick: () => {
4973
5086
  editor.dispatchCommand(import_lexical10.FORMAT_TEXT_COMMAND, "strikethrough");
4974
5087
  },
4975
- "aria-label": "Format text with a strikethrough",
4976
- children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("i", {
5088
+ title: tr("actionFormatWithStrikethroughTitle"),
5089
+ "aria-label": tr("actionFormatWithStrikethroughLabel"),
5090
+ children: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("i", {
4977
5091
  className: `format strikethrough w-full h-full bg-[length:18px_18px] bg-no-repeat bg-center ${isStrikethrough ? "bg-purple-50-900 opacity-100" : "opacity-60"}`
4978
5092
  })
4979
5093
  }),
4980
- /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(IconButton, {
5094
+ /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(IconButton, {
4981
5095
  style: { padding: 0, overflow: "hidden" },
4982
5096
  onClick: () => {
4983
5097
  editor.dispatchCommand(import_lexical10.FORMAT_TEXT_COMMAND, "subscript");
4984
5098
  },
4985
- title: "Subscript",
4986
- "aria-label": "Format Subscript",
4987
- children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("i", {
5099
+ title: tr("actionFormatWithSubscriptTitle"),
5100
+ "aria-label": tr("actionFormatWithSubscriptLabel"),
5101
+ children: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("i", {
4988
5102
  className: `format subscript w-full h-full bg-[length:18px_18px] bg-no-repeat bg-center ${isSubscript ? "bg-purple-50-900 opacity-100" : "opacity-60"}`
4989
5103
  })
4990
5104
  }),
4991
- /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(IconButton, {
5105
+ /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(IconButton, {
4992
5106
  style: { padding: 0, overflow: "hidden" },
4993
5107
  onClick: () => {
4994
5108
  editor.dispatchCommand(import_lexical10.FORMAT_TEXT_COMMAND, "superscript");
4995
5109
  },
4996
- title: "Superscript",
4997
- "aria-label": "Format Superscript",
4998
- children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("i", {
5110
+ title: tr("actionFormatWithSuperscriptTitle"),
5111
+ "aria-label": tr("actionFormatWithSuperscriptLabel"),
5112
+ children: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("i", {
4999
5113
  className: `format superscript w-full h-full bg-[length:18px_18px] bg-no-repeat bg-center ${isSuperscript ? "bg-purple-50-900 opacity-100" : "opacity-60"}`
5000
5114
  })
5001
5115
  }),
5002
- /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(IconButton, {
5116
+ /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(IconButton, {
5003
5117
  style: { padding: 0, overflow: "hidden" },
5004
5118
  onClick: () => {
5005
5119
  editor.dispatchCommand(import_lexical10.FORMAT_TEXT_COMMAND, "code");
5006
5120
  },
5007
- "aria-label": "Insert code block",
5008
- children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("i", {
5121
+ "aria-label": tr("actionInsertCodeBlock"),
5122
+ children: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("i", {
5009
5123
  className: `format code w-full h-full bg-[length:18px_18px] bg-no-repeat bg-center ${isCode ? "bg-purple-50-900 opacity-100" : "opacity-60"}`
5010
5124
  })
5011
5125
  }),
5012
- /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(IconButton, {
5126
+ /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(IconButton, {
5013
5127
  style: { padding: 0, overflow: "hidden" },
5014
5128
  onClick: insertLink,
5015
- "aria-label": "Insert link",
5016
- children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("i", {
5129
+ "aria-label": tr("actionInsertlink"),
5130
+ children: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("i", {
5017
5131
  className: `format link w-full h-full bg-[length:18px_18px] bg-no-repeat bg-center ${isLink ? "bg-purple-50-900 opacity-100" : "opacity-60"}`
5018
5132
  })
5019
5133
  })
@@ -5022,16 +5136,16 @@ function TextFormatFloatingToolbar({
5022
5136
  });
5023
5137
  }
5024
5138
  function useFloatingTextFormatToolbar(editor, anchorElem) {
5025
- const [isText, setIsText] = (0, import_react69.useState)(false);
5026
- const [isLink, setIsLink] = (0, import_react69.useState)(false);
5027
- const [isBold, setIsBold] = (0, import_react69.useState)(false);
5028
- const [isItalic, setIsItalic] = (0, import_react69.useState)(false);
5029
- const [isUnderline, setIsUnderline] = (0, import_react69.useState)(false);
5030
- const [isStrikethrough, setIsStrikethrough] = (0, import_react69.useState)(false);
5031
- const [isSubscript, setIsSubscript] = (0, import_react69.useState)(false);
5032
- const [isSuperscript, setIsSuperscript] = (0, import_react69.useState)(false);
5033
- const [isCode, setIsCode] = (0, import_react69.useState)(false);
5034
- const updatePopup = (0, import_react69.useCallback)(() => {
5139
+ const [isText, setIsText] = (0, import_react70.useState)(false);
5140
+ const [isLink, setIsLink] = (0, import_react70.useState)(false);
5141
+ const [isBold, setIsBold] = (0, import_react70.useState)(false);
5142
+ const [isItalic, setIsItalic] = (0, import_react70.useState)(false);
5143
+ const [isUnderline, setIsUnderline] = (0, import_react70.useState)(false);
5144
+ const [isStrikethrough, setIsStrikethrough] = (0, import_react70.useState)(false);
5145
+ const [isSubscript, setIsSubscript] = (0, import_react70.useState)(false);
5146
+ const [isSuperscript, setIsSuperscript] = (0, import_react70.useState)(false);
5147
+ const [isCode, setIsCode] = (0, import_react70.useState)(false);
5148
+ const updatePopup = (0, import_react70.useCallback)(() => {
5035
5149
  editor.getEditorState().read(() => {
5036
5150
  if (editor.isComposing()) {
5037
5151
  return;
@@ -5067,13 +5181,13 @@ function useFloatingTextFormatToolbar(editor, anchorElem) {
5067
5181
  }
5068
5182
  });
5069
5183
  }, [editor]);
5070
- (0, import_react69.useEffect)(() => {
5184
+ (0, import_react70.useEffect)(() => {
5071
5185
  document.addEventListener("selectionchange", updatePopup);
5072
5186
  return () => {
5073
5187
  document.removeEventListener("selectionchange", updatePopup);
5074
5188
  };
5075
5189
  }, [updatePopup]);
5076
- (0, import_react69.useEffect)(() => {
5190
+ (0, import_react70.useEffect)(() => {
5077
5191
  return (0, import_utils2.mergeRegister)(
5078
5192
  editor.registerUpdateListener(() => {
5079
5193
  updatePopup();
@@ -5089,7 +5203,7 @@ function useFloatingTextFormatToolbar(editor, anchorElem) {
5089
5203
  return null;
5090
5204
  }
5091
5205
  return (0, import_react_dom4.createPortal)(
5092
- /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(TextFormatFloatingToolbar, {
5206
+ /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(TextFormatFloatingToolbar, {
5093
5207
  editor,
5094
5208
  anchorElem,
5095
5209
  isLink,
@@ -5114,9 +5228,9 @@ function FloatingTextFormatToolbarPlugin({
5114
5228
  // src/rich-text-editor/plugins/LinkPlugin/index.tsx
5115
5229
  var import_LexicalLinkPlugin = require("@lexical/react/LexicalLinkPlugin");
5116
5230
  var React6 = require("react");
5117
- var import_jsx_runtime84 = require("react/jsx-runtime");
5231
+ var import_jsx_runtime85 = require("react/jsx-runtime");
5118
5232
  function LinkPlugin() {
5119
- return /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(import_LexicalLinkPlugin.LinkPlugin, {
5233
+ return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(import_LexicalLinkPlugin.LinkPlugin, {
5120
5234
  validateUrl
5121
5235
  });
5122
5236
  }
@@ -5125,7 +5239,7 @@ function LinkPlugin() {
5125
5239
  var import_list4 = require("@lexical/list");
5126
5240
  var import_LexicalComposerContext6 = require("@lexical/react/LexicalComposerContext");
5127
5241
  var import_lexical11 = require("lexical");
5128
- var import_react70 = require("react");
5242
+ var import_react71 = require("react");
5129
5243
  function getElementNodesInSelection(selection) {
5130
5244
  const nodesInSelection = selection.getNodes();
5131
5245
  if (nodesInSelection.length === 0) {
@@ -5162,7 +5276,7 @@ function isIndentPermitted(maxDepth) {
5162
5276
  }
5163
5277
  function ListMaxIndentLevelPlugin({ maxDepth }) {
5164
5278
  const [editor] = (0, import_LexicalComposerContext6.useLexicalComposerContext)();
5165
- (0, import_react70.useEffect)(() => {
5279
+ (0, import_react71.useEffect)(() => {
5166
5280
  return editor.registerCommand(
5167
5281
  import_lexical11.INDENT_CONTENT_COMMAND,
5168
5282
  () => !isIndentPermitted(maxDepth ?? 7),
@@ -5173,7 +5287,7 @@ function ListMaxIndentLevelPlugin({ maxDepth }) {
5173
5287
  }
5174
5288
 
5175
5289
  // src/rich-text-editor/plugins/MaxLengthPlugin/index.tsx
5176
- var import_react71 = require("react");
5290
+ var import_react72 = require("react");
5177
5291
  var import_lexical12 = require("lexical");
5178
5292
  var import_LexicalComposerContext7 = require("@lexical/react/LexicalComposerContext");
5179
5293
  var import_selection2 = require("@lexical/selection");
@@ -5215,7 +5329,7 @@ ${content}
5215
5329
  // src/rich-text-editor/plugins/MaxLengthPlugin/index.tsx
5216
5330
  function MaxLengthPlugin({ maxLength }) {
5217
5331
  const [editor] = (0, import_LexicalComposerContext7.useLexicalComposerContext)();
5218
- (0, import_react71.useEffect)(() => {
5332
+ (0, import_react72.useEffect)(() => {
5219
5333
  let lastRestoredEditorState = null;
5220
5334
  return editor.registerUpdateListener(({ editorState, prevEditorState }) => {
5221
5335
  editor.update(() => {
@@ -5245,9 +5359,9 @@ function MaxLengthPlugin({ maxLength }) {
5245
5359
  }
5246
5360
 
5247
5361
  // src/rich-text-editor/plugins/TabFocusPlugin/index.tsx
5248
- var import_LexicalComposerContext8 = require("@lexical/react/LexicalComposerContext");
5362
+ var import_react73 = require("react");
5249
5363
  var import_lexical13 = require("lexical");
5250
- var import_react72 = require("react");
5364
+ var import_LexicalComposerContext8 = require("@lexical/react/LexicalComposerContext");
5251
5365
  var COMMAND_PRIORITY_LOW3 = 1;
5252
5366
  var TAB_TO_FOCUS_INTERVAL = 100;
5253
5367
  var lastTabKeyDownTimestamp = 0;
@@ -5265,7 +5379,7 @@ function registerKeyTimeStampTracker() {
5265
5379
  }
5266
5380
  function TabFocusPlugin() {
5267
5381
  const [editor] = (0, import_LexicalComposerContext8.useLexicalComposerContext)();
5268
- (0, import_react72.useEffect)(() => {
5382
+ (0, import_react73.useEffect)(() => {
5269
5383
  if (!hasRegisteredKeyDownListener) {
5270
5384
  registerKeyTimeStampTracker();
5271
5385
  hasRegisteredKeyDownListener = true;
@@ -5288,21 +5402,22 @@ function TabFocusPlugin() {
5288
5402
  }
5289
5403
 
5290
5404
  // src/rich-text-editor/plugins/TableActionMenuPlugin/index.tsx
5291
- var import_react73 = require("react");
5405
+ var import_react74 = require("react");
5292
5406
  var import_lexical14 = require("lexical");
5293
5407
  var import_react_dom5 = require("react-dom");
5294
5408
  var import_LexicalComposerContext9 = require("@lexical/react/LexicalComposerContext");
5295
5409
  var import_useLexicalEditable = __toESM(require("@lexical/react/useLexicalEditable"));
5296
5410
  var import_table4 = require("@lexical/table");
5297
- var import_jsx_runtime85 = require("react/jsx-runtime");
5411
+ var import_jsx_runtime86 = require("react/jsx-runtime");
5298
5412
  function TableActionMenu({ tableCellNode: _tableCellNode, tableStats }) {
5299
5413
  const [editor] = (0, import_LexicalComposerContext9.useLexicalComposerContext)();
5300
- const [tableCellNode, updateTableCellNode] = (0, import_react73.useState)(_tableCellNode);
5301
- const [selectionCounts, updateSelectionCounts] = (0, import_react73.useState)({
5414
+ const [tableCellNode, updateTableCellNode] = (0, import_react74.useState)(_tableCellNode);
5415
+ const [selectionCounts, updateSelectionCounts] = (0, import_react74.useState)({
5302
5416
  columns: 1,
5303
5417
  rows: 1
5304
5418
  });
5305
- (0, import_react73.useEffect)(() => {
5419
+ const tr = useTr();
5420
+ (0, import_react74.useEffect)(() => {
5306
5421
  return editor.registerMutationListener(import_table4.TableCellNode, (nodeMutations) => {
5307
5422
  const nodeUpdated = nodeMutations.get(tableCellNode.getKey()) === "updated";
5308
5423
  if (nodeUpdated) {
@@ -5312,7 +5427,7 @@ function TableActionMenu({ tableCellNode: _tableCellNode, tableStats }) {
5312
5427
  }
5313
5428
  });
5314
5429
  }, [editor, tableCellNode]);
5315
- (0, import_react73.useEffect)(() => {
5430
+ (0, import_react74.useEffect)(() => {
5316
5431
  editor.getEditorState().read(() => {
5317
5432
  const selection = (0, import_lexical14.$getSelection)();
5318
5433
  if ((0, import_lexical14.DEPRECATED_$isGridSelection)(selection)) {
@@ -5324,7 +5439,7 @@ function TableActionMenu({ tableCellNode: _tableCellNode, tableStats }) {
5324
5439
  }
5325
5440
  });
5326
5441
  }, [editor]);
5327
- const clearTableSelection = (0, import_react73.useCallback)(() => {
5442
+ const clearTableSelection = (0, import_react74.useCallback)(() => {
5328
5443
  editor.update(() => {
5329
5444
  if (tableCellNode.isAttached()) {
5330
5445
  const tableNode = (0, import_table4.$getTableNodeFromLexicalNodeOrThrow)(tableCellNode);
@@ -5343,7 +5458,7 @@ function TableActionMenu({ tableCellNode: _tableCellNode, tableStats }) {
5343
5458
  rootNode.selectStart();
5344
5459
  });
5345
5460
  }, [editor, tableCellNode]);
5346
- const insertTableRowAtSelection = (0, import_react73.useCallback)(
5461
+ const insertTableRowAtSelection = (0, import_react74.useCallback)(
5347
5462
  (shouldInsertAfter) => {
5348
5463
  editor.update(() => {
5349
5464
  const selection = (0, import_lexical14.$getSelection)();
@@ -5362,7 +5477,7 @@ function TableActionMenu({ tableCellNode: _tableCellNode, tableStats }) {
5362
5477
  },
5363
5478
  [editor, tableCellNode, selectionCounts.rows, clearTableSelection]
5364
5479
  );
5365
- const insertTableColumnAtSelection = (0, import_react73.useCallback)(
5480
+ const insertTableColumnAtSelection = (0, import_react74.useCallback)(
5366
5481
  (shouldInsertAfter) => {
5367
5482
  editor.update(() => {
5368
5483
  const selection = (0, import_lexical14.$getSelection)();
@@ -5381,7 +5496,7 @@ function TableActionMenu({ tableCellNode: _tableCellNode, tableStats }) {
5381
5496
  },
5382
5497
  [editor, tableCellNode, selectionCounts.columns, clearTableSelection]
5383
5498
  );
5384
- const deleteTableRowAtSelection = (0, import_react73.useCallback)(() => {
5499
+ const deleteTableRowAtSelection = (0, import_react74.useCallback)(() => {
5385
5500
  editor.update(() => {
5386
5501
  const tableNode = (0, import_table4.$getTableNodeFromLexicalNodeOrThrow)(tableCellNode);
5387
5502
  const tableRowIndex = (0, import_table4.$getTableRowIndexFromTableCellNode)(tableCellNode);
@@ -5389,14 +5504,14 @@ function TableActionMenu({ tableCellNode: _tableCellNode, tableStats }) {
5389
5504
  clearTableSelection();
5390
5505
  });
5391
5506
  }, [editor, tableCellNode, clearTableSelection]);
5392
- const deleteTableAtSelection = (0, import_react73.useCallback)(() => {
5507
+ const deleteTableAtSelection = (0, import_react74.useCallback)(() => {
5393
5508
  editor.update(() => {
5394
5509
  const tableNode = (0, import_table4.$getTableNodeFromLexicalNodeOrThrow)(tableCellNode);
5395
5510
  tableNode.remove();
5396
5511
  clearTableSelection();
5397
5512
  });
5398
5513
  }, [editor, tableCellNode, clearTableSelection]);
5399
- const deleteTableColumnAtSelection = (0, import_react73.useCallback)(() => {
5514
+ const deleteTableColumnAtSelection = (0, import_react74.useCallback)(() => {
5400
5515
  editor.update(() => {
5401
5516
  const tableNode = (0, import_table4.$getTableNodeFromLexicalNodeOrThrow)(tableCellNode);
5402
5517
  const tableColumnIndex = (0, import_table4.$getTableColumnIndexFromTableCellNode)(tableCellNode);
@@ -5404,7 +5519,7 @@ function TableActionMenu({ tableCellNode: _tableCellNode, tableStats }) {
5404
5519
  clearTableSelection();
5405
5520
  });
5406
5521
  }, [editor, tableCellNode, clearTableSelection]);
5407
- const toggleTableRowIsHeader = (0, import_react73.useCallback)(() => {
5522
+ const toggleTableRowIsHeader = (0, import_react74.useCallback)(() => {
5408
5523
  editor.update(() => {
5409
5524
  const tableNode = (0, import_table4.$getTableNodeFromLexicalNodeOrThrow)(tableCellNode);
5410
5525
  const tableRowIndex = (0, import_table4.$getTableRowIndexFromTableCellNode)(tableCellNode);
@@ -5425,7 +5540,7 @@ function TableActionMenu({ tableCellNode: _tableCellNode, tableStats }) {
5425
5540
  clearTableSelection();
5426
5541
  });
5427
5542
  }, [editor, tableCellNode, clearTableSelection]);
5428
- const toggleTableColumnIsHeader = (0, import_react73.useCallback)(() => {
5543
+ const toggleTableColumnIsHeader = (0, import_react74.useCallback)(() => {
5429
5544
  editor.update(() => {
5430
5545
  const tableNode = (0, import_table4.$getTableNodeFromLexicalNodeOrThrow)(tableCellNode);
5431
5546
  const tableColumnIndex = (0, import_table4.$getTableColumnIndexFromTableCellNode)(tableCellNode);
@@ -5448,78 +5563,60 @@ function TableActionMenu({ tableCellNode: _tableCellNode, tableStats }) {
5448
5563
  clearTableSelection();
5449
5564
  });
5450
5565
  }, [editor, tableCellNode, clearTableSelection]);
5451
- return /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(import_jsx_runtime85.Fragment, {
5566
+ return /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)(import_jsx_runtime86.Fragment, {
5452
5567
  children: [
5453
- /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(DropdownMenu.Item, {
5568
+ /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(DropdownMenu.Item, {
5454
5569
  onSelect: () => insertTableRowAtSelection(false),
5455
- children: [
5456
- "Insert ",
5457
- selectionCounts.rows === 1 ? "row" : `${selectionCounts.rows} rows`,
5458
- " above"
5459
- ]
5570
+ children: tr("actionTableInsertRowsAbove", selectionCounts.rows)
5460
5571
  }),
5461
- /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(DropdownMenu.Item, {
5572
+ /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(DropdownMenu.Item, {
5462
5573
  onSelect: () => insertTableRowAtSelection(true),
5463
- children: [
5464
- "Insert ",
5465
- selectionCounts.rows === 1 ? "row" : `${selectionCounts.rows} rows`,
5466
- " below"
5467
- ]
5574
+ children: tr("actionTableInsertRowsBelow", selectionCounts.rows)
5468
5575
  }),
5469
- /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(DropdownMenu.Item, {
5576
+ /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(DropdownMenu.Item, {
5470
5577
  onSelect: () => insertTableColumnAtSelection(false),
5471
- children: [
5472
- "Insert ",
5473
- selectionCounts.columns === 1 ? "column" : `${selectionCounts.columns} columns`,
5474
- " left"
5475
- ]
5578
+ children: tr("actionTableInsertColumnsBefore", selectionCounts.columns)
5476
5579
  }),
5477
- /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(DropdownMenu.Item, {
5580
+ /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(DropdownMenu.Item, {
5478
5581
  onSelect: () => insertTableColumnAtSelection(true),
5479
- children: [
5480
- "Insert ",
5481
- selectionCounts.columns === 1 ? "column" : `${selectionCounts.columns} columns`,
5482
- " right"
5483
- ]
5582
+ children: tr("actionTableInsertColumnsAfter", selectionCounts.columns)
5484
5583
  }),
5485
- /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(DropdownMenu.Item, {
5584
+ /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(DropdownMenu.Item, {
5486
5585
  onSelect: () => toggleTableRowIsHeader(),
5487
- children: [
5488
- (tableCellNode.__headerState & import_table4.TableCellHeaderStates.ROW) === import_table4.TableCellHeaderStates.ROW ? "Remove" : "Add",
5489
- " row header"
5490
- ]
5586
+ children: tr(
5587
+ (tableCellNode.__headerState & import_table4.TableCellHeaderStates.ROW) === import_table4.TableCellHeaderStates.ROW ? "actionTableRemoveRowHeader" : "actionTableAddRowHeader"
5588
+ )
5491
5589
  }),
5492
- /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(DropdownMenu.Item, {
5590
+ /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(DropdownMenu.Item, {
5493
5591
  onSelect: () => toggleTableColumnIsHeader(),
5494
- children: [
5495
- (tableCellNode.__headerState & import_table4.TableCellHeaderStates.COLUMN) === import_table4.TableCellHeaderStates.COLUMN ? "Remove" : "Add",
5496
- " ",
5497
- "column header"
5498
- ]
5592
+ children: tr(
5593
+ (tableCellNode.__headerState & import_table4.TableCellHeaderStates.COLUMN) === import_table4.TableCellHeaderStates.COLUMN ? "actionTableRemoveColumnHeader" : "actionTableAddColumnHeader"
5594
+ )
5499
5595
  }),
5500
- /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(DropdownMenu.Separator, {}),
5501
- tableStats.columns > 1 && /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(DropdownMenu.Item, {
5596
+ /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(DropdownMenu.Separator, {}),
5597
+ tableStats.columns > 1 && /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(DropdownMenu.Item, {
5502
5598
  onSelect: () => deleteTableColumnAtSelection(),
5503
- children: "Delete column"
5599
+ children: tr("actionTableDeleteColumn")
5504
5600
  }),
5505
- tableStats.rows > 1 && /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(DropdownMenu.Item, {
5601
+ tableStats.rows > 1 && /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(DropdownMenu.Item, {
5506
5602
  onSelect: () => deleteTableRowAtSelection(),
5507
- children: "Delete row"
5603
+ children: tr("actionTableDeleteRow")
5508
5604
  }),
5509
- /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(DropdownMenu.Item, {
5605
+ /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(DropdownMenu.Item, {
5510
5606
  onSelect: () => deleteTableAtSelection(),
5511
- children: "Delete table"
5607
+ children: tr("actionTableDeleteTable")
5512
5608
  })
5513
5609
  ]
5514
5610
  });
5515
5611
  }
5516
5612
  function TableCellActionMenuContainer({ anchorElem }) {
5517
5613
  const [editor] = (0, import_LexicalComposerContext9.useLexicalComposerContext)();
5518
- const menuButtonRef = (0, import_react73.useRef)(null);
5519
- const [isMenuOpen, setIsMenuOpen] = (0, import_react73.useState)(false);
5520
- const [tableCellNode, setTableMenuCellNode] = (0, import_react73.useState)(null);
5521
- const [tableStats, setTablestats] = (0, import_react73.useState)({ rows: 1, columns: 1 });
5522
- const moveMenu = (0, import_react73.useCallback)(() => {
5614
+ const tr = useTr();
5615
+ const menuButtonRef = (0, import_react74.useRef)(null);
5616
+ const [isMenuOpen, setIsMenuOpen] = (0, import_react74.useState)(false);
5617
+ const [tableCellNode, setTableMenuCellNode] = (0, import_react74.useState)(null);
5618
+ const [tableStats, setTablestats] = (0, import_react74.useState)({ rows: 1, columns: 1 });
5619
+ const moveMenu = (0, import_react74.useCallback)(() => {
5523
5620
  if (isMenuOpen) {
5524
5621
  return;
5525
5622
  }
@@ -5562,14 +5659,14 @@ function TableCellActionMenuContainer({ anchorElem }) {
5562
5659
  setTableMenuCellNode(null);
5563
5660
  }
5564
5661
  }, [editor, isMenuOpen]);
5565
- (0, import_react73.useEffect)(() => {
5662
+ (0, import_react74.useEffect)(() => {
5566
5663
  return editor.registerUpdateListener(() => {
5567
5664
  editor.getEditorState().read(() => {
5568
5665
  moveMenu();
5569
5666
  });
5570
5667
  });
5571
5668
  });
5572
- (0, import_react73.useEffect)(() => {
5669
+ (0, import_react74.useEffect)(() => {
5573
5670
  const menuButtonDOM = menuButtonRef.current;
5574
5671
  if (menuButtonDOM != null && tableCellNode != null) {
5575
5672
  const tableCellNodeDOM = editor.getElementByKey(tableCellNode.getKey());
@@ -5587,19 +5684,20 @@ function TableCellActionMenuContainer({ anchorElem }) {
5587
5684
  }
5588
5685
  }
5589
5686
  }, [menuButtonRef, tableCellNode, editor, anchorElem]);
5590
- return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("div", {
5687
+ return /* @__PURE__ */ (0, import_jsx_runtime86.jsx)("div", {
5591
5688
  className: "table-cell-action-button-container",
5592
5689
  ref: menuButtonRef,
5593
- children: tableCellNode != null && /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(DropdownMenu.Root, {
5690
+ children: tableCellNode != null && /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(DropdownMenu.Root, {
5594
5691
  onOpenChange: (isOpen) => setIsMenuOpen(isOpen),
5595
- content: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(TableActionMenu, {
5692
+ content: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(TableActionMenu, {
5596
5693
  tableCellNode,
5597
5694
  tableStats
5598
5695
  }),
5599
- children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(IconButton, {
5696
+ children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(IconButton, {
5600
5697
  size: "xs",
5601
5698
  className: "table-cell-action-button",
5602
- children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(Icon.Arrow, {})
5699
+ "aria-label": tr("actionTableOpenOptions"),
5700
+ children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(Icon.Arrow, {})
5603
5701
  })
5604
5702
  })
5605
5703
  });
@@ -5608,13 +5706,13 @@ function TableActionMenuPlugin({
5608
5706
  anchorElem = document.body
5609
5707
  }) {
5610
5708
  const isEditable = (0, import_useLexicalEditable.default)();
5611
- return (0, import_react_dom5.createPortal)(isEditable ? /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(TableCellActionMenuContainer, {
5709
+ return (0, import_react_dom5.createPortal)(isEditable ? /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(TableCellActionMenuContainer, {
5612
5710
  anchorElem
5613
5711
  }) : null, anchorElem);
5614
5712
  }
5615
5713
 
5616
5714
  // src/rich-text-editor/plugins/ToolbarPlugin/index.tsx
5617
- var import_react75 = require("react");
5715
+ var import_react76 = require("react");
5618
5716
  var import_lexical16 = require("lexical");
5619
5717
  var import_code9 = require("@lexical/code");
5620
5718
  var import_link6 = require("@lexical/link");
@@ -5626,13 +5724,10 @@ var import_rich_text4 = require("@lexical/rich-text");
5626
5724
  var import_selection3 = require("@lexical/selection");
5627
5725
  var import_utils4 = require("@lexical/utils");
5628
5726
 
5629
- // src/rich-text-editor/utils/environment.ts
5630
- var IS_APPLE = typeof navigator !== "undefined" && /Mac|iPod|iPhone|iPad/.test(navigator.platform);
5631
-
5632
5727
  // src/rich-text-editor/plugins/ActionsPlugin/index.tsx
5633
5728
  var import_lexical15 = require("lexical");
5634
5729
  var import_LexicalComposerContext10 = require("@lexical/react/LexicalComposerContext");
5635
- var import_jsx_runtime86 = require("react/jsx-runtime");
5730
+ var import_jsx_runtime87 = require("react/jsx-runtime");
5636
5731
  async function copyJson(editor) {
5637
5732
  const json = lexicalToCrystallizeRichText({ editor, editorState: editor.getEditorState() });
5638
5733
  try {
@@ -5641,53 +5736,36 @@ async function copyJson(editor) {
5641
5736
  console.warn("Copy failed", error);
5642
5737
  }
5643
5738
  }
5644
- async function exportJson(editor) {
5645
- const json = lexicalToCrystallizeRichText({ editorState: editor.getEditorState() });
5646
- const blob = new Blob([JSON.stringify(json, null, 1)], {
5647
- type: "application/json"
5648
- });
5649
- const href = URL.createObjectURL(blob);
5650
- const link = document.createElement("a");
5651
- link.href = href;
5652
- link.download = "crystallizeRichText.json";
5653
- document.body.appendChild(link);
5654
- link.click();
5655
- document.body.removeChild(link);
5656
- URL.revokeObjectURL(href);
5657
- }
5658
5739
  function ActionsPlugin({
5659
5740
  append,
5660
5741
  prepend
5661
5742
  }) {
5662
5743
  const [editor] = (0, import_LexicalComposerContext10.useLexicalComposerContext)();
5663
- return /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("div", {
5744
+ const tr = useTr();
5745
+ return /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("div", {
5664
5746
  className: "z-50 flex items-center ",
5665
5747
  children: [
5666
- /* @__PURE__ */ (0, import_jsx_runtime86.jsx)("div", {}),
5667
- /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)(ActionMenu, {
5748
+ /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("div", {}),
5749
+ /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)(ActionMenu, {
5668
5750
  children: [
5669
- !prepend ? null : prepend.map((actionItem) => /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(ActionMenu.Item, {
5751
+ !prepend ? null : prepend.map((actionItem) => /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(ActionMenu.Item, {
5670
5752
  onSelect: actionItem.action,
5671
5753
  className: actionItem.type === "danger" ? "danger" : "",
5672
5754
  children: actionItem.title
5673
5755
  }, actionItem.title)),
5674
- /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(ActionMenu.Item, {
5756
+ /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(ActionMenu.Item, {
5675
5757
  onSelect: () => copyJson(editor),
5676
- children: "Copy JSON"
5758
+ children: tr("actionCopyJSON")
5677
5759
  }),
5678
- /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(ActionMenu.Item, {
5679
- onSelect: () => exportJson(editor),
5680
- children: "Export JSON"
5681
- }),
5682
- /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(ActionMenu.Item, {
5760
+ /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(ActionMenu.Item, {
5683
5761
  className: "danger",
5684
5762
  onSelect: () => {
5685
5763
  editor.dispatchCommand(import_lexical15.CLEAR_EDITOR_COMMAND, void 0);
5686
5764
  editor.focus();
5687
5765
  },
5688
- children: "Clear paragraph"
5766
+ children: tr("actionClear")
5689
5767
  }),
5690
- !append ? null : append.map((actionItem) => /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(ActionMenu.Item, {
5768
+ !append ? null : append.map((actionItem) => /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(ActionMenu.Item, {
5691
5769
  onSelect: actionItem.action,
5692
5770
  className: actionItem.type === "danger" ? "danger" : "",
5693
5771
  children: actionItem.title
@@ -5699,12 +5777,13 @@ function ActionsPlugin({
5699
5777
  }
5700
5778
 
5701
5779
  // src/rich-text-editor/plugins/ToolbarPlugin/insert-table.tsx
5702
- var import_react74 = require("react");
5780
+ var import_react75 = require("react");
5703
5781
  var import_table5 = require("@lexical/table");
5704
- var import_jsx_runtime87 = require("react/jsx-runtime");
5782
+ var import_jsx_runtime88 = require("react/jsx-runtime");
5705
5783
  function InsertTableDialog({ activeEditor }) {
5706
- const [rows, setRows] = (0, import_react74.useState)("5");
5707
- const [columns, setColumns] = (0, import_react74.useState)("5");
5784
+ const [rows, setRows] = (0, import_react75.useState)("5");
5785
+ const [columns, setColumns] = (0, import_react75.useState)("5");
5786
+ const tr = useTr();
5708
5787
  const onClick = () => {
5709
5788
  if (parseInt(rows) < 1 || parseInt(columns) < 1) {
5710
5789
  return;
@@ -5718,25 +5797,25 @@ function InsertTableDialog({ activeEditor }) {
5718
5797
  }
5719
5798
  });
5720
5799
  };
5721
- return /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)(import_jsx_runtime87.Fragment, {
5800
+ return /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)(import_jsx_runtime88.Fragment, {
5722
5801
  children: [
5723
- /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("div", {
5802
+ /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("div", {
5724
5803
  className: "grid grid-cols-[1fr_1px_1fr] border border-gray-100-800 border-solid shadow-sm rounded-md ",
5725
5804
  children: [
5726
- /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(InputWithLabel, {
5727
- label: "Rows",
5805
+ /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(InputWithLabel, {
5806
+ label: tr("insertTableRows"),
5728
5807
  value: rows,
5729
5808
  placeholder: "0",
5730
5809
  type: "text",
5731
5810
  inputMode: "numeric",
5732
5811
  onChange: (e) => setRows(e.target.value)
5733
5812
  }),
5734
- /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("span", {
5813
+ /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("span", {
5735
5814
  className: "h-full bg-gray-100-800"
5736
5815
  }),
5737
- /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(InputWithLabel, {
5816
+ /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(InputWithLabel, {
5738
5817
  type: "text",
5739
- label: "Columns",
5818
+ label: tr("insertTableColumns"),
5740
5819
  placeholder: "0",
5741
5820
  value: columns,
5742
5821
  inputMode: "numeric",
@@ -5744,15 +5823,15 @@ function InsertTableDialog({ activeEditor }) {
5744
5823
  })
5745
5824
  ]
5746
5825
  }),
5747
- /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("div", {
5826
+ /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("div", {
5748
5827
  className: "flex justify-end mt-3",
5749
- children: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(Button, {
5828
+ children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(Button, {
5750
5829
  as: Dialog.Close,
5751
5830
  size: "sm",
5752
5831
  intent: "action",
5753
- "aria-label": "Confirm",
5832
+ "aria-label": tr("insertTableCommit"),
5754
5833
  onClick,
5755
- children: "Confirm"
5834
+ children: tr("insertTableCommit")
5756
5835
  })
5757
5836
  })
5758
5837
  ]
@@ -5760,7 +5839,7 @@ function InsertTableDialog({ activeEditor }) {
5760
5839
  }
5761
5840
 
5762
5841
  // src/rich-text-editor/plugins/ToolbarPlugin/index.tsx
5763
- var import_jsx_runtime88 = require("react/jsx-runtime");
5842
+ var import_jsx_runtime89 = require("react/jsx-runtime");
5764
5843
  var headingTypeToBlockName = {
5765
5844
  h1: "Heading 1",
5766
5845
  h2: "Heading 2",
@@ -5864,83 +5943,83 @@ function BlockFormatDropDown({
5864
5943
  });
5865
5944
  }
5866
5945
  };
5867
- return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(DropdownMenu.Root, {
5946
+ return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(DropdownMenu.Root, {
5868
5947
  disabled,
5869
5948
  style: { zIndex: 1 },
5870
- content: /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)(import_jsx_runtime88.Fragment, {
5949
+ content: /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)(import_jsx_runtime89.Fragment, {
5871
5950
  children: [
5872
- /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)(DropdownMenu.Item, {
5951
+ /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)(DropdownMenu.Item, {
5873
5952
  onClick: formatParagraph,
5874
5953
  children: [
5875
- /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("i", {
5954
+ /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("i", {
5876
5955
  className: `icon paragraph border w-6 h-6 rounded-md bg-no-repeat bg-center bg-[length:18px_18px] ${blockType === "paragraph" ? "opacity-100 bg-purple-50-900" : "opacity-60"}`
5877
5956
  }),
5878
- /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("i", {
5957
+ /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("i", {
5879
5958
  className: "icon paragraph"
5880
5959
  }),
5881
- /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("span", {
5960
+ /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("span", {
5882
5961
  className: `${blockType === "paragraph" ? "font-bold" : "font-normal"} text-sm px-3 min-w-[150px]`,
5883
5962
  children: "Normal"
5884
5963
  })
5885
5964
  ]
5886
5965
  }),
5887
- headings.map((headingSize) => /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)(DropdownMenu.Item, {
5966
+ headings.map((headingSize) => /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)(DropdownMenu.Item, {
5888
5967
  onClick: () => formatHeading(headingSize),
5889
5968
  children: [
5890
- /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("i", {
5969
+ /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("i", {
5891
5970
  className: `icon ${headingSize} border w-6 h-6 rounded-md bg-no-repeat bg-center bg-[length:18px_18px] ${blockType === headingSize ? "opacity-100 bg-purple-50-900" : "opacity-60"}`
5892
5971
  }),
5893
- /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("span", {
5972
+ /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("span", {
5894
5973
  className: `${blockType === headingSize ? "font-bold" : "font-normal"} text-sm px-3 min-w-[150px]`,
5895
5974
  children: headingTypeToBlockName[headingSize]
5896
5975
  })
5897
5976
  ]
5898
5977
  }, headingSize)),
5899
- /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)(DropdownMenu.Item, {
5978
+ /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)(DropdownMenu.Item, {
5900
5979
  onClick: formatBulletList,
5901
5980
  children: [
5902
- /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("i", {
5981
+ /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("i", {
5903
5982
  className: `icon bullet-list border w-6 h-6 rounded-md bg-no-repeat bg-center bg-[length:18px_18px] ${blockType === "bullet" ? "opacity-100 bg-purple-50-900" : "opacity-60"}`
5904
5983
  }),
5905
- /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("span", {
5984
+ /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("span", {
5906
5985
  className: `${blockType === "bullet" ? "font-bold" : "font-normal"} text-sm px-3 min-w-[150px]`,
5907
5986
  children: "Bullet List"
5908
5987
  })
5909
5988
  ]
5910
5989
  }),
5911
- /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)(DropdownMenu.Item, {
5990
+ /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)(DropdownMenu.Item, {
5912
5991
  onClick: formatNumberedList,
5913
5992
  children: [
5914
- /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("i", {
5993
+ /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("i", {
5915
5994
  className: `icon numbered-list border w-6 h-6 rounded-md bg-no-repeat bg-center bg-[length:18px_18px] ${blockType === "number" ? "opacity-100 bg-purple-50-900" : "opacity-60"}`
5916
5995
  }),
5917
- /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("span", {
5996
+ /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("span", {
5918
5997
  className: `${blockType === "number" ? "font-bold" : "font-normal"} text-sm px-3 min-w-[150px]`,
5919
5998
  children: "Numbered List"
5920
5999
  })
5921
6000
  ]
5922
6001
  }),
5923
- /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)(DropdownMenu.Item, {
6002
+ /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)(DropdownMenu.Item, {
5924
6003
  onClick: formatQuote,
5925
6004
  "data-testid": "toggle-block-format-quote",
5926
6005
  children: [
5927
- /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("i", {
6006
+ /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("i", {
5928
6007
  className: `icon quote border w-6 h-6 rounded-md bg-no-repeat bg-center bg-[length:18px_18px] ${blockType === "quote" ? "opacity-100 bg-purple-50-900" : "opacity-60"}`
5929
6008
  }),
5930
- /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("span", {
6009
+ /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("span", {
5931
6010
  className: `${blockType === "quote" ? "font-bold" : "font-normal"} text-sm px-3 min-w-[150px]`,
5932
6011
  children: "Quote"
5933
6012
  })
5934
6013
  ]
5935
6014
  }),
5936
- /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)(DropdownMenu.Item, {
6015
+ /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)(DropdownMenu.Item, {
5937
6016
  onClick: formatCode,
5938
6017
  "data-testid": "toggle-block-format-code",
5939
6018
  children: [
5940
- /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("i", {
6019
+ /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("i", {
5941
6020
  className: `icon code border w-6 h-6 rounded-md bg-no-repeat bg-center bg-[length:18px_18px] ${blockType === "code" ? "opacity-100 bg-purple-50-900" : "opacity-60"}`
5942
6021
  }),
5943
- /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("span", {
6022
+ /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("span", {
5944
6023
  className: `${blockType === "code" ? "font-bold" : "font-normal"} text-sm px-3 min-w-[150px]`,
5945
6024
  children: "Code block"
5946
6025
  })
@@ -5948,21 +6027,21 @@ function BlockFormatDropDown({
5948
6027
  })
5949
6028
  ]
5950
6029
  }),
5951
- children: /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)(Button, {
6030
+ children: /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)(Button, {
5952
6031
  style: { backgroundColor: "transparent", padding: "0 8px" },
5953
6032
  "aria-label": "Formatting options for text style",
5954
6033
  "data-testid": "toggle-block-format",
5955
6034
  children: [
5956
- /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("i", {
6035
+ /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("i", {
5957
6036
  className: `icon ${blockType} border bg-no-repeat bg-center bg-[length:18px_18px] w-6 h-6`
5958
6037
  }),
5959
- /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(Icon.Arrow, {})
6038
+ /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(Icon.Arrow, {})
5960
6039
  ]
5961
6040
  })
5962
6041
  });
5963
6042
  }
5964
6043
  function Divider() {
5965
- return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("div", {
6044
+ return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("div", {
5966
6045
  className: "divider"
5967
6046
  });
5968
6047
  }
@@ -5971,22 +6050,23 @@ function ToolbarPlugin({
5971
6050
  actionsMenuAppend
5972
6051
  }) {
5973
6052
  const [editor] = (0, import_LexicalComposerContext11.useLexicalComposerContext)();
5974
- const [activeEditor, setActiveEditor] = (0, import_react75.useState)(editor);
5975
- const [blockType, setBlockType] = (0, import_react75.useState)("paragraph");
5976
- const [selectedElementKey, setSelectedElementKey] = (0, import_react75.useState)(null);
5977
- const [isLink, setIsLink] = (0, import_react75.useState)(false);
5978
- const [isBold, setIsBold] = (0, import_react75.useState)(false);
5979
- const [isItalic, setIsItalic] = (0, import_react75.useState)(false);
5980
- const [isUnderline, setIsUnderline] = (0, import_react75.useState)(false);
5981
- const [isStrikethrough, setIsStrikethrough] = (0, import_react75.useState)(false);
5982
- const [isSubscript, setIsSubscript] = (0, import_react75.useState)(false);
5983
- const [isSuperscript, setIsSuperscript] = (0, import_react75.useState)(false);
5984
- const [isCode, setIsCode] = (0, import_react75.useState)(false);
5985
- const [canUndo, setCanUndo] = (0, import_react75.useState)(false);
5986
- const [canRedo, setCanRedo] = (0, import_react75.useState)(false);
5987
- const [codeLanguage, setCodeLanguage] = (0, import_react75.useState)("");
5988
- const [isEditable, setIsEditable] = (0, import_react75.useState)(() => editor.isEditable());
5989
- const updateToolbar = (0, import_react75.useCallback)(() => {
6053
+ const [activeEditor, setActiveEditor] = (0, import_react76.useState)(editor);
6054
+ const [blockType, setBlockType] = (0, import_react76.useState)("paragraph");
6055
+ const [selectedElementKey, setSelectedElementKey] = (0, import_react76.useState)(null);
6056
+ const [isLink, setIsLink] = (0, import_react76.useState)(false);
6057
+ const [isBold, setIsBold] = (0, import_react76.useState)(false);
6058
+ const [isItalic, setIsItalic] = (0, import_react76.useState)(false);
6059
+ const [isUnderline, setIsUnderline] = (0, import_react76.useState)(false);
6060
+ const [isStrikethrough, setIsStrikethrough] = (0, import_react76.useState)(false);
6061
+ const [isSubscript, setIsSubscript] = (0, import_react76.useState)(false);
6062
+ const [isSuperscript, setIsSuperscript] = (0, import_react76.useState)(false);
6063
+ const [isCode, setIsCode] = (0, import_react76.useState)(false);
6064
+ const [canUndo, setCanUndo] = (0, import_react76.useState)(false);
6065
+ const [canRedo, setCanRedo] = (0, import_react76.useState)(false);
6066
+ const tr = useTr();
6067
+ const [codeLanguage, setCodeLanguage] = (0, import_react76.useState)("");
6068
+ const [isEditable, setIsEditable] = (0, import_react76.useState)(() => editor.isEditable());
6069
+ const updateToolbar = (0, import_react76.useCallback)(() => {
5990
6070
  const selection = (0, import_lexical16.$getSelection)();
5991
6071
  if ((0, import_lexical16.$isRangeSelection)(selection)) {
5992
6072
  const anchorNode = selection.anchor.getNode();
@@ -6033,7 +6113,7 @@ function ToolbarPlugin({
6033
6113
  }
6034
6114
  }
6035
6115
  }, [activeEditor]);
6036
- (0, import_react75.useEffect)(() => {
6116
+ (0, import_react76.useEffect)(() => {
6037
6117
  return editor.registerCommand(
6038
6118
  import_lexical16.SELECTION_CHANGE_COMMAND,
6039
6119
  (_payload, newEditor) => {
@@ -6044,7 +6124,7 @@ function ToolbarPlugin({
6044
6124
  import_lexical16.COMMAND_PRIORITY_CRITICAL
6045
6125
  );
6046
6126
  }, [editor, updateToolbar]);
6047
- (0, import_react75.useEffect)(() => {
6127
+ (0, import_react76.useEffect)(() => {
6048
6128
  return (0, import_utils4.mergeRegister)(
6049
6129
  editor.registerEditableListener((editable) => {
6050
6130
  setIsEditable(editable);
@@ -6072,7 +6152,7 @@ function ToolbarPlugin({
6072
6152
  )
6073
6153
  );
6074
6154
  }, [activeEditor, editor, updateToolbar]);
6075
- const clearFormatting = (0, import_react75.useCallback)(() => {
6155
+ const clearFormatting = (0, import_react76.useCallback)(() => {
6076
6156
  activeEditor.update(() => {
6077
6157
  const selection = (0, import_lexical16.$getSelection)();
6078
6158
  if ((0, import_lexical16.$isRangeSelection)(selection)) {
@@ -6090,14 +6170,14 @@ function ToolbarPlugin({
6090
6170
  }
6091
6171
  });
6092
6172
  }, [activeEditor]);
6093
- const insertLink = (0, import_react75.useCallback)(() => {
6173
+ const insertLink = (0, import_react76.useCallback)(() => {
6094
6174
  if (!isLink) {
6095
6175
  editor.dispatchCommand(import_link6.TOGGLE_LINK_COMMAND, sanitizeUrl("https://"));
6096
6176
  } else {
6097
6177
  editor.dispatchCommand(import_link6.TOGGLE_LINK_COMMAND, null);
6098
6178
  }
6099
6179
  }, [editor, isLink]);
6100
- const onCodeLanguageSelect = (0, import_react75.useCallback)(
6180
+ const onCodeLanguageSelect = (0, import_react76.useCallback)(
6101
6181
  (value) => {
6102
6182
  activeEditor.update(() => {
6103
6183
  if (selectedElementKey !== null) {
@@ -6110,206 +6190,206 @@ function ToolbarPlugin({
6110
6190
  },
6111
6191
  [activeEditor, selectedElementKey]
6112
6192
  );
6113
- return /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("div", {
6193
+ return /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("div", {
6114
6194
  className: "toolbar",
6115
6195
  children: [
6116
- /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("div", {
6196
+ /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("div", {
6117
6197
  className: "flex",
6118
6198
  children: [
6119
- /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(IconButton, {
6199
+ /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(IconButton, {
6120
6200
  disabled: !canUndo || !isEditable,
6121
6201
  onClick: () => {
6122
6202
  activeEditor.dispatchCommand(import_lexical16.UNDO_COMMAND, void 0);
6123
6203
  },
6124
- title: IS_APPLE ? "Undo (\u2318Z)" : "Undo (Ctrl+Z)",
6125
6204
  type: "button",
6126
- "aria-label": "Undo",
6127
- children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("i", {
6205
+ title: tr(IS_APPLE ? "actionUndoTitleApple" : "actionUndoTitle"),
6206
+ "aria-label": tr("actionUndoLabel"),
6207
+ children: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("i", {
6128
6208
  className: `format icon undo border w-4 h-6 bg-no-repeat bg-center bg-[length:17px_17px] ${canUndo ? "opacity-100" : "opacity-30"}
6129
6209
  `
6130
6210
  })
6131
6211
  }),
6132
- /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(IconButton, {
6212
+ /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(IconButton, {
6133
6213
  disabled: !canRedo || !isEditable,
6134
6214
  onClick: () => {
6135
6215
  activeEditor.dispatchCommand(import_lexical16.REDO_COMMAND, void 0);
6136
6216
  },
6137
- title: IS_APPLE ? "Redo (\u2318Y)" : "Redo (Ctrl+Y)",
6138
6217
  type: "button",
6139
- "aria-label": "Redo",
6140
- children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("i", {
6218
+ title: tr(IS_APPLE ? "actionRedoTitleApple" : "actionRedoTitle"),
6219
+ "aria-label": tr("actionRedoLabel"),
6220
+ children: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("i", {
6141
6221
  className: `format icon redo border w-4 h-6 bg-no-repeat bg-center bg-[length:17px_17px] ${canRedo ? "opacity-100" : "opacity-30"}`
6142
6222
  })
6143
6223
  }),
6144
- /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(Divider, {}),
6145
- blockType in blockTypeToBlockName && activeEditor === editor && /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)(import_jsx_runtime88.Fragment, {
6224
+ /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(Divider, {}),
6225
+ blockType in blockTypeToBlockName && activeEditor === editor && /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)(import_jsx_runtime89.Fragment, {
6146
6226
  children: [
6147
- /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(BlockFormatDropDown, {
6227
+ /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(BlockFormatDropDown, {
6148
6228
  disabled: !isEditable,
6149
6229
  blockType,
6150
6230
  editor
6151
6231
  }),
6152
- /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(Divider, {})
6232
+ /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(Divider, {})
6153
6233
  ]
6154
6234
  }),
6155
- blockType === "code" ? /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(import_jsx_runtime88.Fragment, {
6156
- children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(DropdownMenu.Root, {
6235
+ blockType === "code" ? /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(import_jsx_runtime89.Fragment, {
6236
+ children: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(DropdownMenu.Root, {
6157
6237
  disabled: !isEditable,
6158
6238
  style: { zIndex: 1 },
6159
- content: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(import_jsx_runtime88.Fragment, {
6239
+ content: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(import_jsx_runtime89.Fragment, {
6160
6240
  children: CODE_LANGUAGE_OPTIONS.map(([value, name]) => {
6161
- return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(DropdownMenu.Item, {
6241
+ return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(DropdownMenu.Item, {
6162
6242
  className: `item ${dropDownActiveClass(value === codeLanguage)}`,
6163
6243
  onClick: () => onCodeLanguageSelect(value),
6164
- children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("span", {
6244
+ children: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("span", {
6165
6245
  className: `text min-w-[200px] block text-sm px-3 ${dropDownActiveClass(value === codeLanguage) ? "font-bold opacity-100" : "font-normal opacity-80"}`,
6166
6246
  children: name
6167
6247
  })
6168
6248
  }, value);
6169
6249
  })
6170
6250
  }),
6171
- children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(Button, {
6172
- "aria-label": "Select language",
6173
- append: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(Icon.Arrow, {}),
6174
- children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("span", {
6251
+ children: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(Button, {
6252
+ "aria-label": tr("codeSelectLanguage"),
6253
+ append: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(Icon.Arrow, {}),
6254
+ children: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("span", {
6175
6255
  className: "font-medium text-sm",
6176
6256
  children: (0, import_code9.getLanguageFriendlyName)(codeLanguage)
6177
6257
  })
6178
6258
  })
6179
6259
  })
6180
- }) : /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(Dialog, {
6181
- children: /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("div", {
6260
+ }) : /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(Dialog, {
6261
+ children: /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("div", {
6182
6262
  className: "flex gap-1",
6183
6263
  children: [
6184
- /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(IconButton, {
6264
+ /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(IconButton, {
6185
6265
  disabled: !isEditable,
6186
- title: IS_APPLE ? "Bold (\u2318B)" : "Bold (Ctrl+B)",
6187
6266
  className: `${isBold ? "opacity-100 !bg-purple-50-900" : "opacity-60"}`,
6188
6267
  type: "button",
6189
- "aria-label": `Format text as bold. Shortcut: ${IS_APPLE ? "\u2318B" : "Ctrl+B"}`,
6268
+ title: tr(IS_APPLE ? "actionFormatAsStrongTitleApple" : "actionFormatAsStrongTitle"),
6269
+ "aria-label": tr("actionFormatAsStrongLabel"),
6190
6270
  "data-testid": "toggle-format-bold",
6191
6271
  onClick: () => {
6192
6272
  activeEditor.dispatchCommand(import_lexical16.FORMAT_TEXT_COMMAND, "bold");
6193
6273
  },
6194
- children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("i", {
6274
+ children: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("i", {
6195
6275
  className: `format icon bold border w-full h-full bg-no-repeat bg-center bg-[length:18px_18px]`
6196
6276
  })
6197
6277
  }),
6198
- /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(IconButton, {
6278
+ /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(IconButton, {
6199
6279
  className: `${isItalic ? "opacity-100 !bg-purple-50-900" : "opacity-60"}`,
6200
6280
  disabled: !isEditable,
6201
6281
  onClick: () => {
6202
6282
  activeEditor.dispatchCommand(import_lexical16.FORMAT_TEXT_COMMAND, "italic");
6203
6283
  },
6204
- title: IS_APPLE ? "Italic (\u2318I)" : "Italic (Ctrl+I)",
6205
6284
  type: "button",
6206
- "aria-label": `Format text as italics. Shortcut: ${IS_APPLE ? "\u2318I" : "Ctrl+I"}`,
6285
+ title: tr(IS_APPLE ? "actionFormatAsEmphasizedTitleApple" : "actionFormatAsEmphasizedTitle"),
6286
+ "aria-label": tr("actionFormatAsEmphasizedLabel"),
6207
6287
  "data-testid": "toggle-format-emphasized",
6208
- children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("i", {
6288
+ children: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("i", {
6209
6289
  className: `format icon italic border w-full h-full bg-no-repeat bg-center bg-[length:18px_18px]`
6210
6290
  })
6211
6291
  }),
6212
- /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(IconButton, {
6292
+ /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(IconButton, {
6213
6293
  className: `${isUnderline ? "opacity-100 !bg-purple-50-900" : "opacity-60"}`,
6214
6294
  disabled: !isEditable,
6215
6295
  onClick: () => {
6216
6296
  activeEditor.dispatchCommand(import_lexical16.FORMAT_TEXT_COMMAND, "underline");
6217
6297
  },
6218
- title: IS_APPLE ? "Underline (\u2318U)" : "Underline (Ctrl+U)",
6219
6298
  type: "button",
6220
- "aria-label": `Format text to underlined. Shortcut: ${IS_APPLE ? "\u2318U" : "Ctrl+U"}`,
6299
+ title: tr(IS_APPLE ? "actionFormatAsUnderlinedTitleApple" : "actionFormatAsUnderlinedTitle"),
6300
+ "aria-label": tr("actionFormatAsUnderlinedLabel"),
6221
6301
  "data-testid": "toggle-format-underlined",
6222
- children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("i", {
6302
+ children: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("i", {
6223
6303
  className: `format icon underline border w-full h-full bg-no-repeat bg-center bg-[length:18px_18px]`
6224
6304
  })
6225
6305
  }),
6226
- /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(IconButton, {
6306
+ /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(IconButton, {
6227
6307
  className: `${isCode ? "opacity-100 !bg-purple-50-900" : "opacity-60"}`,
6228
6308
  disabled: !isEditable,
6229
6309
  onClick: () => {
6230
6310
  activeEditor.dispatchCommand(import_lexical16.FORMAT_TEXT_COMMAND, "code");
6231
6311
  },
6232
- title: "Insert code block",
6233
6312
  type: "button",
6234
- "aria-label": "Insert code block",
6235
- children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("i", {
6313
+ title: tr("actionInsertCodeBlock"),
6314
+ "aria-label": tr("actionInsertCodeBlock"),
6315
+ children: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("i", {
6236
6316
  className: `format icon code border w-full h-full bg-no-repeat bg-center bg-[length:18px_18px]`
6237
6317
  })
6238
6318
  }),
6239
- /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(IconButton, {
6319
+ /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(IconButton, {
6240
6320
  className: `${isLink ? "opacity-100 !bg-purple-50-900" : "opacity-60"}`,
6241
6321
  disabled: !isEditable,
6242
6322
  onClick: insertLink,
6243
- "aria-label": "Insert link",
6244
- title: "Insert link",
6245
6323
  type: "button",
6246
- children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("i", {
6324
+ "aria-label": tr("actionInsertlink"),
6325
+ title: tr("actionInsertlink"),
6326
+ children: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("i", {
6247
6327
  className: `format icon link border w-full h-full bg-no-repeat bg-center bg-[length:18px_18px]`
6248
6328
  })
6249
6329
  }),
6250
- /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(DropdownMenu.Root, {
6330
+ /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(DropdownMenu.Root, {
6251
6331
  disabled: !isEditable,
6252
6332
  style: { zIndex: 1 },
6253
- content: /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)(import_jsx_runtime88.Fragment, {
6333
+ content: /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)(import_jsx_runtime89.Fragment, {
6254
6334
  children: [
6255
- /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)(DropdownMenu.Item, {
6335
+ /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)(DropdownMenu.Item, {
6256
6336
  onClick: () => {
6257
6337
  activeEditor.dispatchCommand(import_lexical16.FORMAT_TEXT_COMMAND, "strikethrough");
6258
6338
  },
6259
- title: "Strikethrough",
6260
- "aria-label": "Format text with a strikethrough",
6339
+ title: tr("actionFormatWithStrikethroughTitle"),
6340
+ "aria-label": tr("actionFormatWithStrikethroughLabel"),
6261
6341
  children: [
6262
- /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("i", {
6342
+ /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("i", {
6263
6343
  className: `icon w-6 h-6 strikethrough border bg-no-repeat bg-center bg-[length:16px_16px] rounded-sm ${isStrikethrough ? "opacity-100 !bg-purple-50-900" : "opacity-60"}`
6264
6344
  }),
6265
- /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("span", {
6345
+ /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("span", {
6266
6346
  className: `px-3 text-sm font-sans ${isStrikethrough ? "font-medium" : "font-normal"}`,
6267
- children: "Strikethrough"
6347
+ children: tr("actionFormatAsStrongTitle")
6268
6348
  })
6269
6349
  ]
6270
6350
  }),
6271
- /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)(DropdownMenu.Item, {
6351
+ /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)(DropdownMenu.Item, {
6272
6352
  onClick: () => {
6273
6353
  activeEditor.dispatchCommand(import_lexical16.FORMAT_TEXT_COMMAND, "subscript");
6274
6354
  },
6275
- title: "Subscript",
6276
- "aria-label": "Format text with a subscript",
6355
+ title: tr("actionFormatWithSubscriptTitle"),
6356
+ "aria-label": tr("actionFormatWithSubscriptLabel"),
6277
6357
  children: [
6278
- /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("i", {
6358
+ /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("i", {
6279
6359
  className: `icon w-6 h-6 subscript border bg-no-repeat bg-center bg-[length:16px_16px] rounded-sm ${isSubscript ? "opacity-100 !bg-purple-50-900" : "opacity-60"}`
6280
6360
  }),
6281
- /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("span", {
6361
+ /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("span", {
6282
6362
  className: `px-3 text-sm font-sans ${isSubscript ? "font-medium" : "font-normal"}`,
6283
- children: "Subscript"
6363
+ children: tr("actionFormatWithSubscriptTitle")
6284
6364
  })
6285
6365
  ]
6286
6366
  }),
6287
- /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)(DropdownMenu.Item, {
6367
+ /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)(DropdownMenu.Item, {
6288
6368
  onClick: () => {
6289
6369
  activeEditor.dispatchCommand(import_lexical16.FORMAT_TEXT_COMMAND, "superscript");
6290
6370
  },
6291
- title: "Superscript",
6292
- "aria-label": "Format text with a superscript",
6371
+ title: tr("actionFormatWithSuperscriptTitle"),
6372
+ "aria-label": tr("actionFormatWithSuperscriptLabel"),
6293
6373
  children: [
6294
- /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("i", {
6374
+ /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("i", {
6295
6375
  className: `icon w-6 h-6 superscript border bg-no-repeat bg-center bg-[length:16px_16px] rounded-sm ${isSuperscript ? "opacity-100 !bg-purple-50-900" : "opacity-60"}`
6296
6376
  }),
6297
- /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("span", {
6377
+ /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("span", {
6298
6378
  className: `px-3 text-sm font-sans ${isSuperscript ? "bg-purple-50-900" : "font-normal"}`,
6299
- children: "Superscript"
6379
+ children: tr("actionFormatWithSuperscriptTitle")
6300
6380
  })
6301
6381
  ]
6302
6382
  }),
6303
- /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)(DropdownMenu.Item, {
6383
+ /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)(DropdownMenu.Item, {
6304
6384
  onClick: clearFormatting,
6305
6385
  className: "item",
6306
- title: "Clear text formatting",
6307
- "aria-label": "Clear all text formatting",
6386
+ title: tr("actionClearTextFormatting"),
6387
+ "aria-label": tr("actionClearTextFormatting"),
6308
6388
  children: [
6309
- /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("i", {
6389
+ /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("i", {
6310
6390
  className: "icon w-6 h-6 clear border bg-no-repeat bg-center bg-[length:16px_16px] opacity-60"
6311
6391
  }),
6312
- /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("span", {
6392
+ /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("span", {
6313
6393
  className: "px-3 text-sm text-pink-600-300 font-sans font-normal",
6314
6394
  children: "Clear Formatting"
6315
6395
  })
@@ -6317,52 +6397,52 @@ function ToolbarPlugin({
6317
6397
  })
6318
6398
  ]
6319
6399
  }),
6320
- children: /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)(Button, {
6400
+ children: /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)(Button, {
6321
6401
  style: { backgroundColor: "transparent", padding: "0 8px" },
6322
- "aria-label": "Formatting options for additional text styles",
6402
+ "aria-label": tr("actionTextFormattingOptions"),
6323
6403
  children: [
6324
- /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("i", {
6404
+ /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("i", {
6325
6405
  className: `icon dropdown-more border bg-no-repeat bg-center bg-[length:18px_18px] w-6 h-6`
6326
6406
  }),
6327
- /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(Icon.Arrow, {})
6407
+ /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(Icon.Arrow, {})
6328
6408
  ]
6329
6409
  })
6330
6410
  }),
6331
- /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(Divider, {}),
6332
- /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(DropdownMenu.Root, {
6411
+ /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(Divider, {}),
6412
+ /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(DropdownMenu.Root, {
6333
6413
  style: { zIndex: 1 },
6334
6414
  disabled: !isEditable,
6335
- content: /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)(import_jsx_runtime88.Fragment, {
6415
+ content: /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)(import_jsx_runtime89.Fragment, {
6336
6416
  children: [
6337
- /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(DropdownMenu.Item, {
6417
+ /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(DropdownMenu.Item, {
6338
6418
  onClick: () => {
6339
6419
  activeEditor.dispatchCommand(import_LexicalHorizontalRuleNode4.INSERT_HORIZONTAL_RULE_COMMAND, void 0);
6340
6420
  },
6341
- children: /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("div", {
6421
+ children: /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("div", {
6342
6422
  className: "flex items-center font-sans font-normal",
6343
6423
  children: [
6344
- /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("i", {
6424
+ /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("i", {
6345
6425
  className: "icon w-5 h-5 horizontal-rule border bg-no-repeat bg-center bg-[length:16px_16px] opacity-60"
6346
6426
  }),
6347
- /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("span", {
6427
+ /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("span", {
6348
6428
  className: "px-3 text-sm",
6349
- children: "Horizontal rule"
6429
+ children: tr("horizontalRule")
6350
6430
  })
6351
6431
  ]
6352
6432
  })
6353
6433
  }),
6354
- /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(DropdownMenu.Item, {
6355
- children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(Dialog.Trigger, {
6434
+ /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(DropdownMenu.Item, {
6435
+ children: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(Dialog.Trigger, {
6356
6436
  asChild: true,
6357
- children: /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("div", {
6437
+ children: /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("div", {
6358
6438
  className: "flex items-center font-sans font-normal",
6359
6439
  children: [
6360
- /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("i", {
6440
+ /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("i", {
6361
6441
  className: "icon w-5 h-5 table border bg-no-repeat bg-center bg-[length:16px_16px] opacity-60"
6362
6442
  }),
6363
- /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("span", {
6443
+ /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("span", {
6364
6444
  className: "px-3 text-sm",
6365
- children: "Table"
6445
+ children: tr("table")
6366
6446
  })
6367
6447
  ]
6368
6448
  })
@@ -6370,23 +6450,23 @@ function ToolbarPlugin({
6370
6450
  })
6371
6451
  ]
6372
6452
  }),
6373
- children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(IconButton, {
6374
- children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("i", {
6453
+ children: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(IconButton, {
6454
+ children: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("i", {
6375
6455
  className: "icon plus border w-full h-full bg-no-repeat bg-center bg-[length:20px_20px] "
6376
6456
  })
6377
6457
  })
6378
6458
  }),
6379
- /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)(Dialog.Content, {
6459
+ /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)(Dialog.Content, {
6380
6460
  children: [
6381
- /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(Dialog.Title, {
6382
- children: "Insert table"
6461
+ /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(Dialog.Title, {
6462
+ children: tr("insertTableTitle")
6383
6463
  }),
6384
- /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(Dialog.Description, {
6385
- children: "Define your starting point of a table, you can add and remove columns and rows after creation."
6464
+ /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(Dialog.Description, {
6465
+ children: tr("insertTableDescription")
6386
6466
  }),
6387
- /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("div", {
6467
+ /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("div", {
6388
6468
  className: "items-center justify-between",
6389
- children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(InsertTableDialog, {
6469
+ children: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(InsertTableDialog, {
6390
6470
  activeEditor
6391
6471
  })
6392
6472
  })
@@ -6397,7 +6477,7 @@ function ToolbarPlugin({
6397
6477
  })
6398
6478
  ]
6399
6479
  }),
6400
- /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(ActionsPlugin, {
6480
+ /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(ActionsPlugin, {
6401
6481
  prepend: actionsMenuPrepend,
6402
6482
  append: actionsMenuAppend
6403
6483
  })
@@ -6507,21 +6587,13 @@ var theme = {
6507
6587
  };
6508
6588
  var CrystallizeRTEditorTheme_default = theme;
6509
6589
 
6510
- // src/rich-text-editor/ui/ContentEditable.tsx
6511
- var React7 = require("react");
6512
- var import_LexicalContentEditable = require("@lexical/react/LexicalContentEditable");
6513
- var import_jsx_runtime89 = require("react/jsx-runtime");
6514
- function LexicalContentEditable({ className }) {
6515
- return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(import_LexicalContentEditable.ContentEditable, {
6516
- className: className || "ContentEditable__root"
6517
- });
6518
- }
6519
-
6520
6590
  // src/rich-text-editor/rich-text-editor.tsx
6521
6591
  var import_jsx_runtime90 = require("react/jsx-runtime");
6522
6592
  function RichTextEditor({
6523
6593
  initialData,
6524
6594
  editable = true,
6595
+ language = "en",
6596
+ labelTranslations,
6525
6597
  ...rest
6526
6598
  }) {
6527
6599
  return /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(import_LexicalComposer.LexicalComposer, {
@@ -6537,12 +6609,16 @@ function RichTextEditor({
6537
6609
  richText: initialData
6538
6610
  }) : void 0
6539
6611
  },
6540
- children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(SharedHistoryContext, {
6541
- children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)("div", {
6542
- className: "c-rich-text-editor",
6543
- children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(RichTextEditorWithoutContext, {
6544
- ...rest,
6545
- editable
6612
+ children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(I18nProvider, {
6613
+ language,
6614
+ labelTranslations,
6615
+ children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(SharedHistoryContext, {
6616
+ children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)("div", {
6617
+ className: "c-rich-text-editor",
6618
+ children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(RichTextEditorWithoutContext, {
6619
+ ...rest,
6620
+ editable
6621
+ })
6546
6622
  })
6547
6623
  })
6548
6624
  })
@@ -6565,18 +6641,18 @@ function RichTextEditorWithoutContext({
6565
6641
  children: placeholderText ?? ""
6566
6642
  });
6567
6643
  const [editor] = (0, import_LexicalComposerContext12.useLexicalComposerContext)();
6568
- const [floatingAnchorElem, setFloatingAnchorElem] = (0, import_react76.useState)(null);
6569
- const [isSmallWidthViewport, setIsSmallWidthViewport] = (0, import_react76.useState)(false);
6570
- const firstOnChangeTriggeredRef = (0, import_react76.useRef)(!autoFocus);
6644
+ const [floatingAnchorElem, setFloatingAnchorElem] = (0, import_react77.useState)(null);
6645
+ const [isSmallWidthViewport, setIsSmallWidthViewport] = (0, import_react77.useState)(false);
6646
+ const firstOnChangeTriggeredRef = (0, import_react77.useRef)(!autoFocus);
6571
6647
  const onRef = (_floatingAnchorElem) => {
6572
6648
  if (_floatingAnchorElem !== null) {
6573
6649
  setFloatingAnchorElem(_floatingAnchorElem);
6574
6650
  }
6575
6651
  };
6576
- (0, import_react76.useEffect)(() => {
6652
+ (0, import_react77.useEffect)(() => {
6577
6653
  editor.setEditable(editable || false);
6578
6654
  }, [editable, editor]);
6579
- (0, import_react76.useEffect)(() => {
6655
+ (0, import_react77.useEffect)(() => {
6580
6656
  const updateViewPortWidth = () => {
6581
6657
  const isNextSmallWidthViewport = window.matchMedia("(max-width: 1025px)").matches;
6582
6658
  if (isNextSmallWidthViewport !== isSmallWidthViewport) {
@@ -6625,7 +6701,9 @@ function RichTextEditorWithoutContext({
6625
6701
  children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)("div", {
6626
6702
  className: "editor",
6627
6703
  ref: onRef,
6628
- children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(LexicalContentEditable, {})
6704
+ children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(import_LexicalContentEditable.ContentEditable, {
6705
+ className: "ContentEditable__root"
6706
+ })
6629
6707
  })
6630
6708
  }),
6631
6709
  placeholder,