@crystallize/design-system 1.24.46 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +19 -0
- package/dist/{chunk-6DIAYHKQ.mjs → chunk-B2Q2EUTC.mjs} +5339 -4416
- package/dist/index.css +156 -208
- package/dist/index.d.ts +57 -204
- package/dist/index.js +8873 -8258
- package/dist/index.mjs +137 -307
- package/dist/{parser-babel-B7AMC4UT.mjs → parser-babel-D5SPHKKD.mjs} +2424 -2411
- package/dist/{parser-html-URMUOK6U.mjs → parser-html-RZQPYQ4H.mjs} +3 -3
- package/dist/{parser-postcss-AN2EJ77H.mjs → parser-postcss-D5TI5WMI.mjs} +6 -6
- package/dist/{rich-text-editor-EVN3N57G.css → rich-text-editor-4ZROYBHM.css} +98 -147
- package/dist/{rich-text-editor-QGMRYDKQ.mjs → rich-text-editor-SIZB67MA.mjs} +667 -873
- package/dist/{standalone-AR2ENVE7.mjs → standalone-COC5HE24.mjs} +8 -6
- package/package.json +26 -27
- package/src/action-menu/action-menu.tsx +1 -2
- package/src/dialog/config.tsx +6 -10
- package/src/dialog/dialog.tsx +2 -2
- package/src/dropdown-menu/dropdown-menu-root.tsx +3 -4
- package/src/iconography/Icon.stories.tsx +0 -1
- package/src/iconography/actions.tsx +1 -5
- package/src/iconography/add.tsx +1 -5
- package/src/iconography/advance.tsx +1 -5
- package/src/iconography/app.tsx +1 -5
- package/src/iconography/archive.tsx +1 -5
- package/src/iconography/arrow.tsx +1 -5
- package/src/iconography/atom.tsx +1 -5
- package/src/iconography/battery.tsx +1 -5
- package/src/iconography/bell.tsx +1 -5
- package/src/iconography/billing-payments.tsx +1 -5
- package/src/iconography/bin.tsx +1 -5
- package/src/iconography/boolean.tsx +17 -0
- package/src/iconography/cancel.tsx +1 -5
- package/src/iconography/caret.tsx +2 -6
- package/src/iconography/cart.tsx +1 -5
- package/src/iconography/catalogue.tsx +1 -4
- package/src/iconography/check-with-circle.tsx +1 -4
- package/src/iconography/check.tsx +1 -4
- package/src/iconography/checkbox.tsx +24 -0
- package/src/iconography/chevron.tsx +1 -3
- package/src/iconography/choice.tsx +1 -5
- package/src/iconography/chunk.tsx +1 -5
- package/src/iconography/clock.tsx +1 -5
- package/src/iconography/cloud-with-key-hole.tsx +1 -5
- package/src/iconography/cloud.tsx +1 -5
- package/src/iconography/compact.tsx +1 -5
- package/src/iconography/copy-with-cloud.tsx +2 -13
- package/src/iconography/copy.tsx +1 -5
- package/src/iconography/coupon.tsx +1 -5
- package/src/iconography/crystal.tsx +2 -14
- package/src/iconography/customers.tsx +1 -5
- package/src/iconography/dashboard.tsx +1 -5
- package/src/iconography/date-infinity.tsx +1 -5
- package/src/iconography/date.tsx +1 -5
- package/src/iconography/discovery.tsx +1 -5
- package/src/iconography/document-shortcut.tsx +1 -5
- package/src/iconography/document.tsx +1 -5
- package/src/iconography/dots.tsx +1 -5
- package/src/iconography/download.tsx +1 -5
- package/src/iconography/drag-handle.tsx +1 -5
- package/src/iconography/dynamic-value.tsx +1 -5
- package/src/iconography/edit.tsx +1 -5
- package/src/iconography/error-white.tsx +1 -4
- package/src/iconography/error.tsx +1 -4
- package/src/iconography/expanded.tsx +1 -5
- package/src/iconography/eye-closed.tsx +1 -5
- package/src/iconography/eye-open.tsx +1 -5
- package/src/iconography/file-upload.tsx +1 -5
- package/src/iconography/filename.tsx +1 -5
- package/src/iconography/fixed-property-table.tsx +1 -5
- package/src/iconography/fixed-value.tsx +1 -5
- package/src/iconography/flow.tsx +9 -21
- package/src/iconography/folder-shortcut.tsx +1 -5
- package/src/iconography/folder.tsx +1 -5
- package/src/iconography/frontends.tsx +1 -5
- package/src/iconography/fulfilment.tsx +1 -5
- package/src/iconography/glasses.tsx +2 -13
- package/src/iconography/graphQL.tsx +2 -13
- package/src/iconography/grid-relation.tsx +1 -5
- package/src/iconography/grid.tsx +1 -5
- package/src/iconography/hand-mirror.tsx +1 -4
- package/src/iconography/hooks.tsx +1 -5
- package/src/iconography/image.tsx +1 -5
- package/src/iconography/index.ts +16 -1
- package/src/iconography/info.tsx +1 -4
- package/src/iconography/items.tsx +1 -5
- package/src/iconography/key.tsx +1 -5
- package/src/iconography/language.tsx +2 -6
- package/src/iconography/lifebouy.tsx +2 -6
- package/src/iconography/limitations.tsx +1 -5
- package/src/iconography/location.tsx +2 -6
- package/src/iconography/lock-closed.tsx +1 -5
- package/src/iconography/lock-open.tsx +2 -6
- package/src/iconography/magnifier.tsx +22 -37
- package/src/iconography/meta-preset.tsx +36 -0
- package/src/iconography/min-quantity.tsx +2 -6
- package/src/iconography/min-value.tsx +2 -6
- package/src/iconography/multilingual.tsx +2 -6
- package/src/iconography/multiple-choice.tsx +2 -6
- package/src/iconography/mushroom.tsx +2 -6
- package/src/iconography/nail-polish.tsx +3 -14
- package/src/iconography/number.tsx +16 -0
- package/src/iconography/numeric.tsx +2 -6
- package/src/iconography/order.tsx +2 -6
- package/src/iconography/organization.tsx +2 -6
- package/src/iconography/paragraph-collection.tsx +2 -6
- package/src/iconography/particle.tsx +3 -15
- package/src/iconography/paths.tsx +2 -5
- package/src/iconography/people.tsx +2 -6
- package/src/iconography/percentage.tsx +3 -8
- package/src/iconography/piece.tsx +4 -8
- package/src/iconography/pin.tsx +2 -6
- package/src/iconography/pipeline-dashed.tsx +2 -6
- package/src/iconography/plans-and-pricing.tsx +2 -6
- package/src/iconography/plug.tsx +2 -6
- package/src/iconography/price-list.tsx +2 -6
- package/src/iconography/price-tag.tsx +2 -6
- package/src/iconography/product-shortcut.tsx +2 -6
- package/src/iconography/product.tsx +2 -6
- package/src/iconography/promotion.tsx +2 -6
- package/src/iconography/property-table.tsx +2 -6
- package/src/iconography/relation.tsx +2 -6
- package/src/iconography/remove.tsx +2 -6
- package/src/iconography/renew.tsx +2 -6
- package/src/iconography/restricted-catalogue.tsx +2 -5
- package/src/iconography/rich-text.tsx +2 -6
- package/src/iconography/rocket.tsx +2 -6
- package/src/iconography/search.tsx +2 -6
- package/src/iconography/select.tsx +20 -0
- package/src/iconography/selection.tsx +2 -6
- package/src/iconography/settings.tsx +2 -6
- package/src/iconography/shapes.tsx +2 -6
- package/src/iconography/singleline.tsx +2 -6
- package/src/iconography/special-price.tsx +2 -6
- package/src/iconography/split.tsx +2 -6
- package/src/iconography/stock-location.tsx +2 -6
- package/src/iconography/string.tsx +16 -0
- package/src/iconography/subscription-contracts.tsx +43 -49
- package/src/iconography/subscription-plans.tsx +2 -6
- package/src/iconography/subscription.tsx +2 -6
- package/src/iconography/switch.tsx +2 -6
- package/src/iconography/target.tsx +2 -6
- package/src/iconography/topics-branch.tsx +2 -6
- package/src/iconography/topics-leaf.tsx +2 -6
- package/src/iconography/topics.tsx +2 -6
- package/src/iconography/transition-in-disabled.tsx +2 -6
- package/src/iconography/transition-in.tsx +2 -6
- package/src/iconography/transition-out-disabled.tsx +13 -19
- package/src/iconography/transition-out.tsx +2 -6
- package/src/iconography/unpublish.tsx +2 -6
- package/src/iconography/usage-meter.tsx +4 -8
- package/src/iconography/usage.tsx +2 -6
- package/src/iconography/user-card.tsx +2 -6
- package/src/iconography/user.tsx +2 -6
- package/src/iconography/users.tsx +2 -6
- package/src/iconography/variant.tsx +2 -6
- package/src/iconography/video.tsx +2 -6
- package/src/iconography/wand.tsx +2 -6
- package/src/iconography/warning.tsx +2 -5
- package/src/iconography/x-for-y.tsx +2 -6
- package/src/label/label.tsx +1 -1
- package/src/popover/popover.tsx +5 -6
- package/src/rich-text-editor/tests/rich-text-editor-basic-rendering.test.tsx +8 -6
- package/src/rich-text-editor/tests/rich-text-editor-code.test.tsx +1 -1
- package/src/rich-text-editor/tests/rich-text-editor-onchange.test.tsx +4 -18
- package/src/rich-text-editor/tests/rich-text-editor-quote.test.tsx +2 -1
- package/src/rich-text-editor/tests/rich-text-editor-typing.test.tsx +6 -4
- package/src/rich-text-editor/tests/utils.ts +3 -1
- package/src/select/select-root.tsx +2 -2
- package/src/spinner/index.tsx +3 -3
- package/src/tag/tag.tsx +2 -2
- package/src/tooltip/tooltip.tsx +1 -1
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
Icon,
|
|
7
7
|
IconButton,
|
|
8
8
|
InputWithLabel
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-B2Q2EUTC.mjs";
|
|
10
10
|
import "./chunk-NIH5ZMPE.mjs";
|
|
11
11
|
|
|
12
12
|
// src/rich-text-editor/rich-text-editor.tsx
|
|
@@ -32,10 +32,7 @@ import { jsx } from "react/jsx-runtime";
|
|
|
32
32
|
var Context = createContext({});
|
|
33
33
|
var SharedHistoryContext = ({ children }) => {
|
|
34
34
|
const historyContext = useMemo(() => ({ historyState: createEmptyHistoryState() }), []);
|
|
35
|
-
return /* @__PURE__ */ jsx(Context.Provider, {
|
|
36
|
-
value: historyContext,
|
|
37
|
-
children
|
|
38
|
-
});
|
|
35
|
+
return /* @__PURE__ */ jsx(Context.Provider, { value: historyContext, children });
|
|
39
36
|
};
|
|
40
37
|
var useSharedHistoryContext = () => {
|
|
41
38
|
return useContext(Context);
|
|
@@ -117,10 +114,7 @@ function I18nProvider({
|
|
|
117
114
|
children
|
|
118
115
|
}) {
|
|
119
116
|
const translations2 = labelTranslations || en_default;
|
|
120
|
-
return /* @__PURE__ */ jsx2(I18nContext.Provider, {
|
|
121
|
-
value: translations2,
|
|
122
|
-
children
|
|
123
|
-
});
|
|
117
|
+
return /* @__PURE__ */ jsx2(I18nContext.Provider, { value: translations2, children });
|
|
124
118
|
}
|
|
125
119
|
function replaceI18nVariablesInString(str, replaceWith) {
|
|
126
120
|
return str.replace(/({{[^}]+}})/g, replaceWith);
|
|
@@ -572,7 +566,6 @@ var BaseNodes = [
|
|
|
572
566
|
];
|
|
573
567
|
|
|
574
568
|
// src/rich-text-editor/plugins/AutoLinkPlugin/index.tsx
|
|
575
|
-
import "react";
|
|
576
569
|
import { AutoLinkPlugin } from "@lexical/react/LexicalAutoLinkPlugin";
|
|
577
570
|
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
578
571
|
var URL_MATCHER = /((https?:\/\/(www\.)?)|(www\.))[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)/;
|
|
@@ -602,9 +595,7 @@ var MATCHERS = [
|
|
|
602
595
|
}
|
|
603
596
|
];
|
|
604
597
|
function LexicalAutoLinkPlugin() {
|
|
605
|
-
return /* @__PURE__ */ jsx3(AutoLinkPlugin, {
|
|
606
|
-
matchers: MATCHERS
|
|
607
|
-
});
|
|
598
|
+
return /* @__PURE__ */ jsx3(AutoLinkPlugin, { matchers: MATCHERS });
|
|
608
599
|
}
|
|
609
600
|
|
|
610
601
|
// src/rich-text-editor/plugins/CodeActionMenuPlugin/index.tsx
|
|
@@ -616,7 +607,6 @@ import { $isCodeNode as $isCodeNode4, CodeNode as CodeNode2, getLanguageFriendly
|
|
|
616
607
|
import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
|
|
617
608
|
|
|
618
609
|
// src/rich-text-editor/plugins/CodeActionMenuPlugin/components/CopyButton/index.tsx
|
|
619
|
-
import "react";
|
|
620
610
|
import { useState } from "react";
|
|
621
611
|
import { $getNearestNodeFromDOMNode, $getSelection, $setSelection } from "lexical";
|
|
622
612
|
import { useDebouncedCallback } from "use-debounce";
|
|
@@ -650,28 +640,18 @@ function CopyButton({ editor, getCodeDOMNode }) {
|
|
|
650
640
|
console.error("Failed to copy: ", err);
|
|
651
641
|
}
|
|
652
642
|
}
|
|
653
|
-
return /* @__PURE__ */ jsx4("button", {
|
|
654
|
-
className: "c-rte-code-button",
|
|
655
|
-
onClick: handleClick,
|
|
656
|
-
"aria-label": tr("actionCopyCode"),
|
|
657
|
-
children: isCopyCompleted ? /* @__PURE__ */ jsx4("i", {
|
|
658
|
-
className: "c-rte-code-button__icon c-rte-icon-success"
|
|
659
|
-
}) : /* @__PURE__ */ jsx4("i", {
|
|
660
|
-
className: "c-rte-code-button__icon c-rte-icon-copy"
|
|
661
|
-
})
|
|
662
|
-
});
|
|
643
|
+
return /* @__PURE__ */ jsx4("button", { className: "c-rte-code-button", onClick: handleClick, "aria-label": tr("actionCopyCode"), children: isCopyCompleted ? /* @__PURE__ */ jsx4("i", { className: "c-rte-code-button__icon c-rte-icon-success" }) : /* @__PURE__ */ jsx4("i", { className: "c-rte-code-button__icon c-rte-icon-copy" }) });
|
|
663
644
|
}
|
|
664
645
|
|
|
665
646
|
// src/rich-text-editor/plugins/CodeActionMenuPlugin/components/PrettierButton/index.tsx
|
|
666
|
-
import "react";
|
|
667
647
|
import { useState as useState2 } from "react";
|
|
668
648
|
import { $getNearestNodeFromDOMNode as $getNearestNodeFromDOMNode2 } from "lexical";
|
|
669
649
|
import { $isCodeNode as $isCodeNode3 } from "@lexical/code";
|
|
670
650
|
import { jsx as jsx5, jsxs } from "react/jsx-runtime";
|
|
671
651
|
var PRETTIER_PARSER_MODULES = {
|
|
672
|
-
css: () => import("./parser-postcss-
|
|
673
|
-
html: () => import("./parser-html-
|
|
674
|
-
js: () => import("./parser-babel-
|
|
652
|
+
css: () => import("./parser-postcss-D5TI5WMI.mjs"),
|
|
653
|
+
html: () => import("./parser-html-RZQPYQ4H.mjs"),
|
|
654
|
+
js: () => import("./parser-babel-D5SPHKKD.mjs")
|
|
675
655
|
};
|
|
676
656
|
async function loadPrettierParserByLang(lang) {
|
|
677
657
|
const dynamicImport = PRETTIER_PARSER_MODULES[lang];
|
|
@@ -679,7 +659,7 @@ async function loadPrettierParserByLang(lang) {
|
|
|
679
659
|
return parser?.default || parser;
|
|
680
660
|
}
|
|
681
661
|
async function loadPrettierFormat() {
|
|
682
|
-
const prettier = await import("./standalone-
|
|
662
|
+
const prettier = await import("./standalone-COC5HE24.mjs");
|
|
683
663
|
return prettier?.default?.format || prettier?.format;
|
|
684
664
|
}
|
|
685
665
|
var PRETTIER_OPTIONS_BY_LANG = {
|
|
@@ -765,27 +745,20 @@ function PrettierButton({ lang, editor, getCodeDOMNode }) {
|
|
|
765
745
|
setTipsVisible(false);
|
|
766
746
|
}
|
|
767
747
|
}
|
|
768
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
748
|
+
return /* @__PURE__ */ jsxs("div", { className: "c-rte-prettier-wrapper", children: [
|
|
749
|
+
/* @__PURE__ */ jsx5(
|
|
750
|
+
"button",
|
|
751
|
+
{
|
|
772
752
|
className: "c-rte-code-button",
|
|
773
753
|
onClick: handleClick,
|
|
774
754
|
onMouseEnter: handleMouseEnter,
|
|
775
755
|
onMouseLeave: handleMouseLeave,
|
|
776
756
|
"aria-label": tr("actionFormatCode"),
|
|
777
|
-
children: syntaxError ? /* @__PURE__ */ jsx5("i", {
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
}),
|
|
783
|
-
tipsVisible ? /* @__PURE__ */ jsx5("pre", {
|
|
784
|
-
className: "c-rte-code-error-tips",
|
|
785
|
-
children: syntaxError
|
|
786
|
-
}) : null
|
|
787
|
-
]
|
|
788
|
-
});
|
|
757
|
+
children: syntaxError ? /* @__PURE__ */ jsx5("i", { className: "c-rte-code-button__icon c-rte-icon-prettier-error" }) : /* @__PURE__ */ jsx5("i", { className: "c-rte-code-button__icon c-rte-icon-prettier" })
|
|
758
|
+
}
|
|
759
|
+
),
|
|
760
|
+
tipsVisible ? /* @__PURE__ */ jsx5("pre", { className: "c-rte-code-error-tips", children: syntaxError }) : null
|
|
761
|
+
] });
|
|
789
762
|
}
|
|
790
763
|
|
|
791
764
|
// src/rich-text-editor/plugins/CodeActionMenuPlugin/index.tsx
|
|
@@ -875,27 +848,11 @@ function CodeActionMenuContainer({ anchorElem }) {
|
|
|
875
848
|
}, [editor]);
|
|
876
849
|
const normalizedLang = normalizeCodeLang(lang);
|
|
877
850
|
const codeFriendlyName = getLanguageFriendlyName(lang);
|
|
878
|
-
return /* @__PURE__ */ jsx6(Fragment, {
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
/* @__PURE__ */ jsx6("div", {
|
|
884
|
-
className: "c-rte-code-highlight-language",
|
|
885
|
-
children: codeFriendlyName
|
|
886
|
-
}),
|
|
887
|
-
/* @__PURE__ */ jsx6(CopyButton, {
|
|
888
|
-
editor,
|
|
889
|
-
getCodeDOMNode
|
|
890
|
-
}),
|
|
891
|
-
canBePrettier(normalizedLang) ? /* @__PURE__ */ jsx6(PrettierButton, {
|
|
892
|
-
editor,
|
|
893
|
-
getCodeDOMNode,
|
|
894
|
-
lang: normalizedLang
|
|
895
|
-
}) : null
|
|
896
|
-
]
|
|
897
|
-
}) : null
|
|
898
|
-
});
|
|
851
|
+
return /* @__PURE__ */ jsx6(Fragment, { children: isShown ? /* @__PURE__ */ jsxs2("div", { className: "c-rte-code-action-menu-container", style: { ...position }, children: [
|
|
852
|
+
/* @__PURE__ */ jsx6("div", { className: "c-rte-code-highlight-language", children: codeFriendlyName }),
|
|
853
|
+
/* @__PURE__ */ jsx6(CopyButton, { editor, getCodeDOMNode }),
|
|
854
|
+
canBePrettier(normalizedLang) ? /* @__PURE__ */ jsx6(PrettierButton, { editor, getCodeDOMNode, lang: normalizedLang }) : null
|
|
855
|
+
] }) : null });
|
|
899
856
|
}
|
|
900
857
|
function getMouseInfo(event) {
|
|
901
858
|
const target = event.target;
|
|
@@ -910,9 +867,7 @@ function getMouseInfo(event) {
|
|
|
910
867
|
function CodeActionMenuPlugin({
|
|
911
868
|
anchorElem = document.body
|
|
912
869
|
}) {
|
|
913
|
-
return createPortal(/* @__PURE__ */ jsx6(CodeActionMenuContainer, {
|
|
914
|
-
anchorElem
|
|
915
|
-
}), anchorElem);
|
|
870
|
+
return createPortal(/* @__PURE__ */ jsx6(CodeActionMenuContainer, { anchorElem }), anchorElem);
|
|
916
871
|
}
|
|
917
872
|
|
|
918
873
|
// src/rich-text-editor/plugins/CodeHighlightPlugin/index.ts
|
|
@@ -1004,67 +959,40 @@ function LinkPreviewContent({
|
|
|
1004
959
|
if (!hasPreview) {
|
|
1005
960
|
return null;
|
|
1006
961
|
}
|
|
1007
|
-
return /* @__PURE__ */ jsxs3("div", {
|
|
1008
|
-
className: "c-rte-link-preview",
|
|
1009
|
-
children:
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
src: preview.google.image,
|
|
1014
|
-
alt: preview.google.title,
|
|
1015
|
-
className: "c-rte-link-preview-image"
|
|
1016
|
-
})
|
|
1017
|
-
}),
|
|
1018
|
-
preview.google.title && /* @__PURE__ */ jsx7("div", {
|
|
1019
|
-
className: "c-rte-link-preview-title",
|
|
1020
|
-
children: preview.google.title
|
|
1021
|
-
}),
|
|
1022
|
-
preview.google.description && /* @__PURE__ */ jsx7("div", {
|
|
1023
|
-
className: "c-rte-link-preview-description",
|
|
1024
|
-
children: preview.google.description
|
|
1025
|
-
}),
|
|
1026
|
-
textContent && textContent !== preview.google.title ? /* @__PURE__ */ jsx7(Button, {
|
|
1027
|
-
className: "c-rte-link-preview__replace-text-btn",
|
|
1028
|
-
onClick: useTitleForText,
|
|
1029
|
-
children: tr("linkPreviewReplaceTextWithTitle")
|
|
1030
|
-
}) : null
|
|
1031
|
-
]
|
|
1032
|
-
});
|
|
962
|
+
return /* @__PURE__ */ jsxs3("div", { className: "c-rte-link-preview", children: [
|
|
963
|
+
preview.google.image && /* @__PURE__ */ jsx7("div", { className: "c-rte-link-preview-image-wrapper", children: /* @__PURE__ */ jsx7("img", { src: preview.google.image, alt: preview.google.title, className: "c-rte-link-preview-image" }) }),
|
|
964
|
+
preview.google.title && /* @__PURE__ */ jsx7("div", { className: "c-rte-link-preview-title", children: preview.google.title }),
|
|
965
|
+
preview.google.description && /* @__PURE__ */ jsx7("div", { className: "c-rte-link-preview-description", children: preview.google.description }),
|
|
966
|
+
textContent && textContent !== preview.google.title ? /* @__PURE__ */ jsx7(Button, { className: "c-rte-link-preview__replace-text-btn", onClick: useTitleForText, children: tr("linkPreviewReplaceTextWithTitle") }) : null
|
|
967
|
+
] });
|
|
1033
968
|
}
|
|
1034
969
|
function Glimmer(props) {
|
|
1035
|
-
return /* @__PURE__ */ jsx7(
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
970
|
+
return /* @__PURE__ */ jsx7(
|
|
971
|
+
"div",
|
|
972
|
+
{
|
|
973
|
+
className: "c-rte-link-preview-glimmer",
|
|
974
|
+
...props,
|
|
975
|
+
style: {
|
|
976
|
+
animationDelay: String((props.index || 0) * 300),
|
|
977
|
+
...props.style || {}
|
|
978
|
+
}
|
|
1041
979
|
}
|
|
1042
|
-
|
|
980
|
+
);
|
|
1043
981
|
}
|
|
1044
982
|
function LinkPreview({
|
|
1045
983
|
url
|
|
1046
984
|
}) {
|
|
1047
|
-
return /* @__PURE__ */ jsx7(
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
})
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
/* @__PURE__ */ jsx7(Glimmer, {
|
|
1059
|
-
style: { width: "80%" },
|
|
1060
|
-
index: 2
|
|
1061
|
-
})
|
|
1062
|
-
]
|
|
1063
|
-
}),
|
|
1064
|
-
children: /* @__PURE__ */ jsx7(LinkPreviewContent, {
|
|
1065
|
-
url
|
|
1066
|
-
})
|
|
1067
|
-
});
|
|
985
|
+
return /* @__PURE__ */ jsx7(
|
|
986
|
+
Suspense,
|
|
987
|
+
{
|
|
988
|
+
fallback: /* @__PURE__ */ jsxs3(Fragment2, { children: [
|
|
989
|
+
/* @__PURE__ */ jsx7(Glimmer, { style: { height: "80px" }, index: 0 }),
|
|
990
|
+
/* @__PURE__ */ jsx7(Glimmer, { style: { width: "60%" }, index: 1 }),
|
|
991
|
+
/* @__PURE__ */ jsx7(Glimmer, { style: { width: "80%" }, index: 2 })
|
|
992
|
+
] }),
|
|
993
|
+
children: /* @__PURE__ */ jsx7(LinkPreviewContent, { url })
|
|
994
|
+
}
|
|
995
|
+
);
|
|
1068
996
|
}
|
|
1069
997
|
|
|
1070
998
|
// src/rich-text-editor/utils/getSelectedNode.ts
|
|
@@ -1250,109 +1178,77 @@ function FloatingLinkEditor({
|
|
|
1250
1178
|
inputRef.current.focus();
|
|
1251
1179
|
}
|
|
1252
1180
|
}, [isEditMode]);
|
|
1253
|
-
return /* @__PURE__ */ jsx8("div", {
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
className: "c-rte-link-editor-preview-attr",
|
|
1325
|
-
children: rel
|
|
1326
|
-
}),
|
|
1327
|
-
target && /* @__PURE__ */ jsx8("div", {
|
|
1328
|
-
className: "c-rte-link-editor-preview-attr",
|
|
1329
|
-
children: target
|
|
1330
|
-
})
|
|
1331
|
-
]
|
|
1332
|
-
}) : null
|
|
1333
|
-
]
|
|
1334
|
-
}),
|
|
1335
|
-
/* @__PURE__ */ jsx8("div", {
|
|
1336
|
-
children: /* @__PURE__ */ jsx8(IconButton, {
|
|
1337
|
-
size: "sm",
|
|
1338
|
-
tabIndex: 0,
|
|
1339
|
-
onMouseDown: (event) => event.preventDefault(),
|
|
1340
|
-
onClick: () => setEditMode(true),
|
|
1341
|
-
"aria-label": tr("linkEditorEdit"),
|
|
1342
|
-
"data-testid": "link-editor-edit",
|
|
1343
|
-
children: /* @__PURE__ */ jsx8(Icon.Edit, {})
|
|
1344
|
-
})
|
|
1345
|
-
})
|
|
1346
|
-
]
|
|
1347
|
-
}),
|
|
1348
|
-
/* @__PURE__ */ jsx8("div", {
|
|
1349
|
-
children: /* @__PURE__ */ jsx8(LinkPreview, {
|
|
1350
|
-
url: linkUrl
|
|
1351
|
-
})
|
|
1352
|
-
})
|
|
1353
|
-
]
|
|
1354
|
-
})
|
|
1355
|
-
});
|
|
1181
|
+
return /* @__PURE__ */ jsx8("div", { ref: editorRef, className: "c-rte-link-editor", "data-testid": "rich-text-link-editor", children: isEditMode ? /* @__PURE__ */ jsxs4("div", { children: [
|
|
1182
|
+
/* @__PURE__ */ jsx8("div", { className: "c-rte-link-editor-input-group", children: /* @__PURE__ */ jsx8(
|
|
1183
|
+
InputWithLabel,
|
|
1184
|
+
{
|
|
1185
|
+
label: tr("linkEditorLink"),
|
|
1186
|
+
type: "text",
|
|
1187
|
+
value: linkUrl,
|
|
1188
|
+
onChange: (e) => setLinkUrl(e.target.value)
|
|
1189
|
+
}
|
|
1190
|
+
) }),
|
|
1191
|
+
/* @__PURE__ */ jsx8("div", { className: "c-rte-link-editor-input-group", children: /* @__PURE__ */ jsx8(
|
|
1192
|
+
InputWithLabel,
|
|
1193
|
+
{
|
|
1194
|
+
label: tr("linkEditorRel"),
|
|
1195
|
+
type: "text",
|
|
1196
|
+
value: rel ?? "",
|
|
1197
|
+
onChange: (e) => setRel(e.target.value)
|
|
1198
|
+
}
|
|
1199
|
+
) }),
|
|
1200
|
+
/* @__PURE__ */ jsx8("div", { className: "c-rte-link-editor-input-group", children: /* @__PURE__ */ jsx8(
|
|
1201
|
+
InputWithLabel,
|
|
1202
|
+
{
|
|
1203
|
+
label: tr("linkEditorTarget"),
|
|
1204
|
+
type: "text",
|
|
1205
|
+
value: target ?? "",
|
|
1206
|
+
onChange: (e) => setTarget(e.target.value)
|
|
1207
|
+
}
|
|
1208
|
+
) }),
|
|
1209
|
+
/* @__PURE__ */ jsx8("div", { className: "c-rte-link-editor-button-wrap", children: /* @__PURE__ */ jsx8(
|
|
1210
|
+
Button,
|
|
1211
|
+
{
|
|
1212
|
+
"data-testid": "link-editor-save-button",
|
|
1213
|
+
onClick: () => {
|
|
1214
|
+
if (lastSelection !== null) {
|
|
1215
|
+
if (linkUrl !== "") {
|
|
1216
|
+
editor.dispatchCommand(TOGGLE_LINK_COMMAND, {
|
|
1217
|
+
url: sanitizeUrl(linkUrl),
|
|
1218
|
+
rel,
|
|
1219
|
+
target
|
|
1220
|
+
});
|
|
1221
|
+
}
|
|
1222
|
+
setEditMode(false);
|
|
1223
|
+
}
|
|
1224
|
+
},
|
|
1225
|
+
children: tr("linkEditorCommit")
|
|
1226
|
+
}
|
|
1227
|
+
) })
|
|
1228
|
+
] }) : /* @__PURE__ */ jsxs4(Fragment3, { children: [
|
|
1229
|
+
/* @__PURE__ */ jsxs4("div", { className: "c-rte-link-editor-link-input", children: [
|
|
1230
|
+
/* @__PURE__ */ jsxs4("div", { className: "c-rte-link-editor-link-preview", children: [
|
|
1231
|
+
/* @__PURE__ */ jsx8("a", { href: linkUrl, target: "_blank", rel: "noopener noreferrer", children: linkUrl }),
|
|
1232
|
+
rel || target ? /* @__PURE__ */ jsxs4("div", { className: "c-rte-link-editor-preview-attrs", children: [
|
|
1233
|
+
rel && /* @__PURE__ */ jsx8("div", { className: "c-rte-link-editor-preview-attr", children: rel }),
|
|
1234
|
+
target && /* @__PURE__ */ jsx8("div", { className: "c-rte-link-editor-preview-attr", children: target })
|
|
1235
|
+
] }) : null
|
|
1236
|
+
] }),
|
|
1237
|
+
/* @__PURE__ */ jsx8("div", { children: /* @__PURE__ */ jsx8(
|
|
1238
|
+
IconButton,
|
|
1239
|
+
{
|
|
1240
|
+
size: "sm",
|
|
1241
|
+
tabIndex: 0,
|
|
1242
|
+
onMouseDown: (event) => event.preventDefault(),
|
|
1243
|
+
onClick: () => setEditMode(true),
|
|
1244
|
+
"aria-label": tr("linkEditorEdit"),
|
|
1245
|
+
"data-testid": "link-editor-edit",
|
|
1246
|
+
children: /* @__PURE__ */ jsx8(Icon.Edit, {})
|
|
1247
|
+
}
|
|
1248
|
+
) })
|
|
1249
|
+
] }),
|
|
1250
|
+
/* @__PURE__ */ jsx8("div", { children: /* @__PURE__ */ jsx8(LinkPreview, { url: linkUrl }) })
|
|
1251
|
+
] }) });
|
|
1356
1252
|
}
|
|
1357
1253
|
function useFloatingLinkEditorToolbar(editor, anchorElem) {
|
|
1358
1254
|
const [activeEditor, setActiveEditor] = useState5(editor);
|
|
@@ -1395,12 +1291,7 @@ function useFloatingLinkEditorToolbar(editor, anchorElem) {
|
|
|
1395
1291
|
return () => document.removeEventListener("click", onClick);
|
|
1396
1292
|
}, [isLink, activeEditor]);
|
|
1397
1293
|
return isLink ? createPortal2(
|
|
1398
|
-
/* @__PURE__ */ jsx8(FloatingLinkEditor, {
|
|
1399
|
-
editor: activeEditor,
|
|
1400
|
-
isLink,
|
|
1401
|
-
anchorElem,
|
|
1402
|
-
setIsLink
|
|
1403
|
-
}),
|
|
1294
|
+
/* @__PURE__ */ jsx8(FloatingLinkEditor, { editor: activeEditor, isLink, anchorElem, setIsLink }),
|
|
1404
1295
|
anchorElem
|
|
1405
1296
|
) : null;
|
|
1406
1297
|
}
|
|
@@ -1413,7 +1304,6 @@ function FloatingLinkEditorPlugin({
|
|
|
1413
1304
|
|
|
1414
1305
|
// src/rich-text-editor/plugins/FloatingTextFormatToolbarPlugin/index.tsx
|
|
1415
1306
|
import { useCallback as useCallback2, useEffect as useEffect5, useRef as useRef3, useState as useState6 } from "react";
|
|
1416
|
-
import "react";
|
|
1417
1307
|
import {
|
|
1418
1308
|
$getSelection as $getSelection4,
|
|
1419
1309
|
$isRangeSelection as $isRangeSelection2,
|
|
@@ -1537,96 +1427,132 @@ function TextFormatFloatingToolbar({
|
|
|
1537
1427
|
if (!editor.isEditable()) {
|
|
1538
1428
|
return /* @__PURE__ */ jsx9("span", {});
|
|
1539
1429
|
}
|
|
1540
|
-
return /* @__PURE__ */ jsxs5("div", {
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
/* @__PURE__ */ jsx9(IconButton, {
|
|
1430
|
+
return /* @__PURE__ */ jsxs5("div", { ref: popupCharStylesEditorRef, className: "c-rte-floating-text-format-tb-plugin", children: [
|
|
1431
|
+
/* @__PURE__ */ jsx9(
|
|
1432
|
+
IconButton,
|
|
1433
|
+
{
|
|
1545
1434
|
onClick: () => {
|
|
1546
1435
|
editor.dispatchCommand(FORMAT_TEXT_COMMAND, "bold");
|
|
1547
1436
|
},
|
|
1548
1437
|
style: { padding: 0, overflow: "hidden" },
|
|
1549
1438
|
title: tr(IS_APPLE ? "actionFormatAsStrongTitleApple" : "actionFormatAsStrongTitle"),
|
|
1550
1439
|
"aria-label": tr("actionFormatAsStrongLabel"),
|
|
1551
|
-
children: /* @__PURE__ */ jsx9(
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1440
|
+
children: /* @__PURE__ */ jsx9(
|
|
1441
|
+
"i",
|
|
1442
|
+
{
|
|
1443
|
+
className: `c-rte-icon-bold c-rte-floating-text-format-tb-plugin__format-icon ${isBold ? "selected" : ""}`
|
|
1444
|
+
}
|
|
1445
|
+
)
|
|
1446
|
+
}
|
|
1447
|
+
),
|
|
1448
|
+
/* @__PURE__ */ jsx9(
|
|
1449
|
+
IconButton,
|
|
1450
|
+
{
|
|
1556
1451
|
style: { padding: 0, overflow: "hidden" },
|
|
1557
1452
|
onClick: () => {
|
|
1558
1453
|
editor.dispatchCommand(FORMAT_TEXT_COMMAND, "italic");
|
|
1559
1454
|
},
|
|
1560
1455
|
title: tr("actionFormatAsEmphasizedTitle"),
|
|
1561
1456
|
"aria-label": tr("actionFormatAsEmphasizedLabel"),
|
|
1562
|
-
children: /* @__PURE__ */ jsx9(
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1457
|
+
children: /* @__PURE__ */ jsx9(
|
|
1458
|
+
"i",
|
|
1459
|
+
{
|
|
1460
|
+
className: `c-rte-icon-italic c-rte-floating-text-format-tb-plugin__format-icon ${isItalic ? "selected" : ""}`
|
|
1461
|
+
}
|
|
1462
|
+
)
|
|
1463
|
+
}
|
|
1464
|
+
),
|
|
1465
|
+
/* @__PURE__ */ jsx9(
|
|
1466
|
+
IconButton,
|
|
1467
|
+
{
|
|
1567
1468
|
style: { padding: 0, overflow: "hidden" },
|
|
1568
1469
|
onClick: () => {
|
|
1569
1470
|
editor.dispatchCommand(FORMAT_TEXT_COMMAND, "underline");
|
|
1570
1471
|
},
|
|
1571
1472
|
title: tr("actionFormatAsUnderlinedTitle"),
|
|
1572
1473
|
"aria-label": tr("actionFormatAsUnderlinedLabel"),
|
|
1573
|
-
children: /* @__PURE__ */ jsx9(
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1474
|
+
children: /* @__PURE__ */ jsx9(
|
|
1475
|
+
"i",
|
|
1476
|
+
{
|
|
1477
|
+
className: `c-rte-icon-underline c-rte-floating-text-format-tb-plugin__format-icon ${isUnderline ? "selected" : ""}`
|
|
1478
|
+
}
|
|
1479
|
+
)
|
|
1480
|
+
}
|
|
1481
|
+
),
|
|
1482
|
+
/* @__PURE__ */ jsx9(
|
|
1483
|
+
IconButton,
|
|
1484
|
+
{
|
|
1578
1485
|
style: { padding: 0, overflow: "hidden" },
|
|
1579
1486
|
onClick: () => {
|
|
1580
1487
|
editor.dispatchCommand(FORMAT_TEXT_COMMAND, "code");
|
|
1581
1488
|
},
|
|
1582
1489
|
"aria-label": tr("actionInsertCodeBlock"),
|
|
1583
|
-
children: /* @__PURE__ */ jsx9(
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1490
|
+
children: /* @__PURE__ */ jsx9(
|
|
1491
|
+
"i",
|
|
1492
|
+
{
|
|
1493
|
+
className: `c-rte-icon-code c-rte-floating-text-format-tb-plugin__format-icon ${isCode ? "selected" : ""}`
|
|
1494
|
+
}
|
|
1495
|
+
)
|
|
1496
|
+
}
|
|
1497
|
+
),
|
|
1498
|
+
/* @__PURE__ */ jsx9(IconButton, { style: { padding: 0, overflow: "hidden" }, onClick: insertLink, "aria-label": tr("actionInsertlink"), children: /* @__PURE__ */ jsx9(
|
|
1499
|
+
"i",
|
|
1500
|
+
{
|
|
1501
|
+
className: `c-rte-icon-link c-rte-floating-text-format-tb-plugin__format-icon ${isLink ? "selected" : ""}`
|
|
1502
|
+
}
|
|
1503
|
+
) }),
|
|
1504
|
+
/* @__PURE__ */ jsx9(
|
|
1505
|
+
IconButton,
|
|
1506
|
+
{
|
|
1596
1507
|
style: { padding: 0, overflow: "hidden" },
|
|
1597
1508
|
onClick: () => {
|
|
1598
1509
|
editor.dispatchCommand(FORMAT_TEXT_COMMAND, "strikethrough");
|
|
1599
1510
|
},
|
|
1600
1511
|
title: tr("actionFormatWithStrikethroughTitle"),
|
|
1601
1512
|
"aria-label": tr("actionFormatWithStrikethroughLabel"),
|
|
1602
|
-
children: /* @__PURE__ */ jsx9(
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1513
|
+
children: /* @__PURE__ */ jsx9(
|
|
1514
|
+
"i",
|
|
1515
|
+
{
|
|
1516
|
+
className: `c-rte-icon-strikethrough c-rte-floating-text-format-tb-plugin__format-icon ${isStrikethrough ? "selected" : ""}`
|
|
1517
|
+
}
|
|
1518
|
+
)
|
|
1519
|
+
}
|
|
1520
|
+
),
|
|
1521
|
+
/* @__PURE__ */ jsx9(
|
|
1522
|
+
IconButton,
|
|
1523
|
+
{
|
|
1607
1524
|
style: { padding: 0, overflow: "hidden" },
|
|
1608
1525
|
onClick: () => {
|
|
1609
1526
|
editor.dispatchCommand(FORMAT_TEXT_COMMAND, "subscript");
|
|
1610
1527
|
},
|
|
1611
1528
|
title: tr("actionFormatWithSubscriptTitle"),
|
|
1612
1529
|
"aria-label": tr("actionFormatWithSubscriptLabel"),
|
|
1613
|
-
children: /* @__PURE__ */ jsx9(
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1530
|
+
children: /* @__PURE__ */ jsx9(
|
|
1531
|
+
"i",
|
|
1532
|
+
{
|
|
1533
|
+
className: `c-rte-icon-subscript c-rte-floating-text-format-tb-plugin__format-icon ${isSubscript ? "selected" : ""}`
|
|
1534
|
+
}
|
|
1535
|
+
)
|
|
1536
|
+
}
|
|
1537
|
+
),
|
|
1538
|
+
/* @__PURE__ */ jsx9(
|
|
1539
|
+
IconButton,
|
|
1540
|
+
{
|
|
1618
1541
|
style: { padding: 0, overflow: "hidden" },
|
|
1619
1542
|
onClick: () => {
|
|
1620
1543
|
editor.dispatchCommand(FORMAT_TEXT_COMMAND, "superscript");
|
|
1621
1544
|
},
|
|
1622
1545
|
title: tr("actionFormatWithSuperscriptTitle"),
|
|
1623
1546
|
"aria-label": tr("actionFormatWithSuperscriptLabel"),
|
|
1624
|
-
children: /* @__PURE__ */ jsx9(
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1547
|
+
children: /* @__PURE__ */ jsx9(
|
|
1548
|
+
"i",
|
|
1549
|
+
{
|
|
1550
|
+
className: `c-rte-icon-superscript c-rte-floating-text-format-tb-plugin__format-icon ${isSuperscript ? "selected" : ""}`
|
|
1551
|
+
}
|
|
1552
|
+
)
|
|
1553
|
+
}
|
|
1554
|
+
)
|
|
1555
|
+
] });
|
|
1630
1556
|
}
|
|
1631
1557
|
function useFloatingTextFormatToolbar(editor, anchorElem) {
|
|
1632
1558
|
const [isText, setIsText] = useState6(false);
|
|
@@ -1696,18 +1622,21 @@ function useFloatingTextFormatToolbar(editor, anchorElem) {
|
|
|
1696
1622
|
return null;
|
|
1697
1623
|
}
|
|
1698
1624
|
return createPortal3(
|
|
1699
|
-
/* @__PURE__ */ jsx9(
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1625
|
+
/* @__PURE__ */ jsx9(
|
|
1626
|
+
TextFormatFloatingToolbar,
|
|
1627
|
+
{
|
|
1628
|
+
editor,
|
|
1629
|
+
anchorElem,
|
|
1630
|
+
isLink,
|
|
1631
|
+
isBold,
|
|
1632
|
+
isItalic,
|
|
1633
|
+
isStrikethrough,
|
|
1634
|
+
isSubscript,
|
|
1635
|
+
isSuperscript,
|
|
1636
|
+
isUnderline,
|
|
1637
|
+
isCode
|
|
1638
|
+
}
|
|
1639
|
+
),
|
|
1711
1640
|
anchorElem
|
|
1712
1641
|
);
|
|
1713
1642
|
}
|
|
@@ -1719,13 +1648,10 @@ function FloatingTextFormatToolbarPlugin({
|
|
|
1719
1648
|
}
|
|
1720
1649
|
|
|
1721
1650
|
// src/rich-text-editor/plugins/LinkPlugin/index.tsx
|
|
1722
|
-
import "react";
|
|
1723
1651
|
import { LinkPlugin as LexicalLinkPlugin } from "@lexical/react/LexicalLinkPlugin";
|
|
1724
1652
|
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
1725
1653
|
function LinkPlugin() {
|
|
1726
|
-
return /* @__PURE__ */ jsx10(LexicalLinkPlugin, {
|
|
1727
|
-
validateUrl
|
|
1728
|
-
});
|
|
1654
|
+
return /* @__PURE__ */ jsx10(LexicalLinkPlugin, { validateUrl });
|
|
1729
1655
|
}
|
|
1730
1656
|
|
|
1731
1657
|
// src/rich-text-editor/plugins/ListMaxIndentLevelPlugin/index.ts
|
|
@@ -2072,51 +1998,22 @@ function TableActionMenu({ tableCellNode: _tableCellNode, tableStats }) {
|
|
|
2072
1998
|
clearTableSelection();
|
|
2073
1999
|
});
|
|
2074
2000
|
}, [editor, tableCellNode, clearTableSelection]);
|
|
2075
|
-
return /* @__PURE__ */ jsxs6(Fragment4, {
|
|
2076
|
-
children:
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
children: tr("actionTableInsertColumnsAfter", selectionCounts.columns)
|
|
2092
|
-
}),
|
|
2093
|
-
/* @__PURE__ */ jsx11(DropdownMenu.Item, {
|
|
2094
|
-
onSelect: () => toggleTableRowIsHeader(),
|
|
2095
|
-
children: tr(
|
|
2096
|
-
(tableCellNode.__headerState & TableCellHeaderStates.ROW) === TableCellHeaderStates.ROW ? "actionTableRemoveRowHeader" : "actionTableAddRowHeader"
|
|
2097
|
-
)
|
|
2098
|
-
}),
|
|
2099
|
-
/* @__PURE__ */ jsx11(DropdownMenu.Item, {
|
|
2100
|
-
onSelect: () => toggleTableColumnIsHeader(),
|
|
2101
|
-
children: tr(
|
|
2102
|
-
(tableCellNode.__headerState & TableCellHeaderStates.COLUMN) === TableCellHeaderStates.COLUMN ? "actionTableRemoveColumnHeader" : "actionTableAddColumnHeader"
|
|
2103
|
-
)
|
|
2104
|
-
}),
|
|
2105
|
-
/* @__PURE__ */ jsx11(DropdownMenu.Separator, {}),
|
|
2106
|
-
tableStats.columns > 1 && /* @__PURE__ */ jsx11(DropdownMenu.Item, {
|
|
2107
|
-
onSelect: () => deleteTableColumnAtSelection(),
|
|
2108
|
-
children: tr("actionTableDeleteColumn")
|
|
2109
|
-
}),
|
|
2110
|
-
tableStats.rows > 1 && /* @__PURE__ */ jsx11(DropdownMenu.Item, {
|
|
2111
|
-
onSelect: () => deleteTableRowAtSelection(),
|
|
2112
|
-
children: tr("actionTableDeleteRow")
|
|
2113
|
-
}),
|
|
2114
|
-
/* @__PURE__ */ jsx11(DropdownMenu.Item, {
|
|
2115
|
-
onSelect: () => deleteTableAtSelection(),
|
|
2116
|
-
children: tr("actionTableDeleteTable")
|
|
2117
|
-
})
|
|
2118
|
-
]
|
|
2119
|
-
});
|
|
2001
|
+
return /* @__PURE__ */ jsxs6(Fragment4, { children: [
|
|
2002
|
+
/* @__PURE__ */ jsx11(DropdownMenu.Item, { onSelect: () => insertTableRowAtSelection(false), children: tr("actionTableInsertRowsAbove", selectionCounts.rows) }),
|
|
2003
|
+
/* @__PURE__ */ jsx11(DropdownMenu.Item, { onSelect: () => insertTableRowAtSelection(true), children: tr("actionTableInsertRowsBelow", selectionCounts.rows) }),
|
|
2004
|
+
/* @__PURE__ */ jsx11(DropdownMenu.Item, { onSelect: () => insertTableColumnAtSelection(false), children: tr("actionTableInsertColumnsBefore", selectionCounts.columns) }),
|
|
2005
|
+
/* @__PURE__ */ jsx11(DropdownMenu.Item, { onSelect: () => insertTableColumnAtSelection(true), children: tr("actionTableInsertColumnsAfter", selectionCounts.columns) }),
|
|
2006
|
+
/* @__PURE__ */ jsx11(DropdownMenu.Item, { onSelect: () => toggleTableRowIsHeader(), children: tr(
|
|
2007
|
+
(tableCellNode.__headerState & TableCellHeaderStates.ROW) === TableCellHeaderStates.ROW ? "actionTableRemoveRowHeader" : "actionTableAddRowHeader"
|
|
2008
|
+
) }),
|
|
2009
|
+
/* @__PURE__ */ jsx11(DropdownMenu.Item, { onSelect: () => toggleTableColumnIsHeader(), children: tr(
|
|
2010
|
+
(tableCellNode.__headerState & TableCellHeaderStates.COLUMN) === TableCellHeaderStates.COLUMN ? "actionTableRemoveColumnHeader" : "actionTableAddColumnHeader"
|
|
2011
|
+
) }),
|
|
2012
|
+
/* @__PURE__ */ jsx11(DropdownMenu.Separator, {}),
|
|
2013
|
+
tableStats.columns > 1 && /* @__PURE__ */ jsx11(DropdownMenu.Item, { onSelect: () => deleteTableColumnAtSelection(), children: tr("actionTableDeleteColumn") }),
|
|
2014
|
+
tableStats.rows > 1 && /* @__PURE__ */ jsx11(DropdownMenu.Item, { onSelect: () => deleteTableRowAtSelection(), children: tr("actionTableDeleteRow") }),
|
|
2015
|
+
/* @__PURE__ */ jsx11(DropdownMenu.Item, { onSelect: () => deleteTableAtSelection(), children: tr("actionTableDeleteTable") })
|
|
2016
|
+
] });
|
|
2120
2017
|
}
|
|
2121
2018
|
function TableCellActionMenuContainer({ anchorElem }) {
|
|
2122
2019
|
const [editor] = useLexicalComposerContext9();
|
|
@@ -2193,30 +2090,20 @@ function TableCellActionMenuContainer({ anchorElem }) {
|
|
|
2193
2090
|
}
|
|
2194
2091
|
}
|
|
2195
2092
|
}, [menuButtonRef, tableCellNode, editor, anchorElem]);
|
|
2196
|
-
return /* @__PURE__ */ jsx11("div", {
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
children: tableCellNode != null && /* @__PURE__ */ jsx11(DropdownMenu.Root, {
|
|
2093
|
+
return /* @__PURE__ */ jsx11("div", { className: "c-rte-table-cell-action-button-container", ref: menuButtonRef, children: tableCellNode != null && /* @__PURE__ */ jsx11(
|
|
2094
|
+
DropdownMenu.Root,
|
|
2095
|
+
{
|
|
2200
2096
|
onOpenChange: (isOpen) => setIsMenuOpen(isOpen),
|
|
2201
|
-
content: /* @__PURE__ */ jsx11(TableActionMenu, {
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
children: /* @__PURE__ */ jsx11(IconButton, {
|
|
2206
|
-
size: "xs",
|
|
2207
|
-
"aria-label": tr("actionTableOpenOptions"),
|
|
2208
|
-
children: /* @__PURE__ */ jsx11(Icon.Arrow, {})
|
|
2209
|
-
})
|
|
2210
|
-
})
|
|
2211
|
-
});
|
|
2097
|
+
content: /* @__PURE__ */ jsx11(TableActionMenu, { tableCellNode, tableStats }),
|
|
2098
|
+
children: /* @__PURE__ */ jsx11(IconButton, { size: "xs", "aria-label": tr("actionTableOpenOptions"), children: /* @__PURE__ */ jsx11(Icon.Arrow, {}) })
|
|
2099
|
+
}
|
|
2100
|
+
) });
|
|
2212
2101
|
}
|
|
2213
2102
|
function TableActionMenuPlugin({
|
|
2214
2103
|
anchorElem = document.body
|
|
2215
2104
|
}) {
|
|
2216
2105
|
const isEditable = useLexicalEditable();
|
|
2217
|
-
return createPortal4(isEditable ? /* @__PURE__ */ jsx11(TableCellActionMenuContainer, {
|
|
2218
|
-
anchorElem
|
|
2219
|
-
}) : null, anchorElem);
|
|
2106
|
+
return createPortal4(isEditable ? /* @__PURE__ */ jsx11(TableCellActionMenuContainer, { anchorElem }) : null, anchorElem);
|
|
2220
2107
|
}
|
|
2221
2108
|
|
|
2222
2109
|
// src/rich-text-editor/plugins/ToolbarPlugin/index.tsx
|
|
@@ -2280,19 +2167,21 @@ async function copyJson(editor) {
|
|
|
2280
2167
|
function ActionsPlugin({ append, prepend, disabled }) {
|
|
2281
2168
|
const [editor] = useLexicalComposerContext10();
|
|
2282
2169
|
const tr = useTr();
|
|
2283
|
-
return /* @__PURE__ */ jsxs7(ActionMenu, {
|
|
2284
|
-
|
|
2285
|
-
|
|
2170
|
+
return /* @__PURE__ */ jsxs7(ActionMenu, { children: [
|
|
2171
|
+
!prepend ? null : prepend.map((actionItem) => /* @__PURE__ */ jsx12(
|
|
2172
|
+
ActionMenu.Item,
|
|
2173
|
+
{
|
|
2286
2174
|
onSelect: actionItem.action,
|
|
2287
2175
|
className: actionItem.type === "danger" ? "danger" : "",
|
|
2288
2176
|
disabled: actionItem.disabled,
|
|
2289
2177
|
children: actionItem.title
|
|
2290
|
-
},
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2178
|
+
},
|
|
2179
|
+
actionItem.title
|
|
2180
|
+
)),
|
|
2181
|
+
/* @__PURE__ */ jsx12(ActionMenu.Item, { onSelect: () => copyJson(editor), children: tr("actionCopyJSON") }),
|
|
2182
|
+
/* @__PURE__ */ jsx12(
|
|
2183
|
+
ActionMenu.Item,
|
|
2184
|
+
{
|
|
2296
2185
|
disabled,
|
|
2297
2186
|
className: "danger",
|
|
2298
2187
|
onSelect: () => {
|
|
@@ -2300,15 +2189,19 @@ function ActionsPlugin({ append, prepend, disabled }) {
|
|
|
2300
2189
|
editor.focus();
|
|
2301
2190
|
},
|
|
2302
2191
|
children: tr("actionClear")
|
|
2303
|
-
}
|
|
2304
|
-
|
|
2192
|
+
}
|
|
2193
|
+
),
|
|
2194
|
+
!append ? null : append.map((actionItem) => /* @__PURE__ */ jsx12(
|
|
2195
|
+
ActionMenu.Item,
|
|
2196
|
+
{
|
|
2305
2197
|
onSelect: actionItem.action,
|
|
2306
2198
|
className: actionItem.type === "danger" ? "danger" : "",
|
|
2307
2199
|
disabled: actionItem.disabled,
|
|
2308
2200
|
children: actionItem.title
|
|
2309
|
-
},
|
|
2310
|
-
|
|
2311
|
-
|
|
2201
|
+
},
|
|
2202
|
+
actionItem.title
|
|
2203
|
+
))
|
|
2204
|
+
] });
|
|
2312
2205
|
}
|
|
2313
2206
|
|
|
2314
2207
|
// src/rich-text-editor/plugins/ToolbarPlugin/insert-table.tsx
|
|
@@ -2332,46 +2225,34 @@ function InsertTableDialog({ activeEditor }) {
|
|
|
2332
2225
|
}
|
|
2333
2226
|
});
|
|
2334
2227
|
};
|
|
2335
|
-
return /* @__PURE__ */ jsxs8("div", {
|
|
2336
|
-
className: "c-rte-insert-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
className: "c-rte-insert-table__actions",
|
|
2364
|
-
children: /* @__PURE__ */ jsx13(Button, {
|
|
2365
|
-
as: Dialog.Close,
|
|
2366
|
-
size: "sm",
|
|
2367
|
-
intent: "action",
|
|
2368
|
-
"aria-label": tr("insertTableCommit"),
|
|
2369
|
-
onClick,
|
|
2370
|
-
children: tr("insertTableCommit")
|
|
2371
|
-
})
|
|
2372
|
-
})
|
|
2373
|
-
]
|
|
2374
|
-
});
|
|
2228
|
+
return /* @__PURE__ */ jsxs8("div", { className: "c-rte-insert-table", children: [
|
|
2229
|
+
/* @__PURE__ */ jsxs8("div", { className: "c-rte-insert-table__dimensions", children: [
|
|
2230
|
+
/* @__PURE__ */ jsx13(
|
|
2231
|
+
InputWithLabel,
|
|
2232
|
+
{
|
|
2233
|
+
label: tr("insertTableRows"),
|
|
2234
|
+
value: rows,
|
|
2235
|
+
placeholder: "0",
|
|
2236
|
+
type: "text",
|
|
2237
|
+
inputMode: "numeric",
|
|
2238
|
+
onChange: (e) => setRows(e.target.value)
|
|
2239
|
+
}
|
|
2240
|
+
),
|
|
2241
|
+
/* @__PURE__ */ jsx13("span", { className: "c-rte-insert-table__dimensions__separator" }),
|
|
2242
|
+
/* @__PURE__ */ jsx13(
|
|
2243
|
+
InputWithLabel,
|
|
2244
|
+
{
|
|
2245
|
+
type: "text",
|
|
2246
|
+
label: tr("insertTableColumns"),
|
|
2247
|
+
placeholder: "0",
|
|
2248
|
+
value: columns,
|
|
2249
|
+
inputMode: "numeric",
|
|
2250
|
+
onChange: (e) => setColumns(e.target.value)
|
|
2251
|
+
}
|
|
2252
|
+
)
|
|
2253
|
+
] }),
|
|
2254
|
+
/* @__PURE__ */ jsx13("div", { className: "c-rte-insert-table__actions", children: /* @__PURE__ */ jsx13(Button, { as: Dialog.Close, size: "sm", intent: "action", "aria-label": tr("insertTableCommit"), onClick, children: tr("insertTableCommit") }) })
|
|
2255
|
+
] });
|
|
2375
2256
|
}
|
|
2376
2257
|
|
|
2377
2258
|
// src/rich-text-editor/plugins/ToolbarPlugin/index.tsx
|
|
@@ -2479,104 +2360,84 @@ function BlockFormatDropDown({
|
|
|
2479
2360
|
});
|
|
2480
2361
|
}
|
|
2481
2362
|
};
|
|
2482
|
-
return /* @__PURE__ */ jsx14(
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2363
|
+
return /* @__PURE__ */ jsx14(
|
|
2364
|
+
DropdownMenu.Root,
|
|
2365
|
+
{
|
|
2366
|
+
disabled,
|
|
2367
|
+
style: { zIndex: 1 },
|
|
2368
|
+
content: /* @__PURE__ */ jsxs9(Fragment5, { children: [
|
|
2369
|
+
/* @__PURE__ */ jsxs9(DropdownMenu.Item, { onClick: formatParagraph, children: [
|
|
2370
|
+
/* @__PURE__ */ jsx14(
|
|
2371
|
+
"i",
|
|
2372
|
+
{
|
|
2491
2373
|
className: `c-rte-icon-paragraph c-rte-toolbar__block-format__icon ${blockType === "paragraph" ? "selected" : ""}`
|
|
2492
|
-
}
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
onClick: () => formatHeading(headingSize),
|
|
2501
|
-
children: [
|
|
2502
|
-
/* @__PURE__ */ jsx14("i", {
|
|
2374
|
+
}
|
|
2375
|
+
),
|
|
2376
|
+
/* @__PURE__ */ jsx14("span", { className: `c-rte-toolbar__block-format__text ${blockType === "paragraph" ? "selected" : ""}`, children: "Normal" })
|
|
2377
|
+
] }),
|
|
2378
|
+
headings.map((headingSize) => /* @__PURE__ */ jsxs9(DropdownMenu.Item, { onClick: () => formatHeading(headingSize), children: [
|
|
2379
|
+
/* @__PURE__ */ jsx14(
|
|
2380
|
+
"i",
|
|
2381
|
+
{
|
|
2503
2382
|
className: `c-rte-icon-${headingSize} c-rte-toolbar__block-format__icon ${blockType === headingSize ? "selected" : ""}`
|
|
2504
|
-
}
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
onClick: formatBulletList,
|
|
2513
|
-
children: [
|
|
2514
|
-
/* @__PURE__ */ jsx14("i", {
|
|
2383
|
+
}
|
|
2384
|
+
),
|
|
2385
|
+
/* @__PURE__ */ jsx14("span", { className: `c-rte-toolbar__block-format__text ${blockType === headingSize ? "selected" : ""}`, children: headingTypeToBlockName[headingSize] })
|
|
2386
|
+
] }, headingSize)),
|
|
2387
|
+
/* @__PURE__ */ jsxs9(DropdownMenu.Item, { onClick: formatBulletList, children: [
|
|
2388
|
+
/* @__PURE__ */ jsx14(
|
|
2389
|
+
"i",
|
|
2390
|
+
{
|
|
2515
2391
|
className: `c-rte-icon-bullet-list c-rte-toolbar__block-format__icon ${blockType === "bullet" ? "selected" : ""}`
|
|
2516
|
-
}
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
onClick: formatNumberedList,
|
|
2525
|
-
children: [
|
|
2526
|
-
/* @__PURE__ */ jsx14("i", {
|
|
2392
|
+
}
|
|
2393
|
+
),
|
|
2394
|
+
/* @__PURE__ */ jsx14("span", { className: `c-rte-toolbar__block-format__text ${blockType === "bullet" ? "selected" : ""}`, children: "Bullet List" })
|
|
2395
|
+
] }),
|
|
2396
|
+
/* @__PURE__ */ jsxs9(DropdownMenu.Item, { onClick: formatNumberedList, children: [
|
|
2397
|
+
/* @__PURE__ */ jsx14(
|
|
2398
|
+
"i",
|
|
2399
|
+
{
|
|
2527
2400
|
className: `c-rte-icon-numbered-list c-rte-toolbar__block-format__icon ${blockType === "number" ? "selected" : ""}`
|
|
2528
|
-
}
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
onClick: formatQuote,
|
|
2537
|
-
"data-testid": "toggle-block-format-quote",
|
|
2538
|
-
children: [
|
|
2539
|
-
/* @__PURE__ */ jsx14("i", {
|
|
2401
|
+
}
|
|
2402
|
+
),
|
|
2403
|
+
/* @__PURE__ */ jsx14("span", { className: `c-rte-toolbar__block-format__text ${blockType === "number" ? "selected" : ""}`, children: "Numbered List" })
|
|
2404
|
+
] }),
|
|
2405
|
+
/* @__PURE__ */ jsxs9(DropdownMenu.Item, { onClick: formatQuote, "data-testid": "toggle-block-format-quote", children: [
|
|
2406
|
+
/* @__PURE__ */ jsx14(
|
|
2407
|
+
"i",
|
|
2408
|
+
{
|
|
2540
2409
|
className: `c-rte-icon-quote c-rte-toolbar__block-format__icon ${blockType === "quote" ? "selected" : ""}`
|
|
2541
|
-
}
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
onClick: formatCode,
|
|
2550
|
-
"data-testid": "toggle-block-format-code",
|
|
2551
|
-
children: [
|
|
2552
|
-
/* @__PURE__ */ jsx14("i", {
|
|
2410
|
+
}
|
|
2411
|
+
),
|
|
2412
|
+
/* @__PURE__ */ jsx14("span", { className: `c-rte-toolbar__block-format__text ${blockType === "quote" ? "selected" : ""}`, children: "Quote" })
|
|
2413
|
+
] }),
|
|
2414
|
+
/* @__PURE__ */ jsxs9(DropdownMenu.Item, { onClick: formatCode, "data-testid": "toggle-block-format-code", children: [
|
|
2415
|
+
/* @__PURE__ */ jsx14(
|
|
2416
|
+
"i",
|
|
2417
|
+
{
|
|
2553
2418
|
className: `icon c-rte-icon-code c-rte-toolbar__block-format__icon ${blockType === "code" ? "selected" : ""}`
|
|
2554
|
-
}
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2419
|
+
}
|
|
2420
|
+
),
|
|
2421
|
+
/* @__PURE__ */ jsx14("span", { className: `c-rte-toolbar__block-format__text ${blockType === "code" ? "selected" : ""}`, children: "Code block" })
|
|
2422
|
+
] })
|
|
2423
|
+
] }),
|
|
2424
|
+
children: /* @__PURE__ */ jsxs9(
|
|
2425
|
+
Button,
|
|
2426
|
+
{
|
|
2427
|
+
style: { backgroundColor: "transparent", padding: "0 8px" },
|
|
2428
|
+
"aria-label": "Formatting options for text style",
|
|
2429
|
+
"data-testid": "toggle-block-format",
|
|
2430
|
+
children: [
|
|
2431
|
+
/* @__PURE__ */ jsx14("i", { className: `c-rte-toolbar__toggle-icon c-rte-icon-${blockType}` }),
|
|
2432
|
+
/* @__PURE__ */ jsx14(Icon.Arrow, {})
|
|
2559
2433
|
]
|
|
2560
|
-
}
|
|
2561
|
-
|
|
2562
|
-
}
|
|
2563
|
-
|
|
2564
|
-
style: { backgroundColor: "transparent", padding: "0 8px" },
|
|
2565
|
-
"aria-label": "Formatting options for text style",
|
|
2566
|
-
"data-testid": "toggle-block-format",
|
|
2567
|
-
children: [
|
|
2568
|
-
/* @__PURE__ */ jsx14("i", {
|
|
2569
|
-
className: `c-rte-toolbar__toggle-icon c-rte-icon-${blockType}`
|
|
2570
|
-
}),
|
|
2571
|
-
/* @__PURE__ */ jsx14(Icon.Arrow, {})
|
|
2572
|
-
]
|
|
2573
|
-
})
|
|
2574
|
-
});
|
|
2434
|
+
}
|
|
2435
|
+
)
|
|
2436
|
+
}
|
|
2437
|
+
);
|
|
2575
2438
|
}
|
|
2576
2439
|
function Divider() {
|
|
2577
|
-
return /* @__PURE__ */ jsx14("div", {
|
|
2578
|
-
className: "c-rte-toolbar__divider"
|
|
2579
|
-
});
|
|
2440
|
+
return /* @__PURE__ */ jsx14("div", { className: "c-rte-toolbar__divider" });
|
|
2580
2441
|
}
|
|
2581
2442
|
function ToolbarPlugin({
|
|
2582
2443
|
actionsMenuPrepend,
|
|
@@ -2724,294 +2585,267 @@ function ToolbarPlugin({
|
|
|
2724
2585
|
},
|
|
2725
2586
|
[activeEditor, selectedElementKey]
|
|
2726
2587
|
);
|
|
2727
|
-
return /* @__PURE__ */ jsxs9("div", {
|
|
2728
|
-
className: "c-rte-
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
|
|
2588
|
+
return /* @__PURE__ */ jsxs9("div", { className: "c-rte-toolbar", children: [
|
|
2589
|
+
/* @__PURE__ */ jsxs9("div", { className: "c-rte-toolbar__inner", children: [
|
|
2590
|
+
/* @__PURE__ */ jsx14(
|
|
2591
|
+
IconButton,
|
|
2592
|
+
{
|
|
2593
|
+
disabled: !canUndo || !isEditable,
|
|
2594
|
+
onClick: () => {
|
|
2595
|
+
activeEditor.dispatchCommand(UNDO_COMMAND, void 0);
|
|
2596
|
+
},
|
|
2597
|
+
type: "button",
|
|
2598
|
+
title: tr(IS_APPLE ? "actionUndoTitleApple" : "actionUndoTitle"),
|
|
2599
|
+
"aria-label": tr("actionUndoLabel"),
|
|
2600
|
+
"data-testid": "rich-text-undo-button",
|
|
2601
|
+
children: /* @__PURE__ */ jsx14(
|
|
2602
|
+
"i",
|
|
2603
|
+
{
|
|
2604
|
+
className: `c-rte-icon-undo c-rte-toolbar__icon ${!canUndo ? "disabled" : ""}
|
|
2605
|
+
`
|
|
2606
|
+
}
|
|
2607
|
+
)
|
|
2608
|
+
}
|
|
2609
|
+
),
|
|
2610
|
+
/* @__PURE__ */ jsx14(
|
|
2611
|
+
IconButton,
|
|
2612
|
+
{
|
|
2613
|
+
disabled: !canRedo || !isEditable,
|
|
2614
|
+
onClick: () => {
|
|
2615
|
+
activeEditor.dispatchCommand(REDO_COMMAND, void 0);
|
|
2616
|
+
},
|
|
2617
|
+
type: "button",
|
|
2618
|
+
title: tr(IS_APPLE ? "actionRedoTitleApple" : "actionRedoTitle"),
|
|
2619
|
+
"aria-label": tr("actionRedoLabel"),
|
|
2620
|
+
children: /* @__PURE__ */ jsx14("i", { className: `c-rte-icon-redo c-rte-toolbar__icon ${!canRedo ? "disabled" : ""}` })
|
|
2621
|
+
}
|
|
2622
|
+
),
|
|
2623
|
+
/* @__PURE__ */ jsx14(Divider, {}),
|
|
2624
|
+
blockType in blockTypeToBlockName && activeEditor === editor && /* @__PURE__ */ jsxs9(Fragment5, { children: [
|
|
2625
|
+
/* @__PURE__ */ jsx14(BlockFormatDropDown, { disabled: !isEditable, blockType, editor }),
|
|
2626
|
+
/* @__PURE__ */ jsx14(Divider, {})
|
|
2627
|
+
] }),
|
|
2628
|
+
blockType === "code" ? /* @__PURE__ */ jsx14(Fragment5, { children: /* @__PURE__ */ jsx14(
|
|
2629
|
+
DropdownMenu.Root,
|
|
2630
|
+
{
|
|
2631
|
+
disabled: !isEditable,
|
|
2632
|
+
style: { zIndex: 1 },
|
|
2633
|
+
content: /* @__PURE__ */ jsx14(Fragment5, { children: CODE_LANGUAGE_OPTIONS.map(([value, name]) => {
|
|
2634
|
+
return /* @__PURE__ */ jsx14(
|
|
2635
|
+
DropdownMenu.Item,
|
|
2636
|
+
{
|
|
2637
|
+
className: `item ${dropDownActiveClass(value === codeLanguage)}`,
|
|
2638
|
+
onClick: () => onCodeLanguageSelect(value),
|
|
2639
|
+
children: /* @__PURE__ */ jsx14(
|
|
2640
|
+
"span",
|
|
2641
|
+
{
|
|
2642
|
+
className: `c-rte-toolbar__code-lang__sel-item ${dropDownActiveClass(value === codeLanguage) ? "selected" : ""}`,
|
|
2643
|
+
children: name
|
|
2644
|
+
}
|
|
2645
|
+
)
|
|
2646
|
+
},
|
|
2647
|
+
value
|
|
2648
|
+
);
|
|
2649
|
+
}) }),
|
|
2650
|
+
children: /* @__PURE__ */ jsx14(Button, { "aria-label": tr("codeSelectLanguage"), append: /* @__PURE__ */ jsx14(Icon.Arrow, {}), children: /* @__PURE__ */ jsx14("span", { className: "c-rte-toolbar__code-lang__button-text", children: getLanguageFriendlyName2(codeLanguage) }) })
|
|
2651
|
+
}
|
|
2652
|
+
) }) : /* @__PURE__ */ jsx14(Dialog, { children: /* @__PURE__ */ jsxs9("div", { className: "c-rte-toolbar__actions-rest", children: [
|
|
2653
|
+
/* @__PURE__ */ jsx14(
|
|
2654
|
+
IconButton,
|
|
2655
|
+
{
|
|
2656
|
+
disabled: !isEditable,
|
|
2657
|
+
className: `c-rte-toolbar__icon-btn ${isBold ? "selected" : ""}`,
|
|
2658
|
+
type: "button",
|
|
2659
|
+
title: tr(IS_APPLE ? "actionFormatAsStrongTitleApple" : "actionFormatAsStrongTitle"),
|
|
2660
|
+
"aria-label": tr("actionFormatAsStrongLabel"),
|
|
2661
|
+
"data-testid": "toggle-format-bold",
|
|
2662
|
+
onClick: () => {
|
|
2663
|
+
activeEditor.dispatchCommand(FORMAT_TEXT_COMMAND2, "bold");
|
|
2664
|
+
},
|
|
2665
|
+
children: /* @__PURE__ */ jsx14("i", { className: `c-rte-toolbar__icon-btn__icon c-rte-icon-bold` })
|
|
2666
|
+
}
|
|
2667
|
+
),
|
|
2668
|
+
/* @__PURE__ */ jsx14(
|
|
2669
|
+
IconButton,
|
|
2670
|
+
{
|
|
2671
|
+
className: `c-rte-toolbar__icon-btn ${isItalic ? "selected" : ""}`,
|
|
2672
|
+
disabled: !isEditable,
|
|
2735
2673
|
onClick: () => {
|
|
2736
|
-
activeEditor.dispatchCommand(
|
|
2674
|
+
activeEditor.dispatchCommand(FORMAT_TEXT_COMMAND2, "italic");
|
|
2737
2675
|
},
|
|
2738
2676
|
type: "button",
|
|
2739
|
-
title: tr(IS_APPLE ? "
|
|
2740
|
-
"aria-label": tr("
|
|
2741
|
-
"data-testid": "
|
|
2742
|
-
children: /* @__PURE__ */ jsx14("i", {
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
|
|
2677
|
+
title: tr(IS_APPLE ? "actionFormatAsEmphasizedTitleApple" : "actionFormatAsEmphasizedTitle"),
|
|
2678
|
+
"aria-label": tr("actionFormatAsEmphasizedLabel"),
|
|
2679
|
+
"data-testid": "toggle-format-emphasized",
|
|
2680
|
+
children: /* @__PURE__ */ jsx14("i", { className: `c-rte-toolbar__icon-btn__icon c-rte-icon-italic` })
|
|
2681
|
+
}
|
|
2682
|
+
),
|
|
2683
|
+
/* @__PURE__ */ jsx14(
|
|
2684
|
+
IconButton,
|
|
2685
|
+
{
|
|
2686
|
+
className: `c-rte-toolbar__icon-btn ${isUnderline ? "selected" : ""}`,
|
|
2687
|
+
disabled: !isEditable,
|
|
2688
|
+
onClick: () => {
|
|
2689
|
+
activeEditor.dispatchCommand(FORMAT_TEXT_COMMAND2, "underline");
|
|
2690
|
+
},
|
|
2691
|
+
type: "button",
|
|
2692
|
+
title: tr(IS_APPLE ? "actionFormatAsUnderlinedTitleApple" : "actionFormatAsUnderlinedTitle"),
|
|
2693
|
+
"aria-label": tr("actionFormatAsUnderlinedLabel"),
|
|
2694
|
+
"data-testid": "toggle-format-underlined",
|
|
2695
|
+
children: /* @__PURE__ */ jsx14("i", { className: `c-rte-toolbar__icon-btn__icon c-rte-icon-underline` })
|
|
2696
|
+
}
|
|
2697
|
+
),
|
|
2698
|
+
/* @__PURE__ */ jsx14(
|
|
2699
|
+
IconButton,
|
|
2700
|
+
{
|
|
2701
|
+
className: `c-rte-toolbar__icon-btn ${isCode ? "selected" : ""}`,
|
|
2702
|
+
disabled: !isEditable,
|
|
2749
2703
|
onClick: () => {
|
|
2750
|
-
activeEditor.dispatchCommand(
|
|
2704
|
+
activeEditor.dispatchCommand(FORMAT_TEXT_COMMAND2, "code");
|
|
2751
2705
|
},
|
|
2752
2706
|
type: "button",
|
|
2753
|
-
title: tr(
|
|
2754
|
-
"aria-label": tr("
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
|
|
2769
|
-
}
|
|
2770
|
-
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
|
-
className: `c-rte-toolbar__code-lang__sel-item ${dropDownActiveClass(value === codeLanguage) ? "selected" : ""}`,
|
|
2781
|
-
children: name
|
|
2782
|
-
})
|
|
2783
|
-
}, value);
|
|
2784
|
-
})
|
|
2785
|
-
}),
|
|
2786
|
-
children: /* @__PURE__ */ jsx14(Button, {
|
|
2787
|
-
"aria-label": tr("codeSelectLanguage"),
|
|
2788
|
-
append: /* @__PURE__ */ jsx14(Icon.Arrow, {}),
|
|
2789
|
-
children: /* @__PURE__ */ jsx14("span", {
|
|
2790
|
-
className: "c-rte-toolbar__code-lang__button-text",
|
|
2791
|
-
children: getLanguageFriendlyName2(codeLanguage)
|
|
2792
|
-
})
|
|
2793
|
-
})
|
|
2794
|
-
})
|
|
2795
|
-
}) : /* @__PURE__ */ jsx14(Dialog, {
|
|
2796
|
-
children: /* @__PURE__ */ jsxs9("div", {
|
|
2797
|
-
className: "c-rte-toolbar__actions-rest",
|
|
2798
|
-
children: [
|
|
2799
|
-
/* @__PURE__ */ jsx14(IconButton, {
|
|
2707
|
+
title: tr("actionInsertCodeBlock"),
|
|
2708
|
+
"aria-label": tr("actionInsertCodeBlock"),
|
|
2709
|
+
"data-testid": "toggle-format-code",
|
|
2710
|
+
children: /* @__PURE__ */ jsx14("i", { className: `c-rte-toolbar__icon-btn__icon c-rte-icon-code` })
|
|
2711
|
+
}
|
|
2712
|
+
),
|
|
2713
|
+
/* @__PURE__ */ jsx14(
|
|
2714
|
+
IconButton,
|
|
2715
|
+
{
|
|
2716
|
+
className: `c-rte-toolbar__icon-btn ${isLink ? "selected" : ""}`,
|
|
2717
|
+
disabled: !isEditable,
|
|
2718
|
+
onClick: insertLink,
|
|
2719
|
+
type: "button",
|
|
2720
|
+
"aria-label": tr("actionInsertlink"),
|
|
2721
|
+
title: tr("actionInsertlink"),
|
|
2722
|
+
children: /* @__PURE__ */ jsx14("i", { className: `c-rte-toolbar__icon-btn__icon c-rte-icon-link` })
|
|
2723
|
+
}
|
|
2724
|
+
),
|
|
2725
|
+
/* @__PURE__ */ jsx14(
|
|
2726
|
+
DropdownMenu.Root,
|
|
2727
|
+
{
|
|
2728
|
+
disabled: !isEditable,
|
|
2729
|
+
style: { zIndex: 1 },
|
|
2730
|
+
content: /* @__PURE__ */ jsxs9(Fragment5, { children: [
|
|
2731
|
+
/* @__PURE__ */ jsxs9(
|
|
2732
|
+
DropdownMenu.Item,
|
|
2733
|
+
{
|
|
2800
2734
|
disabled: !isEditable,
|
|
2801
|
-
|
|
2802
|
-
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
|
|
2735
|
+
onClick: () => activeEditor.dispatchCommand(FORMAT_TEXT_COMMAND2, "strikethrough"),
|
|
2736
|
+
title: tr("actionFormatWithStrikethroughTitle"),
|
|
2737
|
+
"aria-label": tr("actionFormatWithStrikethroughLabel"),
|
|
2738
|
+
children: [
|
|
2739
|
+
/* @__PURE__ */ jsx14(
|
|
2740
|
+
"i",
|
|
2741
|
+
{
|
|
2742
|
+
className: `c-rte-icon-strikethrough c-rte-toolbar__dd-item__icon ${isStrikethrough ? "selected" : ""}`
|
|
2743
|
+
}
|
|
2744
|
+
),
|
|
2745
|
+
/* @__PURE__ */ jsx14("span", { className: `c-rte-toolbar__dd-item__text ${isStrikethrough ? "selected" : ""}`, children: tr("actionFormatWithStrikethroughTitle") })
|
|
2746
|
+
]
|
|
2747
|
+
}
|
|
2748
|
+
),
|
|
2749
|
+
/* @__PURE__ */ jsxs9(
|
|
2750
|
+
DropdownMenu.Item,
|
|
2751
|
+
{
|
|
2815
2752
|
disabled: !isEditable,
|
|
2816
|
-
onClick: () =>
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2753
|
+
onClick: () => activeEditor.dispatchCommand(FORMAT_TEXT_COMMAND2, "subscript"),
|
|
2754
|
+
title: tr("actionFormatWithSubscriptTitle"),
|
|
2755
|
+
"aria-label": tr("actionFormatWithSubscriptLabel"),
|
|
2756
|
+
children: [
|
|
2757
|
+
/* @__PURE__ */ jsx14(
|
|
2758
|
+
"i",
|
|
2759
|
+
{
|
|
2760
|
+
className: `c-rte-icon-subscript c-rte-toolbar__dd-item__icon ${isSubscript ? "selected" : ""}`
|
|
2761
|
+
}
|
|
2762
|
+
),
|
|
2763
|
+
/* @__PURE__ */ jsx14("span", { className: `c-rte-toolbar__dd-item__text ${isSubscript ? "selected" : ""}`, children: tr("actionFormatWithSubscriptTitle") })
|
|
2764
|
+
]
|
|
2765
|
+
}
|
|
2766
|
+
),
|
|
2767
|
+
/* @__PURE__ */ jsxs9(
|
|
2768
|
+
DropdownMenu.Item,
|
|
2769
|
+
{
|
|
2829
2770
|
disabled: !isEditable,
|
|
2830
|
-
onClick: () =>
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
2771
|
+
onClick: () => activeEditor.dispatchCommand(FORMAT_TEXT_COMMAND2, "superscript"),
|
|
2772
|
+
title: tr("actionFormatWithSuperscriptTitle"),
|
|
2773
|
+
"aria-label": tr("actionFormatWithSuperscriptLabel"),
|
|
2774
|
+
children: [
|
|
2775
|
+
/* @__PURE__ */ jsx14(
|
|
2776
|
+
"i",
|
|
2777
|
+
{
|
|
2778
|
+
className: `c-rte-icon-superscript c-rte-toolbar__dd-item__icon ${isSuperscript ? "selected" : ""}`
|
|
2779
|
+
}
|
|
2780
|
+
),
|
|
2781
|
+
/* @__PURE__ */ jsx14("span", { className: `c-rte-toolbar__dd-item__text ${isSuperscript ? "selected" : ""}`, children: tr("actionFormatWithSuperscriptTitle") })
|
|
2782
|
+
]
|
|
2783
|
+
}
|
|
2784
|
+
),
|
|
2785
|
+
/* @__PURE__ */ jsxs9(
|
|
2786
|
+
DropdownMenu.Item,
|
|
2787
|
+
{
|
|
2843
2788
|
disabled: !isEditable,
|
|
2789
|
+
onClick: clearFormatting,
|
|
2790
|
+
className: "item",
|
|
2791
|
+
title: tr("actionClearTextFormatting"),
|
|
2792
|
+
"aria-label": tr("actionClearTextFormatting"),
|
|
2793
|
+
children: [
|
|
2794
|
+
/* @__PURE__ */ jsx14("i", { className: "c-rte-icon-clear c-rte-toolbar__dd-item__icon" }),
|
|
2795
|
+
/* @__PURE__ */ jsx14("span", { className: "c-rte-toolbar__dd-item__text--clear", children: tr("actionFormatClear") })
|
|
2796
|
+
]
|
|
2797
|
+
}
|
|
2798
|
+
)
|
|
2799
|
+
] }),
|
|
2800
|
+
children: /* @__PURE__ */ jsxs9(
|
|
2801
|
+
Button,
|
|
2802
|
+
{
|
|
2803
|
+
style: { backgroundColor: "transparent", padding: "0 8px" },
|
|
2804
|
+
"aria-label": tr("actionTextFormattingOptions"),
|
|
2805
|
+
children: [
|
|
2806
|
+
/* @__PURE__ */ jsx14("i", { className: `c-rte-icon-dropdown-more c-rte-toolbar__toggle-icon` }),
|
|
2807
|
+
/* @__PURE__ */ jsx14(Icon.Arrow, {})
|
|
2808
|
+
]
|
|
2809
|
+
}
|
|
2810
|
+
)
|
|
2811
|
+
}
|
|
2812
|
+
),
|
|
2813
|
+
/* @__PURE__ */ jsx14(Divider, {}),
|
|
2814
|
+
/* @__PURE__ */ jsx14(
|
|
2815
|
+
DropdownMenu.Root,
|
|
2816
|
+
{
|
|
2817
|
+
style: { zIndex: 1 },
|
|
2818
|
+
disabled: !isEditable,
|
|
2819
|
+
content: /* @__PURE__ */ jsxs9(Fragment5, { children: [
|
|
2820
|
+
/* @__PURE__ */ jsxs9(
|
|
2821
|
+
DropdownMenu.Item,
|
|
2822
|
+
{
|
|
2844
2823
|
onClick: () => {
|
|
2845
|
-
activeEditor.dispatchCommand(
|
|
2824
|
+
activeEditor.dispatchCommand(INSERT_HORIZONTAL_RULE_COMMAND, void 0);
|
|
2846
2825
|
},
|
|
2847
|
-
type: "button",
|
|
2848
|
-
title: tr("actionInsertCodeBlock"),
|
|
2849
|
-
"aria-label": tr("actionInsertCodeBlock"),
|
|
2850
|
-
"data-testid": "toggle-format-code",
|
|
2851
|
-
children: /* @__PURE__ */ jsx14("i", {
|
|
2852
|
-
className: `c-rte-toolbar__icon-btn__icon c-rte-icon-code`
|
|
2853
|
-
})
|
|
2854
|
-
}),
|
|
2855
|
-
/* @__PURE__ */ jsx14(IconButton, {
|
|
2856
|
-
className: `c-rte-toolbar__icon-btn ${isLink ? "selected" : ""}`,
|
|
2857
|
-
disabled: !isEditable,
|
|
2858
|
-
onClick: insertLink,
|
|
2859
|
-
type: "button",
|
|
2860
|
-
"aria-label": tr("actionInsertlink"),
|
|
2861
|
-
title: tr("actionInsertlink"),
|
|
2862
|
-
children: /* @__PURE__ */ jsx14("i", {
|
|
2863
|
-
className: `c-rte-toolbar__icon-btn__icon c-rte-icon-link`
|
|
2864
|
-
})
|
|
2865
|
-
}),
|
|
2866
|
-
/* @__PURE__ */ jsx14(DropdownMenu.Root, {
|
|
2867
|
-
disabled: !isEditable,
|
|
2868
|
-
style: { zIndex: 1 },
|
|
2869
|
-
content: /* @__PURE__ */ jsxs9(Fragment5, {
|
|
2870
|
-
children: [
|
|
2871
|
-
/* @__PURE__ */ jsxs9(DropdownMenu.Item, {
|
|
2872
|
-
disabled: !isEditable,
|
|
2873
|
-
onClick: () => activeEditor.dispatchCommand(FORMAT_TEXT_COMMAND2, "strikethrough"),
|
|
2874
|
-
title: tr("actionFormatWithStrikethroughTitle"),
|
|
2875
|
-
"aria-label": tr("actionFormatWithStrikethroughLabel"),
|
|
2876
|
-
children: [
|
|
2877
|
-
/* @__PURE__ */ jsx14("i", {
|
|
2878
|
-
className: `c-rte-icon-strikethrough c-rte-toolbar__dd-item__icon ${isStrikethrough ? "selected" : ""}`
|
|
2879
|
-
}),
|
|
2880
|
-
/* @__PURE__ */ jsx14("span", {
|
|
2881
|
-
className: `c-rte-toolbar__dd-item__text ${isStrikethrough ? "selected" : ""}`,
|
|
2882
|
-
children: tr("actionFormatWithStrikethroughTitle")
|
|
2883
|
-
})
|
|
2884
|
-
]
|
|
2885
|
-
}),
|
|
2886
|
-
/* @__PURE__ */ jsxs9(DropdownMenu.Item, {
|
|
2887
|
-
disabled: !isEditable,
|
|
2888
|
-
onClick: () => activeEditor.dispatchCommand(FORMAT_TEXT_COMMAND2, "subscript"),
|
|
2889
|
-
title: tr("actionFormatWithSubscriptTitle"),
|
|
2890
|
-
"aria-label": tr("actionFormatWithSubscriptLabel"),
|
|
2891
|
-
children: [
|
|
2892
|
-
/* @__PURE__ */ jsx14("i", {
|
|
2893
|
-
className: `c-rte-icon-subscript c-rte-toolbar__dd-item__icon ${isSubscript ? "selected" : ""}`
|
|
2894
|
-
}),
|
|
2895
|
-
/* @__PURE__ */ jsx14("span", {
|
|
2896
|
-
className: `c-rte-toolbar__dd-item__text ${isSubscript ? "selected" : ""}`,
|
|
2897
|
-
children: tr("actionFormatWithSubscriptTitle")
|
|
2898
|
-
})
|
|
2899
|
-
]
|
|
2900
|
-
}),
|
|
2901
|
-
/* @__PURE__ */ jsxs9(DropdownMenu.Item, {
|
|
2902
|
-
disabled: !isEditable,
|
|
2903
|
-
onClick: () => activeEditor.dispatchCommand(FORMAT_TEXT_COMMAND2, "superscript"),
|
|
2904
|
-
title: tr("actionFormatWithSuperscriptTitle"),
|
|
2905
|
-
"aria-label": tr("actionFormatWithSuperscriptLabel"),
|
|
2906
|
-
children: [
|
|
2907
|
-
/* @__PURE__ */ jsx14("i", {
|
|
2908
|
-
className: `c-rte-icon-superscript c-rte-toolbar__dd-item__icon ${isSuperscript ? "selected" : ""}`
|
|
2909
|
-
}),
|
|
2910
|
-
/* @__PURE__ */ jsx14("span", {
|
|
2911
|
-
className: `c-rte-toolbar__dd-item__text ${isSuperscript ? "selected" : ""}`,
|
|
2912
|
-
children: tr("actionFormatWithSuperscriptTitle")
|
|
2913
|
-
})
|
|
2914
|
-
]
|
|
2915
|
-
}),
|
|
2916
|
-
/* @__PURE__ */ jsxs9(DropdownMenu.Item, {
|
|
2917
|
-
disabled: !isEditable,
|
|
2918
|
-
onClick: clearFormatting,
|
|
2919
|
-
className: "item",
|
|
2920
|
-
title: tr("actionClearTextFormatting"),
|
|
2921
|
-
"aria-label": tr("actionClearTextFormatting"),
|
|
2922
|
-
children: [
|
|
2923
|
-
/* @__PURE__ */ jsx14("i", {
|
|
2924
|
-
className: "c-rte-icon-clear c-rte-toolbar__dd-item__icon"
|
|
2925
|
-
}),
|
|
2926
|
-
/* @__PURE__ */ jsx14("span", {
|
|
2927
|
-
className: "c-rte-toolbar__dd-item__text--clear",
|
|
2928
|
-
children: tr("actionFormatClear")
|
|
2929
|
-
})
|
|
2930
|
-
]
|
|
2931
|
-
})
|
|
2932
|
-
]
|
|
2933
|
-
}),
|
|
2934
|
-
children: /* @__PURE__ */ jsxs9(Button, {
|
|
2935
|
-
style: { backgroundColor: "transparent", padding: "0 8px" },
|
|
2936
|
-
"aria-label": tr("actionTextFormattingOptions"),
|
|
2937
|
-
children: [
|
|
2938
|
-
/* @__PURE__ */ jsx14("i", {
|
|
2939
|
-
className: `c-rte-icon-dropdown-more c-rte-toolbar__toggle-icon`
|
|
2940
|
-
}),
|
|
2941
|
-
/* @__PURE__ */ jsx14(Icon.Arrow, {})
|
|
2942
|
-
]
|
|
2943
|
-
})
|
|
2944
|
-
}),
|
|
2945
|
-
/* @__PURE__ */ jsx14(Divider, {}),
|
|
2946
|
-
/* @__PURE__ */ jsx14(DropdownMenu.Root, {
|
|
2947
|
-
style: { zIndex: 1 },
|
|
2948
|
-
disabled: !isEditable,
|
|
2949
|
-
content: /* @__PURE__ */ jsxs9(Fragment5, {
|
|
2950
|
-
children: [
|
|
2951
|
-
/* @__PURE__ */ jsxs9(DropdownMenu.Item, {
|
|
2952
|
-
onClick: () => {
|
|
2953
|
-
activeEditor.dispatchCommand(INSERT_HORIZONTAL_RULE_COMMAND, void 0);
|
|
2954
|
-
},
|
|
2955
|
-
children: [
|
|
2956
|
-
/* @__PURE__ */ jsx14("i", {
|
|
2957
|
-
className: "c-rte-toolbar__dd-item__icon c-rte-icon-horizontal-rule"
|
|
2958
|
-
}),
|
|
2959
|
-
/* @__PURE__ */ jsx14("span", {
|
|
2960
|
-
className: "c-rte-toolbar__dd-item__text",
|
|
2961
|
-
children: tr("horizontalRule")
|
|
2962
|
-
})
|
|
2963
|
-
]
|
|
2964
|
-
}),
|
|
2965
|
-
/* @__PURE__ */ jsx14(DropdownMenu.Item, {
|
|
2966
|
-
children: /* @__PURE__ */ jsx14(Dialog.Trigger, {
|
|
2967
|
-
asChild: true,
|
|
2968
|
-
children: /* @__PURE__ */ jsxs9("div", {
|
|
2969
|
-
className: "c-rte-toolbar__dd-item--table",
|
|
2970
|
-
children: [
|
|
2971
|
-
/* @__PURE__ */ jsx14("i", {
|
|
2972
|
-
className: "c-rte-toolbar__dd-item__icon c-rte-icon-table"
|
|
2973
|
-
}),
|
|
2974
|
-
/* @__PURE__ */ jsx14("span", {
|
|
2975
|
-
className: "c-rte-toolbar__dd-item__text",
|
|
2976
|
-
children: tr("table")
|
|
2977
|
-
})
|
|
2978
|
-
]
|
|
2979
|
-
})
|
|
2980
|
-
})
|
|
2981
|
-
})
|
|
2982
|
-
]
|
|
2983
|
-
}),
|
|
2984
|
-
children: /* @__PURE__ */ jsx14(IconButton, {
|
|
2985
|
-
children: /* @__PURE__ */ jsx14("i", {
|
|
2986
|
-
className: "c-rte-icon-plus c-rte-toolbar__plus"
|
|
2987
|
-
})
|
|
2988
|
-
})
|
|
2989
|
-
}),
|
|
2990
|
-
/* @__PURE__ */ jsxs9(Dialog.Content, {
|
|
2991
2826
|
children: [
|
|
2992
|
-
/* @__PURE__ */ jsx14(
|
|
2993
|
-
|
|
2994
|
-
}),
|
|
2995
|
-
/* @__PURE__ */ jsx14(Dialog.Description, {
|
|
2996
|
-
children: tr("insertTableDescription")
|
|
2997
|
-
}),
|
|
2998
|
-
/* @__PURE__ */ jsx14(InsertTableDialog, {
|
|
2999
|
-
activeEditor
|
|
3000
|
-
})
|
|
2827
|
+
/* @__PURE__ */ jsx14("i", { className: "c-rte-toolbar__dd-item__icon c-rte-icon-horizontal-rule" }),
|
|
2828
|
+
/* @__PURE__ */ jsx14("span", { className: "c-rte-toolbar__dd-item__text", children: tr("horizontalRule") })
|
|
3001
2829
|
]
|
|
3002
|
-
}
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
-
|
|
3011
|
-
|
|
3012
|
-
|
|
3013
|
-
|
|
3014
|
-
|
|
2830
|
+
}
|
|
2831
|
+
),
|
|
2832
|
+
/* @__PURE__ */ jsx14(DropdownMenu.Item, { children: /* @__PURE__ */ jsx14(Dialog.Trigger, { asChild: true, children: /* @__PURE__ */ jsxs9("div", { className: "c-rte-toolbar__dd-item--table", children: [
|
|
2833
|
+
/* @__PURE__ */ jsx14("i", { className: "c-rte-toolbar__dd-item__icon c-rte-icon-table" }),
|
|
2834
|
+
/* @__PURE__ */ jsx14("span", { className: "c-rte-toolbar__dd-item__text", children: tr("table") })
|
|
2835
|
+
] }) }) })
|
|
2836
|
+
] }),
|
|
2837
|
+
children: /* @__PURE__ */ jsx14(IconButton, { children: /* @__PURE__ */ jsx14("i", { className: "c-rte-icon-plus c-rte-toolbar__plus" }) })
|
|
2838
|
+
}
|
|
2839
|
+
),
|
|
2840
|
+
/* @__PURE__ */ jsxs9(Dialog.Content, { children: [
|
|
2841
|
+
/* @__PURE__ */ jsx14(Dialog.Title, { children: tr("insertTableTitle") }),
|
|
2842
|
+
/* @__PURE__ */ jsx14(Dialog.Description, { children: tr("insertTableDescription") }),
|
|
2843
|
+
/* @__PURE__ */ jsx14(InsertTableDialog, { activeEditor })
|
|
2844
|
+
] })
|
|
2845
|
+
] }) })
|
|
2846
|
+
] }),
|
|
2847
|
+
/* @__PURE__ */ jsx14(ActionsPlugin, { disabled, prepend: actionsMenuPrepend, append: actionsMenuAppend })
|
|
2848
|
+
] });
|
|
3015
2849
|
}
|
|
3016
2850
|
|
|
3017
2851
|
// src/rich-text-editor/themes/CrystallizeRTEditorTheme.ts
|
|
@@ -3124,30 +2958,22 @@ function RichTextEditor({
|
|
|
3124
2958
|
labelTranslations,
|
|
3125
2959
|
...rest
|
|
3126
2960
|
}) {
|
|
3127
|
-
return /* @__PURE__ */ jsx15(
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
|
|
3139
|
-
|
|
3140
|
-
labelTranslations,
|
|
3141
|
-
|
|
3142
|
-
|
|
3143
|
-
className: "c-rich-text-editor",
|
|
3144
|
-
children: /* @__PURE__ */ jsx15(RichTextEditorWithoutContext, {
|
|
3145
|
-
...rest
|
|
3146
|
-
})
|
|
3147
|
-
})
|
|
3148
|
-
})
|
|
3149
|
-
})
|
|
3150
|
-
});
|
|
2961
|
+
return /* @__PURE__ */ jsx15(
|
|
2962
|
+
LexicalComposer,
|
|
2963
|
+
{
|
|
2964
|
+
initialConfig: {
|
|
2965
|
+
editable: !rest.disabled,
|
|
2966
|
+
namespace: "crystallize-rich-text-editor",
|
|
2967
|
+
nodes: [...BaseNodes],
|
|
2968
|
+
theme: CrystallizeRTEditorTheme_default,
|
|
2969
|
+
editorState: initialData ? composeInitialState({ richText: initialData }) : void 0,
|
|
2970
|
+
onError: (error) => {
|
|
2971
|
+
throw error;
|
|
2972
|
+
}
|
|
2973
|
+
},
|
|
2974
|
+
children: /* @__PURE__ */ jsx15(I18nProvider, { language, labelTranslations, children: /* @__PURE__ */ jsx15(SharedHistoryContext, { children: /* @__PURE__ */ jsx15("div", { className: "c-rich-text-editor", children: /* @__PURE__ */ jsx15(RichTextEditorWithoutContext, { ...rest }) }) }) })
|
|
2975
|
+
}
|
|
2976
|
+
);
|
|
3151
2977
|
}
|
|
3152
2978
|
function RichTextEditorWithoutContext({
|
|
3153
2979
|
placeholder: placeholderText,
|
|
@@ -3163,10 +2989,7 @@ function RichTextEditorWithoutContext({
|
|
|
3163
2989
|
}) {
|
|
3164
2990
|
const editable = !disabled;
|
|
3165
2991
|
const { historyState } = useSharedHistoryContext();
|
|
3166
|
-
const placeholder = /* @__PURE__ */ jsx15("div", {
|
|
3167
|
-
className: "c-rte-placeholder",
|
|
3168
|
-
children: placeholderText ?? ""
|
|
3169
|
-
});
|
|
2992
|
+
const placeholder = /* @__PURE__ */ jsx15("div", { className: "c-rte-placeholder", children: placeholderText ?? "" });
|
|
3170
2993
|
const [editor] = useLexicalComposerContext12();
|
|
3171
2994
|
const [floatingAnchorElem, setFloatingAnchorElem] = useState10(null);
|
|
3172
2995
|
const firstOnChangeTriggeredRef = useRef5(!autoFocus);
|
|
@@ -3186,76 +3009,47 @@ function RichTextEditorWithoutContext({
|
|
|
3186
3009
|
}
|
|
3187
3010
|
firstOnChangeTriggeredRef.current = true;
|
|
3188
3011
|
}
|
|
3189
|
-
return /* @__PURE__ */ jsxs10(Fragment6, {
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
}),
|
|
3195
|
-
/* @__PURE__ */ jsx15(ToolbarPlugin, {
|
|
3012
|
+
return /* @__PURE__ */ jsxs10(Fragment6, { children: [
|
|
3013
|
+
/* @__PURE__ */ jsx15(OnChangePlugin, { onChange: onLocalChange, ignoreSelectionChange: true }),
|
|
3014
|
+
/* @__PURE__ */ jsx15(
|
|
3015
|
+
ToolbarPlugin,
|
|
3016
|
+
{
|
|
3196
3017
|
disabled,
|
|
3197
3018
|
actionsMenuPrepend,
|
|
3198
3019
|
actionsMenuAppend
|
|
3199
|
-
}
|
|
3200
|
-
|
|
3201
|
-
|
|
3202
|
-
|
|
3203
|
-
|
|
3204
|
-
|
|
3205
|
-
|
|
3206
|
-
|
|
3207
|
-
|
|
3208
|
-
|
|
3209
|
-
|
|
3210
|
-
|
|
3211
|
-
/* @__PURE__ */ jsx15(
|
|
3212
|
-
|
|
3213
|
-
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
|
|
3219
|
-
|
|
3220
|
-
|
|
3221
|
-
|
|
3222
|
-
|
|
3223
|
-
|
|
3224
|
-
|
|
3225
|
-
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
|
|
3231
|
-
|
|
3232
|
-
maxDepth: 7
|
|
3233
|
-
}),
|
|
3234
|
-
/* @__PURE__ */ jsx15(TablePlugin, {}),
|
|
3235
|
-
/* @__PURE__ */ jsx15(LinkPlugin, {}),
|
|
3236
|
-
/* @__PURE__ */ jsx15(HorizontalRulePlugin, {}),
|
|
3237
|
-
/* @__PURE__ */ jsx15(TabFocusPlugin, {}),
|
|
3238
|
-
/* @__PURE__ */ jsx15(TabIndentationPlugin, {}),
|
|
3239
|
-
floatingAnchorElem && /* @__PURE__ */ jsxs10(Fragment6, {
|
|
3240
|
-
children: [
|
|
3241
|
-
/* @__PURE__ */ jsx15(CodeActionMenuPlugin, {
|
|
3242
|
-
anchorElem: floatingAnchorElem
|
|
3243
|
-
}),
|
|
3244
|
-
/* @__PURE__ */ jsx15(FloatingLinkEditorPlugin, {
|
|
3245
|
-
anchorElem: floatingAnchorElem
|
|
3246
|
-
}),
|
|
3247
|
-
/* @__PURE__ */ jsx15(TableActionMenuPlugin, {
|
|
3248
|
-
anchorElem: floatingAnchorElem
|
|
3249
|
-
}),
|
|
3250
|
-
/* @__PURE__ */ jsx15(FloatingTextFormatToolbarPlugin, {
|
|
3251
|
-
anchorElem: floatingAnchorElem
|
|
3252
|
-
})
|
|
3253
|
-
]
|
|
3254
|
-
})
|
|
3255
|
-
]
|
|
3256
|
-
})
|
|
3257
|
-
]
|
|
3258
|
-
});
|
|
3020
|
+
}
|
|
3021
|
+
),
|
|
3022
|
+
slotPreContent,
|
|
3023
|
+
/* @__PURE__ */ jsxs10("div", { className: `c-rte-editor-container ${disabled ? "disabled" : ""}`, "data-testid": "rich-text-editor", children: [
|
|
3024
|
+
maxLength != null ? /* @__PURE__ */ jsx15(MaxLengthPlugin, { maxLength }) : null,
|
|
3025
|
+
!autoFocus ? null : /* @__PURE__ */ jsx15(AutoFocusPlugin, {}),
|
|
3026
|
+
/* @__PURE__ */ jsx15(ClearEditorPlugin, {}),
|
|
3027
|
+
/* @__PURE__ */ jsx15(LexicalAutoLinkPlugin, {}),
|
|
3028
|
+
/* @__PURE__ */ jsx15(HistoryPlugin, { externalHistoryState: historyState }),
|
|
3029
|
+
/* @__PURE__ */ jsx15(
|
|
3030
|
+
RichTextPlugin,
|
|
3031
|
+
{
|
|
3032
|
+
contentEditable: /* @__PURE__ */ jsx15("div", { className: "c-rte-editor-scroller", children: /* @__PURE__ */ jsx15("div", { className: "c-rte-editor", ref: onRef, children: /* @__PURE__ */ jsx15(ContentEditable, { className: "c-rte-contenteditable-root", id }) }) }),
|
|
3033
|
+
placeholder,
|
|
3034
|
+
ErrorBoundary: LexicalErrorBoundary
|
|
3035
|
+
}
|
|
3036
|
+
),
|
|
3037
|
+
/* @__PURE__ */ jsx15(CodeHighlightPlugin, {}),
|
|
3038
|
+
/* @__PURE__ */ jsx15(ListPlugin, {}),
|
|
3039
|
+
/* @__PURE__ */ jsx15(ListMaxIndentLevelPlugin, { maxDepth: 7 }),
|
|
3040
|
+
/* @__PURE__ */ jsx15(TablePlugin, {}),
|
|
3041
|
+
/* @__PURE__ */ jsx15(LinkPlugin, {}),
|
|
3042
|
+
/* @__PURE__ */ jsx15(HorizontalRulePlugin, {}),
|
|
3043
|
+
/* @__PURE__ */ jsx15(TabFocusPlugin, {}),
|
|
3044
|
+
/* @__PURE__ */ jsx15(TabIndentationPlugin, {}),
|
|
3045
|
+
floatingAnchorElem && /* @__PURE__ */ jsxs10(Fragment6, { children: [
|
|
3046
|
+
/* @__PURE__ */ jsx15(CodeActionMenuPlugin, { anchorElem: floatingAnchorElem }),
|
|
3047
|
+
/* @__PURE__ */ jsx15(FloatingLinkEditorPlugin, { anchorElem: floatingAnchorElem }),
|
|
3048
|
+
/* @__PURE__ */ jsx15(TableActionMenuPlugin, { anchorElem: floatingAnchorElem }),
|
|
3049
|
+
/* @__PURE__ */ jsx15(FloatingTextFormatToolbarPlugin, { anchorElem: floatingAnchorElem })
|
|
3050
|
+
] })
|
|
3051
|
+
] })
|
|
3052
|
+
] });
|
|
3259
3053
|
}
|
|
3260
3054
|
var rich_text_editor_default = RichTextEditor;
|
|
3261
3055
|
export {
|