@select-org/select-post-builder 1.1.4 → 1.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +55 -4
- package/dist/post-builder.cjs.js +262 -125
- package/dist/post-builder.css +26 -18
- package/dist/post-builder.js +262 -125
- package/package.json +1 -1
package/dist/post-builder.cjs.js
CHANGED
|
@@ -2554,7 +2554,7 @@ var ImageSearchFrom = /* @__PURE__ */ ((ImageSearchFrom2) => {
|
|
|
2554
2554
|
})(ImageSearchFrom || {});
|
|
2555
2555
|
var EditorTypes = /* @__PURE__ */ ((EditorTypes2) => {
|
|
2556
2556
|
EditorTypes2["Media"] = "Media";
|
|
2557
|
-
EditorTypes2["
|
|
2557
|
+
EditorTypes2["Blog"] = "Blog";
|
|
2558
2558
|
EditorTypes2["Poll"] = "Poll";
|
|
2559
2559
|
return EditorTypes2;
|
|
2560
2560
|
})(EditorTypes || {});
|
|
@@ -8558,12 +8558,25 @@ const usePostBuilderAnalytics = () => {
|
|
|
8558
8558
|
};
|
|
8559
8559
|
const editorTypes = enumToOptions(EditorTypes);
|
|
8560
8560
|
const EditorTypeTabs = ({ editorTab, onSwitchEditorTab }) => {
|
|
8561
|
+
const { t } = usePostBuilder();
|
|
8561
8562
|
const { trackTabSwitch } = usePostBuilderAnalytics();
|
|
8562
8563
|
const handleSwitchTab = (newTab) => {
|
|
8563
8564
|
const oldTab = editorTab;
|
|
8564
8565
|
trackTabSwitch({ oldTab, newTab });
|
|
8565
8566
|
onSwitchEditorTab(newTab);
|
|
8566
8567
|
};
|
|
8568
|
+
const translationKeyMapping = (tab) => {
|
|
8569
|
+
switch (tab) {
|
|
8570
|
+
case EditorTypes.Media:
|
|
8571
|
+
return "postTabKey";
|
|
8572
|
+
case EditorTypes.Blog:
|
|
8573
|
+
return "blogTabKey";
|
|
8574
|
+
case EditorTypes.Poll:
|
|
8575
|
+
return "pollTabKey";
|
|
8576
|
+
default:
|
|
8577
|
+
return "postTabKey";
|
|
8578
|
+
}
|
|
8579
|
+
};
|
|
8567
8580
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
8568
8581
|
Tabs,
|
|
8569
8582
|
{
|
|
@@ -8571,7 +8584,7 @@ const EditorTypeTabs = ({ editorTab, onSwitchEditorTab }) => {
|
|
|
8571
8584
|
value: editorTab,
|
|
8572
8585
|
onValueChange: handleSwitchTab,
|
|
8573
8586
|
className: "w-full",
|
|
8574
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(TabsList, { className: "w-full rounded-none border-b", children: editorTypes.map((data) => /* @__PURE__ */ jsxRuntime.jsx(TabsTrigger, { value: data.value.toString(), children: data.
|
|
8587
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(TabsList, { className: "w-full rounded-none border-b", children: editorTypes.map((data) => /* @__PURE__ */ jsxRuntime.jsx(TabsTrigger, { value: data.value.toString(), children: t(translationKeyMapping(data.key), data.value) }, data.value)) })
|
|
8575
8588
|
}
|
|
8576
8589
|
);
|
|
8577
8590
|
};
|
|
@@ -14850,6 +14863,7 @@ const ToolbarButton = React.forwardRef(
|
|
|
14850
14863
|
({ id, icon: Icon2, tooltip, active, children, className, onClick, ...buttonProps }, ref) => {
|
|
14851
14864
|
const { editor } = react.useCurrentEditor();
|
|
14852
14865
|
const { trackFeature } = usePostBuilderAnalytics();
|
|
14866
|
+
const { t } = usePostBuilder();
|
|
14853
14867
|
const handleClick = (e) => {
|
|
14854
14868
|
onClick?.(e);
|
|
14855
14869
|
if (id) trackFeature({ featureName: id });
|
|
@@ -14875,7 +14889,7 @@ const ToolbarButton = React.forwardRef(
|
|
|
14875
14889
|
children: children ?? (Icon2 && /* @__PURE__ */ jsxRuntime.jsx(Icon2, { className: "size-full" }))
|
|
14876
14890
|
}
|
|
14877
14891
|
) }),
|
|
14878
|
-
/* @__PURE__ */ jsxRuntime.jsx(TooltipContent, { children: tooltip })
|
|
14892
|
+
/* @__PURE__ */ jsxRuntime.jsx(TooltipContent, { children: t(tooltip, tooltip) ?? tooltip })
|
|
14879
14893
|
] }) });
|
|
14880
14894
|
}
|
|
14881
14895
|
);
|
|
@@ -16282,6 +16296,7 @@ const LinkDecoratorModal = ({
|
|
|
16282
16296
|
}) => {
|
|
16283
16297
|
const { editor } = react.useCurrentEditor();
|
|
16284
16298
|
const { core: core2 } = useApi();
|
|
16299
|
+
const { t } = usePostBuilder();
|
|
16285
16300
|
const [uid, setUid] = React.useState(defaultValues?.uid ?? null);
|
|
16286
16301
|
const [link, setLink] = React.useState(defaultValues?.link ?? "");
|
|
16287
16302
|
const [text2, setText] = React.useState(defaultValues?.text || "");
|
|
@@ -16342,11 +16357,12 @@ const LinkDecoratorModal = ({
|
|
|
16342
16357
|
return /* @__PURE__ */ jsxRuntime.jsxs(Dialog, { open, onOpenChange: handleOpenChange, children: [
|
|
16343
16358
|
children ? /* @__PURE__ */ jsxRuntime.jsx(DialogTrigger, { asChild: true, children }) : null,
|
|
16344
16359
|
/* @__PURE__ */ jsxRuntime.jsxs(DialogContent, { className: "-translate-1/2", children: [
|
|
16345
|
-
/* @__PURE__ */ jsxRuntime.jsx(DialogHeader, { children: /* @__PURE__ */ jsxRuntime.jsx(DialogTitle, { children: "
|
|
16360
|
+
/* @__PURE__ */ jsxRuntime.jsx(DialogHeader, { children: /* @__PURE__ */ jsxRuntime.jsx(DialogTitle, { children: isUpdate ? t("updateLinkKey") : t("insertLinkKey") }) }),
|
|
16346
16361
|
/* @__PURE__ */ jsxRuntime.jsx(FieldSet, { children: /* @__PURE__ */ jsxRuntime.jsxs(FieldGroup, { className: "gap-3", children: [
|
|
16347
16362
|
/* @__PURE__ */ jsxRuntime.jsxs(Field, { className: "gap-1.5", children: [
|
|
16348
16363
|
/* @__PURE__ */ jsxRuntime.jsxs(FieldLabel, { children: [
|
|
16349
|
-
"
|
|
16364
|
+
t("linkInputLabelKey"),
|
|
16365
|
+
" ",
|
|
16350
16366
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-destructive", children: "*" })
|
|
16351
16367
|
] }),
|
|
16352
16368
|
/* @__PURE__ */ jsxRuntime.jsxs(InputGroup, { children: [
|
|
@@ -16362,10 +16378,10 @@ const LinkDecoratorModal = ({
|
|
|
16362
16378
|
),
|
|
16363
16379
|
/* @__PURE__ */ jsxRuntime.jsx(InputGroupAddon, { children: /* @__PURE__ */ jsxRuntime.jsx(Link, {}) })
|
|
16364
16380
|
] }),
|
|
16365
|
-
!isValid && isValid !== void 0 && /* @__PURE__ */ jsxRuntime.jsx(FieldError, { errors: [{ message: "
|
|
16381
|
+
!isValid && isValid !== void 0 && /* @__PURE__ */ jsxRuntime.jsx(FieldError, { errors: [{ message: t("invalidLinkKey") }] })
|
|
16366
16382
|
] }),
|
|
16367
16383
|
!hideTextInput && /* @__PURE__ */ jsxRuntime.jsxs(Field, { className: "gap-1.5", children: [
|
|
16368
|
-
/* @__PURE__ */ jsxRuntime.jsx(FieldLabel, { children: "
|
|
16384
|
+
/* @__PURE__ */ jsxRuntime.jsx(FieldLabel, { children: t("linkTextInputLabelKey") }),
|
|
16369
16385
|
/* @__PURE__ */ jsxRuntime.jsxs(InputGroup, { children: [
|
|
16370
16386
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
16371
16387
|
InputGroupInput,
|
|
@@ -16374,7 +16390,7 @@ const LinkDecoratorModal = ({
|
|
|
16374
16390
|
value: text2,
|
|
16375
16391
|
onChange: handleChangeText,
|
|
16376
16392
|
onKeyDown: handleKeyDown,
|
|
16377
|
-
placeholder: "
|
|
16393
|
+
placeholder: t("linkTextInputLabelKey")
|
|
16378
16394
|
}
|
|
16379
16395
|
),
|
|
16380
16396
|
/* @__PURE__ */ jsxRuntime.jsx(InputGroupAddon, { children: /* @__PURE__ */ jsxRuntime.jsx(TextAlignStart, {}) })
|
|
@@ -16382,7 +16398,7 @@ const LinkDecoratorModal = ({
|
|
|
16382
16398
|
] })
|
|
16383
16399
|
] }) }),
|
|
16384
16400
|
/* @__PURE__ */ jsxRuntime.jsxs(DialogFooter, { children: [
|
|
16385
|
-
/* @__PURE__ */ jsxRuntime.jsx(Button, { variant: "secondary", onClick: () => onOpenChange?.(false), children: "
|
|
16401
|
+
/* @__PURE__ */ jsxRuntime.jsx(Button, { variant: "secondary", onClick: () => onOpenChange?.(false), children: t("cancelKey") }),
|
|
16386
16402
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
16387
16403
|
Button,
|
|
16388
16404
|
{
|
|
@@ -16390,7 +16406,7 @@ const LinkDecoratorModal = ({
|
|
|
16390
16406
|
onClick: () => handleInsertLink(link, text2, uid ?? void 0),
|
|
16391
16407
|
children: [
|
|
16392
16408
|
isLoading && /* @__PURE__ */ jsxRuntime.jsx(Spinner, {}),
|
|
16393
|
-
isUpdate ? "
|
|
16409
|
+
isUpdate ? t("updateKey") : t("insertKey")
|
|
16394
16410
|
]
|
|
16395
16411
|
}
|
|
16396
16412
|
)
|
|
@@ -18366,6 +18382,7 @@ function ImageSearchModal({
|
|
|
18366
18382
|
onImageSelect,
|
|
18367
18383
|
children
|
|
18368
18384
|
}) {
|
|
18385
|
+
const { t } = usePostBuilder();
|
|
18369
18386
|
const [activeTab, setActiveTab] = React.useState("gifs");
|
|
18370
18387
|
const [searchQuery, setSearchQuery] = React.useState("");
|
|
18371
18388
|
const imageSearch = useMediaSearch("images");
|
|
@@ -18433,7 +18450,7 @@ function ImageSearchModal({
|
|
|
18433
18450
|
return /* @__PURE__ */ jsxRuntime.jsxs(Dialog, { open, onOpenChange: handleOpenChange, children: [
|
|
18434
18451
|
/* @__PURE__ */ jsxRuntime.jsx(DialogTrigger, { asChild: true, children: children ?? /* @__PURE__ */ jsxRuntime.jsx(Button, { children: "Open Search Modal" }) }),
|
|
18435
18452
|
/* @__PURE__ */ jsxRuntime.jsxs(DialogContent, { className: "max-w-4xl w-full h-[80vh] flex flex-col overflow-hidden px-0 py-0 -translate-1/2", children: [
|
|
18436
|
-
/* @__PURE__ */ jsxRuntime.jsx(DialogHeader, { className: "p-4 border-b bg-accent", children: /* @__PURE__ */ jsxRuntime.jsx(DialogTitle, { children: "
|
|
18453
|
+
/* @__PURE__ */ jsxRuntime.jsx(DialogHeader, { className: "p-4 border-b bg-accent", children: /* @__PURE__ */ jsxRuntime.jsx(DialogTitle, { children: t("mediaSearchTitleKey") }) }),
|
|
18437
18454
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
18438
18455
|
Tabs,
|
|
18439
18456
|
{
|
|
@@ -18443,15 +18460,15 @@ function ImageSearchModal({
|
|
|
18443
18460
|
className: "flex-1 grow flex flex-col overflow-y-auto",
|
|
18444
18461
|
children: [
|
|
18445
18462
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-4", children: /* @__PURE__ */ jsxRuntime.jsxs(TabsList, { className: "grid w-full grid-cols-2", children: [
|
|
18446
|
-
/* @__PURE__ */ jsxRuntime.jsx(TabsTrigger, { value: "gifs", children: "
|
|
18447
|
-
/* @__PURE__ */ jsxRuntime.jsx(TabsTrigger, { value: "images", children: "
|
|
18463
|
+
/* @__PURE__ */ jsxRuntime.jsx(TabsTrigger, { value: "gifs", children: t("gifSearchKey") }),
|
|
18464
|
+
/* @__PURE__ */ jsxRuntime.jsx(TabsTrigger, { value: "images", children: t("imageSearchKey") })
|
|
18448
18465
|
] }) }),
|
|
18449
18466
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
18450
18467
|
SearchBar,
|
|
18451
18468
|
{
|
|
18452
18469
|
value: searchQuery,
|
|
18453
18470
|
onChange: handleSearch,
|
|
18454
|
-
placeholder:
|
|
18471
|
+
placeholder: activeTab === "gifs" ? t("searchGifPlaceholder") : t("searchIMagePlaceholder")
|
|
18455
18472
|
}
|
|
18456
18473
|
),
|
|
18457
18474
|
/* @__PURE__ */ jsxRuntime.jsx(TabsContent, { value: "images", className: "flex-1 grow mt-4 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -18482,7 +18499,7 @@ function ImageSearchModal({
|
|
|
18482
18499
|
}
|
|
18483
18500
|
function SearchBar({ value, onChange, placeholder }) {
|
|
18484
18501
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-2 px-4", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative", children: [
|
|
18485
|
-
/* @__PURE__ */ jsxRuntime.jsx(Search, { className: "absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground" }),
|
|
18502
|
+
/* @__PURE__ */ jsxRuntime.jsx(Search, { className: "absolute left-3 top-1/2 -translate-y-1/2 transform-none h-4 w-4 text-muted-foreground" }),
|
|
18486
18503
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
18487
18504
|
Input,
|
|
18488
18505
|
{
|
|
@@ -20255,7 +20272,7 @@ function isOnlyContentNode(node, targetType, options = {}) {
|
|
|
20255
20272
|
return foundTargetType && !foundOtherContentNode;
|
|
20256
20273
|
}
|
|
20257
20274
|
const TOOLBAR_FEATURES = {
|
|
20258
|
-
[EditorTypes.
|
|
20275
|
+
[EditorTypes.Blog]: {
|
|
20259
20276
|
showFormatting: true,
|
|
20260
20277
|
showImage: true,
|
|
20261
20278
|
showVideo: true,
|
|
@@ -20292,6 +20309,7 @@ const Toolbar = ({
|
|
|
20292
20309
|
const editorState = useEditorStateSnapshot(editor);
|
|
20293
20310
|
const { showCrossMentionIndicator } = useEditorWithMentionTracking(editor, { debounceMs: 150 });
|
|
20294
20311
|
const { trackFeature } = usePostBuilderAnalytics();
|
|
20312
|
+
const { t } = usePostBuilder();
|
|
20295
20313
|
if (!editor) return null;
|
|
20296
20314
|
const features = TOOLBAR_FEATURES[editorType];
|
|
20297
20315
|
const handleClickLink = (e) => {
|
|
@@ -20301,7 +20319,7 @@ const Toolbar = ({
|
|
|
20301
20319
|
}
|
|
20302
20320
|
};
|
|
20303
20321
|
const handleInsertLink = (link, text2, uid, previewPayload) => {
|
|
20304
|
-
const linkText = editorType === EditorTypes.
|
|
20322
|
+
const linkText = editorType === EditorTypes.Blog ? text2 || link : link;
|
|
20305
20323
|
if (uid) {
|
|
20306
20324
|
editor.commands.updateLink(uid, { href: link, text: linkText, previewPayload });
|
|
20307
20325
|
return;
|
|
@@ -20382,7 +20400,7 @@ const Toolbar = ({
|
|
|
20382
20400
|
{
|
|
20383
20401
|
id: FEATURE_NAME_MAP.undo,
|
|
20384
20402
|
icon: Undo,
|
|
20385
|
-
tooltip: "
|
|
20403
|
+
tooltip: "undoKey",
|
|
20386
20404
|
onClick: actions?.undo,
|
|
20387
20405
|
disabled: !editorState?.canUndo
|
|
20388
20406
|
}
|
|
@@ -20392,7 +20410,7 @@ const Toolbar = ({
|
|
|
20392
20410
|
{
|
|
20393
20411
|
id: FEATURE_NAME_MAP.redo,
|
|
20394
20412
|
icon: Redo,
|
|
20395
|
-
tooltip: "
|
|
20413
|
+
tooltip: "redoKey",
|
|
20396
20414
|
onClick: actions?.redo,
|
|
20397
20415
|
disabled: !editorState?.canRedo
|
|
20398
20416
|
}
|
|
@@ -20401,7 +20419,7 @@ const Toolbar = ({
|
|
|
20401
20419
|
/* @__PURE__ */ jsxRuntime.jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
20402
20420
|
ToolbarButton,
|
|
20403
20421
|
{
|
|
20404
|
-
tooltip: "
|
|
20422
|
+
tooltip: "headingOptionsKey",
|
|
20405
20423
|
icon: getHeadingIcon(editorState),
|
|
20406
20424
|
"aria-label": "More formatting options"
|
|
20407
20425
|
}
|
|
@@ -20412,13 +20430,14 @@ const Toolbar = ({
|
|
|
20412
20430
|
{
|
|
20413
20431
|
id: FEATURE_NAME_MAP.paragraph,
|
|
20414
20432
|
className: "w-full justify-start",
|
|
20415
|
-
tooltip: "
|
|
20433
|
+
tooltip: "paragraphKey",
|
|
20416
20434
|
onClick: actions?.setParagraph,
|
|
20417
20435
|
active: editorState?.isParagraph,
|
|
20418
20436
|
disabled: !editorState?.canParagraph,
|
|
20419
20437
|
children: [
|
|
20420
20438
|
/* @__PURE__ */ jsxRuntime.jsx(Type, {}),
|
|
20421
|
-
"
|
|
20439
|
+
" ",
|
|
20440
|
+
t("paragraphKey")
|
|
20422
20441
|
]
|
|
20423
20442
|
}
|
|
20424
20443
|
) }),
|
|
@@ -20427,13 +20446,14 @@ const Toolbar = ({
|
|
|
20427
20446
|
{
|
|
20428
20447
|
id: HEADING_FEATURE_MAP[1],
|
|
20429
20448
|
className: "w-full justify-start",
|
|
20430
|
-
tooltip: "
|
|
20449
|
+
tooltip: "heading1Key",
|
|
20431
20450
|
onClick: () => actions?.toggleHeading(1),
|
|
20432
20451
|
active: editorState?.isHeading1,
|
|
20433
20452
|
disabled: !editorState?.canHeading1,
|
|
20434
20453
|
children: [
|
|
20435
20454
|
/* @__PURE__ */ jsxRuntime.jsx(Heading1, {}),
|
|
20436
|
-
"
|
|
20455
|
+
" ",
|
|
20456
|
+
t("heading1Key")
|
|
20437
20457
|
]
|
|
20438
20458
|
}
|
|
20439
20459
|
) }),
|
|
@@ -20442,13 +20462,14 @@ const Toolbar = ({
|
|
|
20442
20462
|
{
|
|
20443
20463
|
id: HEADING_FEATURE_MAP[2],
|
|
20444
20464
|
className: "w-full justify-start",
|
|
20445
|
-
tooltip: "
|
|
20465
|
+
tooltip: "heading2Key",
|
|
20446
20466
|
onClick: () => actions?.toggleHeading(2),
|
|
20447
20467
|
active: editorState?.isHeading2,
|
|
20448
20468
|
disabled: !editorState?.canHeading2,
|
|
20449
20469
|
children: [
|
|
20450
20470
|
/* @__PURE__ */ jsxRuntime.jsx(Heading2, {}),
|
|
20451
|
-
"
|
|
20471
|
+
" ",
|
|
20472
|
+
t("heading2Key")
|
|
20452
20473
|
]
|
|
20453
20474
|
}
|
|
20454
20475
|
) }),
|
|
@@ -20457,13 +20478,14 @@ const Toolbar = ({
|
|
|
20457
20478
|
{
|
|
20458
20479
|
id: HEADING_FEATURE_MAP[3],
|
|
20459
20480
|
className: "w-full justify-start",
|
|
20460
|
-
tooltip: "
|
|
20481
|
+
tooltip: "heading3Key",
|
|
20461
20482
|
onClick: () => actions?.toggleHeading(3),
|
|
20462
20483
|
active: editorState?.isHeading3,
|
|
20463
20484
|
disabled: !editorState?.canHeading3,
|
|
20464
20485
|
children: [
|
|
20465
20486
|
/* @__PURE__ */ jsxRuntime.jsx(Heading3, {}),
|
|
20466
|
-
"
|
|
20487
|
+
" ",
|
|
20488
|
+
t("heading3Key")
|
|
20467
20489
|
]
|
|
20468
20490
|
}
|
|
20469
20491
|
) })
|
|
@@ -20475,7 +20497,7 @@ const Toolbar = ({
|
|
|
20475
20497
|
{
|
|
20476
20498
|
id: FEATURE_NAME_MAP.bold,
|
|
20477
20499
|
icon: Bold,
|
|
20478
|
-
tooltip: "
|
|
20500
|
+
tooltip: "boldKey",
|
|
20479
20501
|
onClick: actions?.toggleBold,
|
|
20480
20502
|
active: editorState?.isBold,
|
|
20481
20503
|
disabled: !editorState?.canBold
|
|
@@ -20487,7 +20509,7 @@ const Toolbar = ({
|
|
|
20487
20509
|
{
|
|
20488
20510
|
id: FEATURE_NAME_MAP.italic,
|
|
20489
20511
|
icon: Italic,
|
|
20490
|
-
tooltip: "
|
|
20512
|
+
tooltip: "italicKey",
|
|
20491
20513
|
onClick: actions?.toggleItalic,
|
|
20492
20514
|
active: editorState?.isItalic,
|
|
20493
20515
|
disabled: !editorState?.canItalic
|
|
@@ -20498,7 +20520,7 @@ const Toolbar = ({
|
|
|
20498
20520
|
{
|
|
20499
20521
|
id: FEATURE_NAME_MAP.strike,
|
|
20500
20522
|
icon: Strikethrough,
|
|
20501
|
-
tooltip: "
|
|
20523
|
+
tooltip: "strikethroughKey",
|
|
20502
20524
|
onClick: actions?.toggleStrikethrough,
|
|
20503
20525
|
active: editorState?.isStrike,
|
|
20504
20526
|
disabled: !editorState?.canStrike
|
|
@@ -20511,7 +20533,7 @@ const Toolbar = ({
|
|
|
20511
20533
|
{
|
|
20512
20534
|
id: FEATURE_NAME_MAP.bulletList,
|
|
20513
20535
|
icon: List,
|
|
20514
|
-
tooltip: "
|
|
20536
|
+
tooltip: "bulletListKey",
|
|
20515
20537
|
onClick: actions?.toggleBulletList,
|
|
20516
20538
|
active: editorState?.isBulletList,
|
|
20517
20539
|
disabled: !editorState?.canBulletList
|
|
@@ -20522,7 +20544,7 @@ const Toolbar = ({
|
|
|
20522
20544
|
{
|
|
20523
20545
|
id: FEATURE_NAME_MAP.orderedList,
|
|
20524
20546
|
icon: ListOrdered,
|
|
20525
|
-
tooltip: "
|
|
20547
|
+
tooltip: "orderedListKey",
|
|
20526
20548
|
onClick: actions?.toggleOrderedList,
|
|
20527
20549
|
active: editorState?.isOrderedList,
|
|
20528
20550
|
disabled: !editorState?.canOrderedList
|
|
@@ -20535,7 +20557,7 @@ const Toolbar = ({
|
|
|
20535
20557
|
{
|
|
20536
20558
|
id: FEATURE_NAME_MAP.blockquote,
|
|
20537
20559
|
icon: TextQuote,
|
|
20538
|
-
tooltip: "
|
|
20560
|
+
tooltip: "blockquoteKey",
|
|
20539
20561
|
onClick: actions?.toggleBlockquote,
|
|
20540
20562
|
active: editorState?.isBlockquote,
|
|
20541
20563
|
disabled: !editorState?.canBlockquote
|
|
@@ -20546,7 +20568,7 @@ const Toolbar = ({
|
|
|
20546
20568
|
{
|
|
20547
20569
|
id: FEATURE_NAME_MAP.code,
|
|
20548
20570
|
icon: Code,
|
|
20549
|
-
tooltip: "
|
|
20571
|
+
tooltip: "codeKey",
|
|
20550
20572
|
onClick: actions?.toggleCode,
|
|
20551
20573
|
active: editorState?.isCode,
|
|
20552
20574
|
disabled: !editorState?.canCode
|
|
@@ -20557,7 +20579,7 @@ const Toolbar = ({
|
|
|
20557
20579
|
{
|
|
20558
20580
|
id: FEATURE_NAME_MAP.codeBlock,
|
|
20559
20581
|
icon: FileCode2,
|
|
20560
|
-
tooltip: "
|
|
20582
|
+
tooltip: "codeBlockKey",
|
|
20561
20583
|
onClick: actions?.toggleCodeBlock,
|
|
20562
20584
|
active: editorState?.isCodeBlock,
|
|
20563
20585
|
disabled: !editorState?.canCodeBlock
|
|
@@ -20568,7 +20590,7 @@ const Toolbar = ({
|
|
|
20568
20590
|
/* @__PURE__ */ jsxRuntime.jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
20569
20591
|
ToolbarButton,
|
|
20570
20592
|
{
|
|
20571
|
-
tooltip: "
|
|
20593
|
+
tooltip: "moreOptionsKey",
|
|
20572
20594
|
icon: Ellipsis,
|
|
20573
20595
|
"aria-label": "More formatting options"
|
|
20574
20596
|
}
|
|
@@ -20579,7 +20601,7 @@ const Toolbar = ({
|
|
|
20579
20601
|
{
|
|
20580
20602
|
id: FEATURE_NAME_MAP.italic,
|
|
20581
20603
|
icon: Italic,
|
|
20582
|
-
tooltip: "
|
|
20604
|
+
tooltip: "italicKey",
|
|
20583
20605
|
onClick: actions?.toggleItalic,
|
|
20584
20606
|
active: editorState?.isItalic,
|
|
20585
20607
|
disabled: !editorState?.canItalic
|
|
@@ -20590,7 +20612,7 @@ const Toolbar = ({
|
|
|
20590
20612
|
{
|
|
20591
20613
|
id: FEATURE_NAME_MAP.strike,
|
|
20592
20614
|
icon: Strikethrough,
|
|
20593
|
-
tooltip: "
|
|
20615
|
+
tooltip: "strikethroughKey",
|
|
20594
20616
|
onClick: actions?.toggleStrikethrough,
|
|
20595
20617
|
active: editorState?.isStrike,
|
|
20596
20618
|
disabled: !editorState?.canStrike
|
|
@@ -20601,7 +20623,7 @@ const Toolbar = ({
|
|
|
20601
20623
|
{
|
|
20602
20624
|
id: FEATURE_NAME_MAP.blockquote,
|
|
20603
20625
|
icon: TextQuote,
|
|
20604
|
-
tooltip: "
|
|
20626
|
+
tooltip: "blockquoteKey",
|
|
20605
20627
|
onClick: actions?.toggleBlockquote,
|
|
20606
20628
|
active: editorState?.isBlockquote,
|
|
20607
20629
|
disabled: !editorState?.canBlockquote
|
|
@@ -20612,7 +20634,7 @@ const Toolbar = ({
|
|
|
20612
20634
|
{
|
|
20613
20635
|
id: FEATURE_NAME_MAP.code,
|
|
20614
20636
|
icon: Code,
|
|
20615
|
-
tooltip: "
|
|
20637
|
+
tooltip: "codeKey",
|
|
20616
20638
|
onClick: actions?.toggleCode,
|
|
20617
20639
|
active: editorState?.isCode,
|
|
20618
20640
|
disabled: !editorState?.canCode
|
|
@@ -20623,7 +20645,7 @@ const Toolbar = ({
|
|
|
20623
20645
|
{
|
|
20624
20646
|
id: FEATURE_NAME_MAP.codeBlock,
|
|
20625
20647
|
icon: FileCode2,
|
|
20626
|
-
tooltip: "
|
|
20648
|
+
tooltip: "codeBlockKey",
|
|
20627
20649
|
onClick: actions?.toggleCodeBlock,
|
|
20628
20650
|
active: editorState?.isCodeBlock,
|
|
20629
20651
|
disabled: !editorState?.canCodeBlock
|
|
@@ -20665,7 +20687,7 @@ const Toolbar = ({
|
|
|
20665
20687
|
{
|
|
20666
20688
|
id: FEATURE_NAME_MAP.image,
|
|
20667
20689
|
icon: ImagePlus,
|
|
20668
|
-
tooltip: "
|
|
20690
|
+
tooltip: "insertImageKey",
|
|
20669
20691
|
disabled: !editorState?.canInsertImage,
|
|
20670
20692
|
onMouseOver: () => setMediaType(MediaNodeTypes.Image),
|
|
20671
20693
|
onClick: handleOpenLocalMediaPicker
|
|
@@ -20677,7 +20699,7 @@ const Toolbar = ({
|
|
|
20677
20699
|
id: FEATURE_NAME_MAP.video,
|
|
20678
20700
|
icon: Video,
|
|
20679
20701
|
disabled: !editorState?.canInsertVideo,
|
|
20680
|
-
tooltip: "
|
|
20702
|
+
tooltip: "insertVideoKey",
|
|
20681
20703
|
onMouseOver: () => setMediaType(MediaNodeTypes.Video),
|
|
20682
20704
|
onClick: handleOpenLocalMediaPicker
|
|
20683
20705
|
}
|
|
@@ -20688,7 +20710,7 @@ const Toolbar = ({
|
|
|
20688
20710
|
id: FEATURE_NAME_MAP.audio,
|
|
20689
20711
|
icon: Music,
|
|
20690
20712
|
disabled: !editorState?.canInsertAudio,
|
|
20691
|
-
tooltip: "
|
|
20713
|
+
tooltip: "insertAudioKey",
|
|
20692
20714
|
onMouseOver: () => setMediaType(MediaNodeTypes.Audio),
|
|
20693
20715
|
onClick: handleOpenLocalMediaPicker
|
|
20694
20716
|
}
|
|
@@ -20706,7 +20728,7 @@ const Toolbar = ({
|
|
|
20706
20728
|
onClick: handleOpenGifPicker,
|
|
20707
20729
|
disabled: !editorState?.canInsertImage,
|
|
20708
20730
|
icon: GifIcon,
|
|
20709
|
-
tooltip: "
|
|
20731
|
+
tooltip: "searchGifOrImagesKey",
|
|
20710
20732
|
className: "p-1 [&>svg]:size-5!"
|
|
20711
20733
|
}
|
|
20712
20734
|
)
|
|
@@ -20726,7 +20748,7 @@ const Toolbar = ({
|
|
|
20726
20748
|
{
|
|
20727
20749
|
id: FEATURE_NAME_MAP.customLink,
|
|
20728
20750
|
icon: Link,
|
|
20729
|
-
tooltip: "
|
|
20751
|
+
tooltip: "addLinkPreviewKey",
|
|
20730
20752
|
onClick: handleClickLink,
|
|
20731
20753
|
active: editorState?.isLink,
|
|
20732
20754
|
disabled: !editorState?.canLink
|
|
@@ -20747,7 +20769,8 @@ const Toolbar = ({
|
|
|
20747
20769
|
}
|
|
20748
20770
|
),
|
|
20749
20771
|
/* @__PURE__ */ jsxRuntime.jsxs(Label$1, { htmlFor: "send-cross-mention", children: [
|
|
20750
|
-
"
|
|
20772
|
+
t("crossPostKey"),
|
|
20773
|
+
" ",
|
|
20751
20774
|
/* @__PURE__ */ jsxRuntime.jsx(Forward, {})
|
|
20752
20775
|
] })
|
|
20753
20776
|
] })
|
|
@@ -20761,7 +20784,8 @@ const Toolbar = ({
|
|
|
20761
20784
|
"cursor-pointer bg-primary-send hover:bg-primary-send/85 active:scale-95 w-fit ml-auto"
|
|
20762
20785
|
),
|
|
20763
20786
|
children: [
|
|
20764
|
-
"
|
|
20787
|
+
t("postKey"),
|
|
20788
|
+
" ",
|
|
20765
20789
|
isSubmitting ? /* @__PURE__ */ jsxRuntime.jsx(Spinner, {}) : /* @__PURE__ */ jsxRuntime.jsx(SendHorizontal, {})
|
|
20766
20790
|
]
|
|
20767
20791
|
}
|
|
@@ -21010,7 +21034,7 @@ const EditMediaToolbar = ({
|
|
|
21010
21034
|
{
|
|
21011
21035
|
active: align === Alignment.LEFT,
|
|
21012
21036
|
icon: TextAlignStart,
|
|
21013
|
-
tooltip: "
|
|
21037
|
+
tooltip: "alignLeftKey",
|
|
21014
21038
|
onClick: () => onAlign(Alignment.LEFT)
|
|
21015
21039
|
}
|
|
21016
21040
|
),
|
|
@@ -21019,7 +21043,7 @@ const EditMediaToolbar = ({
|
|
|
21019
21043
|
{
|
|
21020
21044
|
active: align === Alignment.CENTER,
|
|
21021
21045
|
icon: TextAlignCenter,
|
|
21022
|
-
tooltip: "
|
|
21046
|
+
tooltip: "alignCenterKey",
|
|
21023
21047
|
onClick: () => onAlign(Alignment.CENTER)
|
|
21024
21048
|
}
|
|
21025
21049
|
),
|
|
@@ -21028,7 +21052,7 @@ const EditMediaToolbar = ({
|
|
|
21028
21052
|
{
|
|
21029
21053
|
active: align === Alignment.RIGHT,
|
|
21030
21054
|
icon: TextAlignEnd,
|
|
21031
|
-
tooltip: "
|
|
21055
|
+
tooltip: "alignRightKey",
|
|
21032
21056
|
onClick: () => onAlign(Alignment.RIGHT)
|
|
21033
21057
|
}
|
|
21034
21058
|
)
|
|
@@ -21039,7 +21063,7 @@ const EditMediaToolbar = ({
|
|
|
21039
21063
|
variant: "destructive",
|
|
21040
21064
|
className: "bg-transparent hover:bg-accent text-red-300 hover:text-destructive",
|
|
21041
21065
|
icon: Trash2,
|
|
21042
|
-
tooltip: "
|
|
21066
|
+
tooltip: "deleteKey",
|
|
21043
21067
|
onClick: onDelete
|
|
21044
21068
|
}
|
|
21045
21069
|
)
|
|
@@ -22872,6 +22896,7 @@ const TextInputSection = ({
|
|
|
22872
22896
|
onSubmit,
|
|
22873
22897
|
disabled
|
|
22874
22898
|
}) => {
|
|
22899
|
+
const { t } = usePostBuilder();
|
|
22875
22900
|
const handleKeyDown = (e) => {
|
|
22876
22901
|
if (e.key === "Enter") {
|
|
22877
22902
|
e.preventDefault();
|
|
@@ -22880,13 +22905,13 @@ const TextInputSection = ({
|
|
|
22880
22905
|
};
|
|
22881
22906
|
const isNearLimit = value.length > POLL_LIMITS.MAX_TEXT_LENGTH * 0.9;
|
|
22882
22907
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-2", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-end gap-2", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1 space-y-1.5", children: [
|
|
22883
|
-
/* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: "poll-text-input", className: "text-sm font-medium text-foreground", children: "
|
|
22908
|
+
/* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: "poll-text-input", className: "text-sm font-medium text-foreground", children: t("addTextOptionKey") }),
|
|
22884
22909
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center sm:gap-3 gap-1", children: [
|
|
22885
22910
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
22886
22911
|
Input,
|
|
22887
22912
|
{
|
|
22888
22913
|
id: "poll-text-input",
|
|
22889
|
-
placeholder: "
|
|
22914
|
+
placeholder: t("enterTextOptionKey"),
|
|
22890
22915
|
value,
|
|
22891
22916
|
onChange: (e) => onChange(e.target.value),
|
|
22892
22917
|
onKeyDown: handleKeyDown,
|
|
@@ -22904,13 +22929,13 @@ const TextInputSection = ({
|
|
|
22904
22929
|
size: "default",
|
|
22905
22930
|
children: [
|
|
22906
22931
|
/* @__PURE__ */ jsxRuntime.jsx(Type, { className: "h-4 w-4 sm:mr-2" }),
|
|
22907
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "hidden sm:inline", children: "
|
|
22932
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "hidden sm:inline", children: t("addKey") })
|
|
22908
22933
|
]
|
|
22909
22934
|
}
|
|
22910
22935
|
)
|
|
22911
22936
|
] }),
|
|
22912
22937
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between text-xs text-muted-foreground", children: [
|
|
22913
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "
|
|
22938
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: t("pressEnterToAddKey") }),
|
|
22914
22939
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
22915
22940
|
"span",
|
|
22916
22941
|
{
|
|
@@ -22933,6 +22958,7 @@ const FileInputSection = ({
|
|
|
22933
22958
|
onImageSelect,
|
|
22934
22959
|
disabled
|
|
22935
22960
|
}) => {
|
|
22961
|
+
const { t } = usePostBuilder();
|
|
22936
22962
|
const ref = React.useRef(null);
|
|
22937
22963
|
const [openSearchModal, setOpenSearchModal] = React.useState(false);
|
|
22938
22964
|
const handleFileSelect = (e) => {
|
|
@@ -22942,7 +22968,7 @@ const FileInputSection = ({
|
|
|
22942
22968
|
void onFileSelect(files);
|
|
22943
22969
|
e.target.value = "";
|
|
22944
22970
|
};
|
|
22945
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex
|
|
22971
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
22946
22972
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
22947
22973
|
Button,
|
|
22948
22974
|
{
|
|
@@ -22952,7 +22978,7 @@ const FileInputSection = ({
|
|
|
22952
22978
|
onClick: () => ref.current?.click(),
|
|
22953
22979
|
children: [
|
|
22954
22980
|
/* @__PURE__ */ jsxRuntime.jsx(ImagePlus, { className: "h-4 w-4" }),
|
|
22955
|
-
"
|
|
22981
|
+
t("uploadKey")
|
|
22956
22982
|
]
|
|
22957
22983
|
}
|
|
22958
22984
|
),
|
|
@@ -22977,7 +23003,8 @@ const FileInputSection = ({
|
|
|
22977
23003
|
onImageSelect,
|
|
22978
23004
|
children: /* @__PURE__ */ jsxRuntime.jsxs(Button, { disabled, className: "cursor-pointer flex-1 [&>svg]:size-6", children: [
|
|
22979
23005
|
/* @__PURE__ */ jsxRuntime.jsx(GifIcon, {}),
|
|
22980
|
-
"
|
|
23006
|
+
" ",
|
|
23007
|
+
t("searchGifOrImagesKey")
|
|
22981
23008
|
] })
|
|
22982
23009
|
}
|
|
22983
23010
|
)
|
|
@@ -23804,7 +23831,7 @@ const LinkMarkView = ({ mark, editor }) => {
|
|
|
23804
23831
|
ToolbarButton,
|
|
23805
23832
|
{
|
|
23806
23833
|
size: "icon",
|
|
23807
|
-
tooltip: "
|
|
23834
|
+
tooltip: "visitLinkKey",
|
|
23808
23835
|
onClick: () => window.open(mark.attrs.href, "_blank"),
|
|
23809
23836
|
children: /* @__PURE__ */ jsxRuntime.jsx(ExternalLink, {})
|
|
23810
23837
|
}
|
|
@@ -23821,14 +23848,14 @@ const LinkMarkView = ({ mark, editor }) => {
|
|
|
23821
23848
|
},
|
|
23822
23849
|
onInsertLink: handleUpdateLink,
|
|
23823
23850
|
hideTextInput: mark?.attrs?.isLinkMode,
|
|
23824
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(ToolbarButton, { size: "icon", tooltip: "
|
|
23851
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(ToolbarButton, { size: "icon", tooltip: "editLinkKey", children: /* @__PURE__ */ jsxRuntime.jsx(SquarePen, {}) })
|
|
23825
23852
|
}
|
|
23826
23853
|
),
|
|
23827
23854
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
23828
23855
|
ToolbarButton,
|
|
23829
23856
|
{
|
|
23830
23857
|
size: "icon",
|
|
23831
|
-
tooltip: "
|
|
23858
|
+
tooltip: "unsetLinkKey",
|
|
23832
23859
|
onClick: () => {
|
|
23833
23860
|
setOpen(false);
|
|
23834
23861
|
editor.commands.unsetLink();
|
|
@@ -29699,7 +29726,7 @@ const MentionList = React.forwardRef((props, ref) => {
|
|
|
29699
29726
|
filteredItems.length,
|
|
29700
29727
|
")"
|
|
29701
29728
|
] }),
|
|
29702
|
-
/* @__PURE__ */ jsxRuntime.jsx("ul", { className: "max-h-64 overflow-y-auto", children: filteredItems.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-4 text-center text-sm text-gray-500 dark:text-gray-400", children: props.query ? `No ${isMention ? "users" : "hashtags"} found for "${props.query}"` : `No ${isMention ? "users" : "hashtags"} found` }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-1", children: filteredItems.map((item, index2) => /* @__PURE__ */ jsxRuntime.
|
|
29729
|
+
/* @__PURE__ */ jsxRuntime.jsx("ul", { className: "max-h-64 overflow-y-auto", children: filteredItems.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-4 text-center text-sm text-gray-500 dark:text-gray-400", children: props.query ? `No ${isMention ? "users" : "hashtags"} found for "${props.query}"` : `No ${isMention ? "users" : "hashtags"} found` }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-1", children: filteredItems.map((item, index2) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
29703
29730
|
"li",
|
|
29704
29731
|
{
|
|
29705
29732
|
ref: (el) => {
|
|
@@ -29707,39 +29734,12 @@ const MentionList = React.forwardRef((props, ref) => {
|
|
|
29707
29734
|
},
|
|
29708
29735
|
onClick: () => selectItem(index2),
|
|
29709
29736
|
className: `flex items-center gap-3 px-3 py-2.5 cursor-pointer rounded-md transition-colors ${selectedIndex === index2 ? "bg-blue-50 dark:bg-blue-900/20" : "hover:bg-gray-50 dark:hover:bg-gray-700/50"}`,
|
|
29710
|
-
children:
|
|
29711
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
29712
|
-
|
|
29713
|
-
{
|
|
29714
|
-
src: item.avatar,
|
|
29715
|
-
alt: item.label,
|
|
29716
|
-
className: "h-9 w-9 rounded-full object-cover"
|
|
29717
|
-
}
|
|
29718
|
-
) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-white font-medium text-sm", children: item.label?.charAt(0).toUpperCase() }) }),
|
|
29719
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col min-w-0 flex-1", children: [
|
|
29737
|
+
children: [
|
|
29738
|
+
/* @__PURE__ */ jsxRuntime.jsx(Avatar, { className: "size-9 shrink-0 bg-linear-to-br from-blue-400 to-blue-600", children: item.avatar ? /* @__PURE__ */ jsxRuntime.jsx(AvatarImage, { src: item.avatar, alt: item.label }) : /* @__PURE__ */ jsxRuntime.jsx(AvatarFallback, { className: "text-white bg-transparent font-medium text-sm", children: item.label?.charAt(0).toUpperCase() }) }),
|
|
29739
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col min-w-0 flex-1", children: isMention ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
29720
29740
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-medium text-sm text-gray-900 dark:text-gray-100 truncate", children: item.label }),
|
|
29721
29741
|
item.email && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs text-gray-500 dark:text-gray-400 truncate", children: item.email })
|
|
29722
|
-
] })
|
|
29723
|
-
] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
29724
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex h-9 w-9 flex-shrink-0 items-center justify-center rounded-md bg-gradient-to-br from-purple-400 to-purple-600", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
29725
|
-
"svg",
|
|
29726
|
-
{
|
|
29727
|
-
className: "h-5 w-5 text-white",
|
|
29728
|
-
fill: "none",
|
|
29729
|
-
stroke: "currentColor",
|
|
29730
|
-
viewBox: "0 0 24 24",
|
|
29731
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
29732
|
-
"path",
|
|
29733
|
-
{
|
|
29734
|
-
strokeLinecap: "round",
|
|
29735
|
-
strokeLinejoin: "round",
|
|
29736
|
-
strokeWidth: 2,
|
|
29737
|
-
d: "M7 20l4-16m2 16l4-16M6 9h14M4 15h14"
|
|
29738
|
-
}
|
|
29739
|
-
)
|
|
29740
|
-
}
|
|
29741
|
-
) }),
|
|
29742
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col min-w-0 flex-1", children: [
|
|
29742
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
29743
29743
|
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "font-medium text-sm text-gray-900 dark:text-gray-100 truncate", children: [
|
|
29744
29744
|
"#",
|
|
29745
29745
|
item.label
|
|
@@ -29748,8 +29748,8 @@ const MentionList = React.forwardRef((props, ref) => {
|
|
|
29748
29748
|
item.count.toLocaleString(),
|
|
29749
29749
|
" posts"
|
|
29750
29750
|
] })
|
|
29751
|
-
] })
|
|
29752
|
-
]
|
|
29751
|
+
] }) })
|
|
29752
|
+
]
|
|
29753
29753
|
},
|
|
29754
29754
|
item.id
|
|
29755
29755
|
)) }) }),
|
|
@@ -29799,7 +29799,7 @@ const mentionService = (api, mfs, store) => {
|
|
|
29799
29799
|
return [];
|
|
29800
29800
|
}
|
|
29801
29801
|
const response = await api.fetchGroupConversations(999, 0);
|
|
29802
|
-
return response.entries.
|
|
29802
|
+
return response.entries.map(
|
|
29803
29803
|
(item) => ({
|
|
29804
29804
|
id: item?.group_id,
|
|
29805
29805
|
label: item?.group?.name,
|
|
@@ -29912,16 +29912,6 @@ const configureMentionExtension = (api, mfs, store) => {
|
|
|
29912
29912
|
]
|
|
29913
29913
|
});
|
|
29914
29914
|
};
|
|
29915
|
-
function Skeleton({ className, ...props }) {
|
|
29916
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
29917
|
-
"div",
|
|
29918
|
-
{
|
|
29919
|
-
"data-slot": "skeleton",
|
|
29920
|
-
className: cn("bg-accent animate-pulse rounded-md", className),
|
|
29921
|
-
...props
|
|
29922
|
-
}
|
|
29923
|
-
);
|
|
29924
|
-
}
|
|
29925
29915
|
const LinkPreviewCompact = ({
|
|
29926
29916
|
selected,
|
|
29927
29917
|
href,
|
|
@@ -29931,6 +29921,7 @@ const LinkPreviewCompact = ({
|
|
|
29931
29921
|
domain,
|
|
29932
29922
|
onClickDelete
|
|
29933
29923
|
}) => {
|
|
29924
|
+
const { t } = usePostBuilder();
|
|
29934
29925
|
const safeDomain = React.useMemo(() => {
|
|
29935
29926
|
try {
|
|
29936
29927
|
return domain || new URL(href).hostname;
|
|
@@ -29952,16 +29943,16 @@ const LinkPreviewCompact = ({
|
|
|
29952
29943
|
),
|
|
29953
29944
|
children: [
|
|
29954
29945
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 absolute z-50 right-2 top-1", children: [
|
|
29955
|
-
/* @__PURE__ */ jsxRuntime.jsx(ToolbarButton, { asChild: true, tooltip: "
|
|
29946
|
+
/* @__PURE__ */ jsxRuntime.jsx(ToolbarButton, { asChild: true, tooltip: "visitLinkKey", children: /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "relative", children: [
|
|
29956
29947
|
/* @__PURE__ */ jsxRuntime.jsx("a", { href, target: "_blank", rel: "noopener noreferrer", className: "absolute inset-0" }),
|
|
29957
29948
|
/* @__PURE__ */ jsxRuntime.jsx(ExternalLink, {})
|
|
29958
29949
|
] }) }),
|
|
29959
29950
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
29960
29951
|
ToolbarButton,
|
|
29961
29952
|
{
|
|
29962
|
-
tooltip: "
|
|
29953
|
+
tooltip: "removeLinkPreviewKey",
|
|
29963
29954
|
onClick: handleDelete,
|
|
29964
|
-
"aria-label": "
|
|
29955
|
+
"aria-label": t("removeLinkPreviewKey"),
|
|
29965
29956
|
type: "button",
|
|
29966
29957
|
size: "icon",
|
|
29967
29958
|
className: "cursor-pointer size-6 shadow-none bg-transparent group-hover:bg-destructive/5 hover:bg-destructive/10 text-destructive hover:text-destructive",
|
|
@@ -29970,7 +29961,7 @@ const LinkPreviewCompact = ({
|
|
|
29970
29961
|
)
|
|
29971
29962
|
] }),
|
|
29972
29963
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative z-0 w-full", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "group flex items-center gap-3 rounded-lg border bg-accent/30 p-3 transition-all hover:border-foreground/20 hover:shadow-sm", children: [
|
|
29973
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative h-16 w-16
|
|
29964
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative h-16 w-16 shrink-0 overflow-hidden rounded-md bg-muted", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
29974
29965
|
"img",
|
|
29975
29966
|
{
|
|
29976
29967
|
src: image,
|
|
@@ -29983,7 +29974,7 @@ const LinkPreviewCompact = ({
|
|
|
29983
29974
|
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "line-clamp-1 text-xs text-muted-foreground", children: description }),
|
|
29984
29975
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-1 flex items-center gap-1 text-xs text-muted-foreground", children: [
|
|
29985
29976
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate", children: safeDomain }),
|
|
29986
|
-
/* @__PURE__ */ jsxRuntime.jsx(ExternalLink, { className: "h-3 w-3
|
|
29977
|
+
/* @__PURE__ */ jsxRuntime.jsx(ExternalLink, { className: "h-3 w-3 shrink-0 opacity-50" })
|
|
29987
29978
|
] })
|
|
29988
29979
|
] })
|
|
29989
29980
|
] }) })
|
|
@@ -30000,6 +29991,7 @@ const LinkPreviewExtended = ({
|
|
|
30000
29991
|
domain,
|
|
30001
29992
|
onClickDelete
|
|
30002
29993
|
}) => {
|
|
29994
|
+
const { t } = usePostBuilder();
|
|
30003
29995
|
const safeDomain = React.useMemo(() => {
|
|
30004
29996
|
try {
|
|
30005
29997
|
return domain || new URL(href).hostname;
|
|
@@ -30025,7 +30017,7 @@ const LinkPreviewExtended = ({
|
|
|
30025
30017
|
ToolbarButton,
|
|
30026
30018
|
{
|
|
30027
30019
|
asChild: true,
|
|
30028
|
-
tooltip: "
|
|
30020
|
+
tooltip: "visitLinkKey",
|
|
30029
30021
|
className: "cursor-pointer backdrop-blur-2xl size-6 shadow-none group-hover:bg-accent/70 group-hover:text-accent-foreground text-primary-send",
|
|
30030
30022
|
children: /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "relative", children: [
|
|
30031
30023
|
/* @__PURE__ */ jsxRuntime.jsx("a", { href, target: "_blank", rel: "noopener noreferrer", className: "absolute inset-0" }),
|
|
@@ -30036,9 +30028,9 @@ const LinkPreviewExtended = ({
|
|
|
30036
30028
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
30037
30029
|
ToolbarButton,
|
|
30038
30030
|
{
|
|
30039
|
-
tooltip: "
|
|
30031
|
+
tooltip: "removeLinkPreviewKey",
|
|
30040
30032
|
onClick: handleDelete,
|
|
30041
|
-
"aria-label": "
|
|
30033
|
+
"aria-label": t("removeLinkPreviewKey"),
|
|
30042
30034
|
type: "button",
|
|
30043
30035
|
size: "icon",
|
|
30044
30036
|
className: "cursor-pointer backdrop-blur-2xl size-6 shadow-none bg-transparent group-hover:bg-red-50/70 hover:bg-red-50 text-destructive hover:text-destructive",
|
|
@@ -30068,8 +30060,19 @@ const LinkPreviewExtended = ({
|
|
|
30068
30060
|
}
|
|
30069
30061
|
);
|
|
30070
30062
|
};
|
|
30063
|
+
function Skeleton({ className, ...props }) {
|
|
30064
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
30065
|
+
"div",
|
|
30066
|
+
{
|
|
30067
|
+
"data-slot": "skeleton",
|
|
30068
|
+
className: cn("bg-accent animate-pulse rounded-md", className),
|
|
30069
|
+
...props
|
|
30070
|
+
}
|
|
30071
|
+
);
|
|
30072
|
+
}
|
|
30071
30073
|
const LinkPreviewCard = ({ node, deleteNode, selected }) => {
|
|
30072
30074
|
const { loading, href, domain, variant } = node.attrs;
|
|
30075
|
+
const { t } = usePostBuilder();
|
|
30073
30076
|
const safeDomain = React.useMemo(() => {
|
|
30074
30077
|
try {
|
|
30075
30078
|
return domain || new URL(href).hostname;
|
|
@@ -30078,7 +30081,7 @@ const LinkPreviewCard = ({ node, deleteNode, selected }) => {
|
|
|
30078
30081
|
}
|
|
30079
30082
|
}, [href, domain]);
|
|
30080
30083
|
if (loading)
|
|
30081
|
-
return /* @__PURE__ */ jsxRuntime.jsx(react.NodeViewWrapper, { children: /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { className: "w-full h-24 flex items-center justify-center rounded-lg", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-muted-foreground", children: "
|
|
30084
|
+
return /* @__PURE__ */ jsxRuntime.jsx(react.NodeViewWrapper, { children: /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { className: "w-full h-24 flex items-center justify-center rounded-lg", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-muted-foreground", children: t("fetchingMetadataKey") }) }) });
|
|
30082
30085
|
if (!href) return null;
|
|
30083
30086
|
return /* @__PURE__ */ jsxRuntime.jsx(react.NodeViewWrapper, { contentEditable: false, "data-drag-handle": true, children: variant === LinkPreviewType.Compact ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
30084
30087
|
LinkPreviewCompact,
|
|
@@ -30558,7 +30561,7 @@ const CODE_BLOCK_HTML_ATTRIBUTES = {
|
|
|
30558
30561
|
};
|
|
30559
30562
|
const createCustomDocument = (content) => Document__default.default.extend({ content });
|
|
30560
30563
|
const PollDoc = createCustomDocument("paragraph poll");
|
|
30561
|
-
const MediaDoc = createCustomDocument("paragraph media? linkPreview? mediaGroup?");
|
|
30564
|
+
const MediaDoc = createCustomDocument("paragraph+ media? linkPreview? mediaGroup?");
|
|
30562
30565
|
createCustomDocument("paragraph linkPreview?");
|
|
30563
30566
|
const getStarterKitConfig = ({
|
|
30564
30567
|
includeLink = false,
|
|
@@ -30578,7 +30581,7 @@ const getPlaceholderExtension = (placeholder) => extensions.Placeholder.configur
|
|
|
30578
30581
|
const getMentionExtension = (core2, mfs, store) => configureMentionExtension(core2, mfs, store);
|
|
30579
30582
|
const getExtensions = ({ editorType, api, store, user }) => {
|
|
30580
30583
|
const extensionMap = {
|
|
30581
|
-
[EditorTypes.
|
|
30584
|
+
[EditorTypes.Blog]: getDefaultExtensions,
|
|
30582
30585
|
[EditorTypes.Media]: getMediaExtensions,
|
|
30583
30586
|
// [EditorTypes.Link]: getLinkExtensions,
|
|
30584
30587
|
[EditorTypes.Poll]: getPollExtensions
|
|
@@ -30740,7 +30743,7 @@ const usePostBuilderEditor = ({ editorType, groupId, postId, user }) => {
|
|
|
30740
30743
|
editorProps: getEditorProps(),
|
|
30741
30744
|
onCreate: ({ editor: editor2 }) => {
|
|
30742
30745
|
store.getState().setEditor(editor2);
|
|
30743
|
-
if (editorType === EditorTypes.
|
|
30746
|
+
if (editorType === EditorTypes.Blog) editor2?.chain()?.focus()?.run();
|
|
30744
30747
|
if (editorType === EditorTypes.Media) editor2?.chain()?.focus()?.run();
|
|
30745
30748
|
if (editorType === EditorTypes.Poll) initializePollEditor(editor2);
|
|
30746
30749
|
},
|
|
@@ -30889,7 +30892,7 @@ const generatePollPostPayload = ({
|
|
|
30889
30892
|
};
|
|
30890
30893
|
const generateCreatePostPayload = (editorTab, params) => {
|
|
30891
30894
|
switch (editorTab) {
|
|
30892
|
-
case EditorTypes.
|
|
30895
|
+
case EditorTypes.Blog:
|
|
30893
30896
|
return generateHtmlPostPayload(params);
|
|
30894
30897
|
case EditorTypes.Media:
|
|
30895
30898
|
return generateMediaPostPayload(params);
|
|
@@ -30990,7 +30993,7 @@ const PostBuilderEditorInstance = ({
|
|
|
30990
30993
|
editor,
|
|
30991
30994
|
className: cn(
|
|
30992
30995
|
"pr-2",
|
|
30993
|
-
editorTab !== EditorTypes.
|
|
30996
|
+
editorTab !== EditorTypes.Blog && "hidden size-0 overflow-hidden pointer-events-none"
|
|
30994
30997
|
),
|
|
30995
30998
|
children: /* @__PURE__ */ jsxRuntime.jsx(Button, { variant: "ghost", className: "bg-white cursor-grab py-0.5 px-0 border size-auto", children: /* @__PURE__ */ jsxRuntime.jsx(GripVertical, { className: "text-muted-foreground" }) })
|
|
30996
30999
|
}
|
|
@@ -31721,18 +31724,152 @@ const PostBuilderEditor = ({
|
|
|
31721
31724
|
}
|
|
31722
31725
|
);
|
|
31723
31726
|
};
|
|
31727
|
+
const translationFallback = {
|
|
31728
|
+
// General
|
|
31729
|
+
addKey: "Add",
|
|
31730
|
+
cancelKey: "Cancel",
|
|
31731
|
+
deleteKey: "Delete",
|
|
31732
|
+
editKey: "Edit",
|
|
31733
|
+
updateKey: "Update",
|
|
31734
|
+
insertKey: "Insert",
|
|
31735
|
+
uploadKey: "Upload",
|
|
31736
|
+
postKey: "Post",
|
|
31737
|
+
crossPostKey: "Cross-post to groups you #mention?",
|
|
31738
|
+
//Editor Tabs
|
|
31739
|
+
postTabKey: "Post",
|
|
31740
|
+
blogTabKey: "Blog",
|
|
31741
|
+
pollTabKey: "Poll",
|
|
31742
|
+
// Toolbar buttons
|
|
31743
|
+
alignLeftKey: "Align Left",
|
|
31744
|
+
alignCenterKey: "Align Center",
|
|
31745
|
+
alignRightKey: "Align Right",
|
|
31746
|
+
undoKey: "Undo",
|
|
31747
|
+
redoKey: "Redo",
|
|
31748
|
+
headingOptionsKey: "Heading Options",
|
|
31749
|
+
paragraphKey: "Paragraph",
|
|
31750
|
+
heading1Key: "Heading 1",
|
|
31751
|
+
heading2Key: "Heading 2",
|
|
31752
|
+
heading3Key: "Heading 3",
|
|
31753
|
+
boldKey: "Bold",
|
|
31754
|
+
italicKey: "Italic",
|
|
31755
|
+
strikethroughKey: "Strikethrough",
|
|
31756
|
+
bulletListKey: "Bullet List",
|
|
31757
|
+
orderedListKey: "Ordered List",
|
|
31758
|
+
blockquoteKey: "BlockQuote",
|
|
31759
|
+
codeKey: "Code",
|
|
31760
|
+
codeBlockKey: "Codeblock",
|
|
31761
|
+
moreOptionsKey: "More formatting options",
|
|
31762
|
+
// Media
|
|
31763
|
+
insertImageKey: "Insert Image",
|
|
31764
|
+
// Toolbar
|
|
31765
|
+
insertVideoKey: "Insert Video",
|
|
31766
|
+
// Toolbar
|
|
31767
|
+
insertAudioKey: "Insert Audio",
|
|
31768
|
+
// Toolbar
|
|
31769
|
+
searchGifOrImagesKey: "Search Gif/Images Online",
|
|
31770
|
+
mediaSearchTitleKey: "Search Media",
|
|
31771
|
+
gifSearchKey: "GIF Search",
|
|
31772
|
+
imageSearchKey: "Image Search",
|
|
31773
|
+
searchGifPlaceholder: "Search GIFs...",
|
|
31774
|
+
searchIMagePlaceholder: "Search Images...",
|
|
31775
|
+
// Links
|
|
31776
|
+
addLinkPreviewKey: "Add link with preview",
|
|
31777
|
+
editLinkKey: "Edit Link",
|
|
31778
|
+
visitLinkKey: "Visit Link",
|
|
31779
|
+
unsetLinkKey: "Unset Link",
|
|
31780
|
+
linkInputLabelKey: "Link URL",
|
|
31781
|
+
linkTextInputLabelKey: "Text to display",
|
|
31782
|
+
invalidLinkKey: "Please enter a valid URL",
|
|
31783
|
+
insertLinkKey: "Insert Link",
|
|
31784
|
+
updateLinkKey: "Update Link",
|
|
31785
|
+
removeLinkPreviewKey: "Remove Link Preview",
|
|
31786
|
+
fetchingMetadataKey: "Fetching Link Metadata...",
|
|
31787
|
+
// Poll related
|
|
31788
|
+
addTextOptionKey: "Add text option",
|
|
31789
|
+
enterTextOptionKey: "Enter a text option...",
|
|
31790
|
+
pressEnterToAddKey: "Press Enter to add"
|
|
31791
|
+
};
|
|
31792
|
+
const defaultTranslationKeyMappings = {
|
|
31793
|
+
// General
|
|
31794
|
+
addKey: "general_add",
|
|
31795
|
+
cancelKey: "cancel",
|
|
31796
|
+
deleteKey: "general_delete",
|
|
31797
|
+
editKey: "general_edit",
|
|
31798
|
+
updateKey: "general_update",
|
|
31799
|
+
insertKey: "general_insert",
|
|
31800
|
+
uploadKey: "general_upload",
|
|
31801
|
+
postKey: "general_send_post",
|
|
31802
|
+
crossPostKey: "cross_mention_title",
|
|
31803
|
+
//Editor Tabs
|
|
31804
|
+
postTabKey: "post_builder_tab_post_title",
|
|
31805
|
+
blogTabKey: "post_builder_tab_blog_title",
|
|
31806
|
+
pollTabKey: "post_builder_tab_poll_title",
|
|
31807
|
+
// Toolbar buttons
|
|
31808
|
+
alignLeftKey: "post_builder_formatting_tooltip_align_left",
|
|
31809
|
+
alignCenterKey: "post_builder_formatting_tooltip_align_center",
|
|
31810
|
+
alignRightKey: "post_builder_formatting_tooltip_align_right",
|
|
31811
|
+
undoKey: "post_builder_formatting_tooltip_undo",
|
|
31812
|
+
redoKey: "post_builder_formatting_tooltip_redo",
|
|
31813
|
+
headingOptionsKey: "post_builder_formatting_tooltip_heading_options",
|
|
31814
|
+
paragraphKey: "post_builder_formatting_tooltip_paragraph",
|
|
31815
|
+
heading1Key: "post_builder_formatting_tooltip_heading_one",
|
|
31816
|
+
heading2Key: "post_builder_formatting_tooltip_heading_two",
|
|
31817
|
+
heading3Key: "post_builder_formatting_tooltip_heading_three",
|
|
31818
|
+
boldKey: "post_builder_formatting_tooltip_bold",
|
|
31819
|
+
italicKey: "post_builder_formatting_tooltip_italic",
|
|
31820
|
+
strikethroughKey: "post_builder_formatting_tooltip_strikethrough",
|
|
31821
|
+
bulletListKey: "post_builder_formatting_tooltip_list_bullet",
|
|
31822
|
+
orderedListKey: "post_builder_formatting_tooltip_list_ordered",
|
|
31823
|
+
blockquoteKey: "post_builder_formatting_tooltip_blockquote",
|
|
31824
|
+
codeKey: "post_builder_formatting_tooltip_code",
|
|
31825
|
+
codeBlockKey: "post_builder_formatting_tooltip_codeblock",
|
|
31826
|
+
moreOptionsKey: "post_builder_formatting_tooltip_more_options",
|
|
31827
|
+
// Media
|
|
31828
|
+
insertImageKey: "post_builder_tooltip_insert_image",
|
|
31829
|
+
// Toolbar
|
|
31830
|
+
insertVideoKey: "post_builder_tooltip_insert_video",
|
|
31831
|
+
// Toolbar
|
|
31832
|
+
insertAudioKey: "post_builder_tooltip_insert_audio",
|
|
31833
|
+
// Toolbar
|
|
31834
|
+
searchGifOrImagesKey: "post_builder_tooltip_search_gif_or_image",
|
|
31835
|
+
mediaSearchTitleKey: "post_builder_media_search_modal_title",
|
|
31836
|
+
gifSearchKey: "post_builder_media_search_tab_gif_title",
|
|
31837
|
+
imageSearchKey: "post_builder_media_search_tab_image_title",
|
|
31838
|
+
searchGifPlaceholder: "post_builder_media_search_input_gif_placeholder",
|
|
31839
|
+
searchIMagePlaceholder: "post_builder_media_search_input_image_placeholder",
|
|
31840
|
+
// Links
|
|
31841
|
+
addLinkPreviewKey: "post_builder_tooltip_link_add",
|
|
31842
|
+
editLinkKey: "post_builder_tooltip_link_edit",
|
|
31843
|
+
visitLinkKey: "post_builder_tooltip_link_visit",
|
|
31844
|
+
unsetLinkKey: "post_builder_tooltip_link_unset",
|
|
31845
|
+
linkInputLabelKey: "post_builder_link_input_label",
|
|
31846
|
+
linkTextInputLabelKey: "post_builder_link_text_input_label",
|
|
31847
|
+
invalidLinkKey: "post_builder_link_input_invalid",
|
|
31848
|
+
insertLinkKey: "post_builder_link_insert_modal_title",
|
|
31849
|
+
updateLinkKey: "post_builder_link_update_modal_title",
|
|
31850
|
+
removeLinkPreviewKey: "post_builder_tooltip_link_remove_preview",
|
|
31851
|
+
fetchingMetadataKey: "post_builder_link_loading_metadata_placeholder",
|
|
31852
|
+
// Poll related
|
|
31853
|
+
addTextOptionKey: "post_builder_poll_add_text_option_input_label",
|
|
31854
|
+
enterTextOptionKey: "post_builder_poll_add_text_option_input_placeholder",
|
|
31855
|
+
pressEnterToAddKey: "post_builder_poll_add_text_option_input_command"
|
|
31856
|
+
};
|
|
31724
31857
|
const PostBuilderProvider = ({
|
|
31725
31858
|
children,
|
|
31726
31859
|
apiBaseURL,
|
|
31727
31860
|
authToken,
|
|
31728
31861
|
toI18N,
|
|
31729
|
-
i18nKeys,
|
|
31862
|
+
i18nKeys = defaultTranslationKeyMappings,
|
|
31730
31863
|
logEvent
|
|
31731
31864
|
}) => {
|
|
31732
31865
|
const t = React.useCallback(
|
|
31733
31866
|
(key, fallback) => {
|
|
31734
|
-
const
|
|
31735
|
-
|
|
31867
|
+
const i18nKeysDerived = { ...defaultTranslationKeyMappings, ...i18nKeys };
|
|
31868
|
+
const translationKey = i18nKeysDerived[key];
|
|
31869
|
+
const message = toI18N(translationKey);
|
|
31870
|
+
if (message !== translationKey) return message;
|
|
31871
|
+
const defaultMessage = translationFallback[key];
|
|
31872
|
+
if (defaultMessage) return defaultMessage;
|
|
31736
31873
|
return fallback || key;
|
|
31737
31874
|
},
|
|
31738
31875
|
[toI18N, i18nKeys]
|