@select-org/select-post-builder 1.1.3 → 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 +263 -127
- package/dist/post-builder.css +26 -18
- package/dist/post-builder.js +263 -127
- 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
|
}
|
|
@@ -20845,8 +20869,7 @@ const useHostAnalyticsBridge = () => {
|
|
|
20845
20869
|
};
|
|
20846
20870
|
const usePersistence = () => {
|
|
20847
20871
|
const saveCurrentTabContent = (editorType, editor) => {
|
|
20848
|
-
if (typeof window === "undefined" || typeof localStorage === "undefined" || !editor
|
|
20849
|
-
return;
|
|
20872
|
+
if (typeof window === "undefined" || typeof localStorage === "undefined" || !editor) return;
|
|
20850
20873
|
const json = editor?.getJSON();
|
|
20851
20874
|
const filteredJson = filterNodes(json, (node) => !node?.attrs?.uploading);
|
|
20852
20875
|
if (filteredJson) {
|
|
@@ -21011,7 +21034,7 @@ const EditMediaToolbar = ({
|
|
|
21011
21034
|
{
|
|
21012
21035
|
active: align === Alignment.LEFT,
|
|
21013
21036
|
icon: TextAlignStart,
|
|
21014
|
-
tooltip: "
|
|
21037
|
+
tooltip: "alignLeftKey",
|
|
21015
21038
|
onClick: () => onAlign(Alignment.LEFT)
|
|
21016
21039
|
}
|
|
21017
21040
|
),
|
|
@@ -21020,7 +21043,7 @@ const EditMediaToolbar = ({
|
|
|
21020
21043
|
{
|
|
21021
21044
|
active: align === Alignment.CENTER,
|
|
21022
21045
|
icon: TextAlignCenter,
|
|
21023
|
-
tooltip: "
|
|
21046
|
+
tooltip: "alignCenterKey",
|
|
21024
21047
|
onClick: () => onAlign(Alignment.CENTER)
|
|
21025
21048
|
}
|
|
21026
21049
|
),
|
|
@@ -21029,7 +21052,7 @@ const EditMediaToolbar = ({
|
|
|
21029
21052
|
{
|
|
21030
21053
|
active: align === Alignment.RIGHT,
|
|
21031
21054
|
icon: TextAlignEnd,
|
|
21032
|
-
tooltip: "
|
|
21055
|
+
tooltip: "alignRightKey",
|
|
21033
21056
|
onClick: () => onAlign(Alignment.RIGHT)
|
|
21034
21057
|
}
|
|
21035
21058
|
)
|
|
@@ -21040,7 +21063,7 @@ const EditMediaToolbar = ({
|
|
|
21040
21063
|
variant: "destructive",
|
|
21041
21064
|
className: "bg-transparent hover:bg-accent text-red-300 hover:text-destructive",
|
|
21042
21065
|
icon: Trash2,
|
|
21043
|
-
tooltip: "
|
|
21066
|
+
tooltip: "deleteKey",
|
|
21044
21067
|
onClick: onDelete
|
|
21045
21068
|
}
|
|
21046
21069
|
)
|
|
@@ -22873,6 +22896,7 @@ const TextInputSection = ({
|
|
|
22873
22896
|
onSubmit,
|
|
22874
22897
|
disabled
|
|
22875
22898
|
}) => {
|
|
22899
|
+
const { t } = usePostBuilder();
|
|
22876
22900
|
const handleKeyDown = (e) => {
|
|
22877
22901
|
if (e.key === "Enter") {
|
|
22878
22902
|
e.preventDefault();
|
|
@@ -22881,13 +22905,13 @@ const TextInputSection = ({
|
|
|
22881
22905
|
};
|
|
22882
22906
|
const isNearLimit = value.length > POLL_LIMITS.MAX_TEXT_LENGTH * 0.9;
|
|
22883
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: [
|
|
22884
|
-
/* @__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") }),
|
|
22885
22909
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center sm:gap-3 gap-1", children: [
|
|
22886
22910
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
22887
22911
|
Input,
|
|
22888
22912
|
{
|
|
22889
22913
|
id: "poll-text-input",
|
|
22890
|
-
placeholder: "
|
|
22914
|
+
placeholder: t("enterTextOptionKey"),
|
|
22891
22915
|
value,
|
|
22892
22916
|
onChange: (e) => onChange(e.target.value),
|
|
22893
22917
|
onKeyDown: handleKeyDown,
|
|
@@ -22905,13 +22929,13 @@ const TextInputSection = ({
|
|
|
22905
22929
|
size: "default",
|
|
22906
22930
|
children: [
|
|
22907
22931
|
/* @__PURE__ */ jsxRuntime.jsx(Type, { className: "h-4 w-4 sm:mr-2" }),
|
|
22908
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "hidden sm:inline", children: "
|
|
22932
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "hidden sm:inline", children: t("addKey") })
|
|
22909
22933
|
]
|
|
22910
22934
|
}
|
|
22911
22935
|
)
|
|
22912
22936
|
] }),
|
|
22913
22937
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between text-xs text-muted-foreground", children: [
|
|
22914
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "
|
|
22938
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: t("pressEnterToAddKey") }),
|
|
22915
22939
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
22916
22940
|
"span",
|
|
22917
22941
|
{
|
|
@@ -22934,6 +22958,7 @@ const FileInputSection = ({
|
|
|
22934
22958
|
onImageSelect,
|
|
22935
22959
|
disabled
|
|
22936
22960
|
}) => {
|
|
22961
|
+
const { t } = usePostBuilder();
|
|
22937
22962
|
const ref = React.useRef(null);
|
|
22938
22963
|
const [openSearchModal, setOpenSearchModal] = React.useState(false);
|
|
22939
22964
|
const handleFileSelect = (e) => {
|
|
@@ -22943,7 +22968,7 @@ const FileInputSection = ({
|
|
|
22943
22968
|
void onFileSelect(files);
|
|
22944
22969
|
e.target.value = "";
|
|
22945
22970
|
};
|
|
22946
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex
|
|
22971
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
22947
22972
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
22948
22973
|
Button,
|
|
22949
22974
|
{
|
|
@@ -22953,7 +22978,7 @@ const FileInputSection = ({
|
|
|
22953
22978
|
onClick: () => ref.current?.click(),
|
|
22954
22979
|
children: [
|
|
22955
22980
|
/* @__PURE__ */ jsxRuntime.jsx(ImagePlus, { className: "h-4 w-4" }),
|
|
22956
|
-
"
|
|
22981
|
+
t("uploadKey")
|
|
22957
22982
|
]
|
|
22958
22983
|
}
|
|
22959
22984
|
),
|
|
@@ -22978,7 +23003,8 @@ const FileInputSection = ({
|
|
|
22978
23003
|
onImageSelect,
|
|
22979
23004
|
children: /* @__PURE__ */ jsxRuntime.jsxs(Button, { disabled, className: "cursor-pointer flex-1 [&>svg]:size-6", children: [
|
|
22980
23005
|
/* @__PURE__ */ jsxRuntime.jsx(GifIcon, {}),
|
|
22981
|
-
"
|
|
23006
|
+
" ",
|
|
23007
|
+
t("searchGifOrImagesKey")
|
|
22982
23008
|
] })
|
|
22983
23009
|
}
|
|
22984
23010
|
)
|
|
@@ -23805,7 +23831,7 @@ const LinkMarkView = ({ mark, editor }) => {
|
|
|
23805
23831
|
ToolbarButton,
|
|
23806
23832
|
{
|
|
23807
23833
|
size: "icon",
|
|
23808
|
-
tooltip: "
|
|
23834
|
+
tooltip: "visitLinkKey",
|
|
23809
23835
|
onClick: () => window.open(mark.attrs.href, "_blank"),
|
|
23810
23836
|
children: /* @__PURE__ */ jsxRuntime.jsx(ExternalLink, {})
|
|
23811
23837
|
}
|
|
@@ -23822,14 +23848,14 @@ const LinkMarkView = ({ mark, editor }) => {
|
|
|
23822
23848
|
},
|
|
23823
23849
|
onInsertLink: handleUpdateLink,
|
|
23824
23850
|
hideTextInput: mark?.attrs?.isLinkMode,
|
|
23825
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(ToolbarButton, { size: "icon", tooltip: "
|
|
23851
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(ToolbarButton, { size: "icon", tooltip: "editLinkKey", children: /* @__PURE__ */ jsxRuntime.jsx(SquarePen, {}) })
|
|
23826
23852
|
}
|
|
23827
23853
|
),
|
|
23828
23854
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
23829
23855
|
ToolbarButton,
|
|
23830
23856
|
{
|
|
23831
23857
|
size: "icon",
|
|
23832
|
-
tooltip: "
|
|
23858
|
+
tooltip: "unsetLinkKey",
|
|
23833
23859
|
onClick: () => {
|
|
23834
23860
|
setOpen(false);
|
|
23835
23861
|
editor.commands.unsetLink();
|
|
@@ -29700,7 +29726,7 @@ const MentionList = React.forwardRef((props, ref) => {
|
|
|
29700
29726
|
filteredItems.length,
|
|
29701
29727
|
")"
|
|
29702
29728
|
] }),
|
|
29703
|
-
/* @__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(
|
|
29704
29730
|
"li",
|
|
29705
29731
|
{
|
|
29706
29732
|
ref: (el) => {
|
|
@@ -29708,39 +29734,12 @@ const MentionList = React.forwardRef((props, ref) => {
|
|
|
29708
29734
|
},
|
|
29709
29735
|
onClick: () => selectItem(index2),
|
|
29710
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"}`,
|
|
29711
|
-
children:
|
|
29712
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
29713
|
-
|
|
29714
|
-
{
|
|
29715
|
-
src: item.avatar,
|
|
29716
|
-
alt: item.label,
|
|
29717
|
-
className: "h-9 w-9 rounded-full object-cover"
|
|
29718
|
-
}
|
|
29719
|
-
) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-white font-medium text-sm", children: item.label?.charAt(0).toUpperCase() }) }),
|
|
29720
|
-
/* @__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: [
|
|
29721
29740
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-medium text-sm text-gray-900 dark:text-gray-100 truncate", children: item.label }),
|
|
29722
29741
|
item.email && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs text-gray-500 dark:text-gray-400 truncate", children: item.email })
|
|
29723
|
-
] })
|
|
29724
|
-
] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
29725
|
-
/* @__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(
|
|
29726
|
-
"svg",
|
|
29727
|
-
{
|
|
29728
|
-
className: "h-5 w-5 text-white",
|
|
29729
|
-
fill: "none",
|
|
29730
|
-
stroke: "currentColor",
|
|
29731
|
-
viewBox: "0 0 24 24",
|
|
29732
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
29733
|
-
"path",
|
|
29734
|
-
{
|
|
29735
|
-
strokeLinecap: "round",
|
|
29736
|
-
strokeLinejoin: "round",
|
|
29737
|
-
strokeWidth: 2,
|
|
29738
|
-
d: "M7 20l4-16m2 16l4-16M6 9h14M4 15h14"
|
|
29739
|
-
}
|
|
29740
|
-
)
|
|
29741
|
-
}
|
|
29742
|
-
) }),
|
|
29743
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col min-w-0 flex-1", children: [
|
|
29742
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
29744
29743
|
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "font-medium text-sm text-gray-900 dark:text-gray-100 truncate", children: [
|
|
29745
29744
|
"#",
|
|
29746
29745
|
item.label
|
|
@@ -29749,8 +29748,8 @@ const MentionList = React.forwardRef((props, ref) => {
|
|
|
29749
29748
|
item.count.toLocaleString(),
|
|
29750
29749
|
" posts"
|
|
29751
29750
|
] })
|
|
29752
|
-
] })
|
|
29753
|
-
]
|
|
29751
|
+
] }) })
|
|
29752
|
+
]
|
|
29754
29753
|
},
|
|
29755
29754
|
item.id
|
|
29756
29755
|
)) }) }),
|
|
@@ -29800,7 +29799,7 @@ const mentionService = (api, mfs, store) => {
|
|
|
29800
29799
|
return [];
|
|
29801
29800
|
}
|
|
29802
29801
|
const response = await api.fetchGroupConversations(999, 0);
|
|
29803
|
-
return response.entries.
|
|
29802
|
+
return response.entries.map(
|
|
29804
29803
|
(item) => ({
|
|
29805
29804
|
id: item?.group_id,
|
|
29806
29805
|
label: item?.group?.name,
|
|
@@ -29913,16 +29912,6 @@ const configureMentionExtension = (api, mfs, store) => {
|
|
|
29913
29912
|
]
|
|
29914
29913
|
});
|
|
29915
29914
|
};
|
|
29916
|
-
function Skeleton({ className, ...props }) {
|
|
29917
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
29918
|
-
"div",
|
|
29919
|
-
{
|
|
29920
|
-
"data-slot": "skeleton",
|
|
29921
|
-
className: cn("bg-accent animate-pulse rounded-md", className),
|
|
29922
|
-
...props
|
|
29923
|
-
}
|
|
29924
|
-
);
|
|
29925
|
-
}
|
|
29926
29915
|
const LinkPreviewCompact = ({
|
|
29927
29916
|
selected,
|
|
29928
29917
|
href,
|
|
@@ -29932,6 +29921,7 @@ const LinkPreviewCompact = ({
|
|
|
29932
29921
|
domain,
|
|
29933
29922
|
onClickDelete
|
|
29934
29923
|
}) => {
|
|
29924
|
+
const { t } = usePostBuilder();
|
|
29935
29925
|
const safeDomain = React.useMemo(() => {
|
|
29936
29926
|
try {
|
|
29937
29927
|
return domain || new URL(href).hostname;
|
|
@@ -29953,16 +29943,16 @@ const LinkPreviewCompact = ({
|
|
|
29953
29943
|
),
|
|
29954
29944
|
children: [
|
|
29955
29945
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 absolute z-50 right-2 top-1", children: [
|
|
29956
|
-
/* @__PURE__ */ jsxRuntime.jsx(ToolbarButton, { asChild: true, tooltip: "
|
|
29946
|
+
/* @__PURE__ */ jsxRuntime.jsx(ToolbarButton, { asChild: true, tooltip: "visitLinkKey", children: /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "relative", children: [
|
|
29957
29947
|
/* @__PURE__ */ jsxRuntime.jsx("a", { href, target: "_blank", rel: "noopener noreferrer", className: "absolute inset-0" }),
|
|
29958
29948
|
/* @__PURE__ */ jsxRuntime.jsx(ExternalLink, {})
|
|
29959
29949
|
] }) }),
|
|
29960
29950
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
29961
29951
|
ToolbarButton,
|
|
29962
29952
|
{
|
|
29963
|
-
tooltip: "
|
|
29953
|
+
tooltip: "removeLinkPreviewKey",
|
|
29964
29954
|
onClick: handleDelete,
|
|
29965
|
-
"aria-label": "
|
|
29955
|
+
"aria-label": t("removeLinkPreviewKey"),
|
|
29966
29956
|
type: "button",
|
|
29967
29957
|
size: "icon",
|
|
29968
29958
|
className: "cursor-pointer size-6 shadow-none bg-transparent group-hover:bg-destructive/5 hover:bg-destructive/10 text-destructive hover:text-destructive",
|
|
@@ -29971,7 +29961,7 @@ const LinkPreviewCompact = ({
|
|
|
29971
29961
|
)
|
|
29972
29962
|
] }),
|
|
29973
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: [
|
|
29974
|
-
/* @__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(
|
|
29975
29965
|
"img",
|
|
29976
29966
|
{
|
|
29977
29967
|
src: image,
|
|
@@ -29984,7 +29974,7 @@ const LinkPreviewCompact = ({
|
|
|
29984
29974
|
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "line-clamp-1 text-xs text-muted-foreground", children: description }),
|
|
29985
29975
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-1 flex items-center gap-1 text-xs text-muted-foreground", children: [
|
|
29986
29976
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate", children: safeDomain }),
|
|
29987
|
-
/* @__PURE__ */ jsxRuntime.jsx(ExternalLink, { className: "h-3 w-3
|
|
29977
|
+
/* @__PURE__ */ jsxRuntime.jsx(ExternalLink, { className: "h-3 w-3 shrink-0 opacity-50" })
|
|
29988
29978
|
] })
|
|
29989
29979
|
] })
|
|
29990
29980
|
] }) })
|
|
@@ -30001,6 +29991,7 @@ const LinkPreviewExtended = ({
|
|
|
30001
29991
|
domain,
|
|
30002
29992
|
onClickDelete
|
|
30003
29993
|
}) => {
|
|
29994
|
+
const { t } = usePostBuilder();
|
|
30004
29995
|
const safeDomain = React.useMemo(() => {
|
|
30005
29996
|
try {
|
|
30006
29997
|
return domain || new URL(href).hostname;
|
|
@@ -30026,7 +30017,7 @@ const LinkPreviewExtended = ({
|
|
|
30026
30017
|
ToolbarButton,
|
|
30027
30018
|
{
|
|
30028
30019
|
asChild: true,
|
|
30029
|
-
tooltip: "
|
|
30020
|
+
tooltip: "visitLinkKey",
|
|
30030
30021
|
className: "cursor-pointer backdrop-blur-2xl size-6 shadow-none group-hover:bg-accent/70 group-hover:text-accent-foreground text-primary-send",
|
|
30031
30022
|
children: /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "relative", children: [
|
|
30032
30023
|
/* @__PURE__ */ jsxRuntime.jsx("a", { href, target: "_blank", rel: "noopener noreferrer", className: "absolute inset-0" }),
|
|
@@ -30037,9 +30028,9 @@ const LinkPreviewExtended = ({
|
|
|
30037
30028
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
30038
30029
|
ToolbarButton,
|
|
30039
30030
|
{
|
|
30040
|
-
tooltip: "
|
|
30031
|
+
tooltip: "removeLinkPreviewKey",
|
|
30041
30032
|
onClick: handleDelete,
|
|
30042
|
-
"aria-label": "
|
|
30033
|
+
"aria-label": t("removeLinkPreviewKey"),
|
|
30043
30034
|
type: "button",
|
|
30044
30035
|
size: "icon",
|
|
30045
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",
|
|
@@ -30069,8 +30060,19 @@ const LinkPreviewExtended = ({
|
|
|
30069
30060
|
}
|
|
30070
30061
|
);
|
|
30071
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
|
+
}
|
|
30072
30073
|
const LinkPreviewCard = ({ node, deleteNode, selected }) => {
|
|
30073
30074
|
const { loading, href, domain, variant } = node.attrs;
|
|
30075
|
+
const { t } = usePostBuilder();
|
|
30074
30076
|
const safeDomain = React.useMemo(() => {
|
|
30075
30077
|
try {
|
|
30076
30078
|
return domain || new URL(href).hostname;
|
|
@@ -30079,7 +30081,7 @@ const LinkPreviewCard = ({ node, deleteNode, selected }) => {
|
|
|
30079
30081
|
}
|
|
30080
30082
|
}, [href, domain]);
|
|
30081
30083
|
if (loading)
|
|
30082
|
-
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") }) }) });
|
|
30083
30085
|
if (!href) return null;
|
|
30084
30086
|
return /* @__PURE__ */ jsxRuntime.jsx(react.NodeViewWrapper, { contentEditable: false, "data-drag-handle": true, children: variant === LinkPreviewType.Compact ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
30085
30087
|
LinkPreviewCompact,
|
|
@@ -30559,7 +30561,7 @@ const CODE_BLOCK_HTML_ATTRIBUTES = {
|
|
|
30559
30561
|
};
|
|
30560
30562
|
const createCustomDocument = (content) => Document__default.default.extend({ content });
|
|
30561
30563
|
const PollDoc = createCustomDocument("paragraph poll");
|
|
30562
|
-
const MediaDoc = createCustomDocument("paragraph media? linkPreview? mediaGroup?");
|
|
30564
|
+
const MediaDoc = createCustomDocument("paragraph+ media? linkPreview? mediaGroup?");
|
|
30563
30565
|
createCustomDocument("paragraph linkPreview?");
|
|
30564
30566
|
const getStarterKitConfig = ({
|
|
30565
30567
|
includeLink = false,
|
|
@@ -30579,7 +30581,7 @@ const getPlaceholderExtension = (placeholder) => extensions.Placeholder.configur
|
|
|
30579
30581
|
const getMentionExtension = (core2, mfs, store) => configureMentionExtension(core2, mfs, store);
|
|
30580
30582
|
const getExtensions = ({ editorType, api, store, user }) => {
|
|
30581
30583
|
const extensionMap = {
|
|
30582
|
-
[EditorTypes.
|
|
30584
|
+
[EditorTypes.Blog]: getDefaultExtensions,
|
|
30583
30585
|
[EditorTypes.Media]: getMediaExtensions,
|
|
30584
30586
|
// [EditorTypes.Link]: getLinkExtensions,
|
|
30585
30587
|
[EditorTypes.Poll]: getPollExtensions
|
|
@@ -30741,7 +30743,7 @@ const usePostBuilderEditor = ({ editorType, groupId, postId, user }) => {
|
|
|
30741
30743
|
editorProps: getEditorProps(),
|
|
30742
30744
|
onCreate: ({ editor: editor2 }) => {
|
|
30743
30745
|
store.getState().setEditor(editor2);
|
|
30744
|
-
if (editorType === EditorTypes.
|
|
30746
|
+
if (editorType === EditorTypes.Blog) editor2?.chain()?.focus()?.run();
|
|
30745
30747
|
if (editorType === EditorTypes.Media) editor2?.chain()?.focus()?.run();
|
|
30746
30748
|
if (editorType === EditorTypes.Poll) initializePollEditor(editor2);
|
|
30747
30749
|
},
|
|
@@ -30890,7 +30892,7 @@ const generatePollPostPayload = ({
|
|
|
30890
30892
|
};
|
|
30891
30893
|
const generateCreatePostPayload = (editorTab, params) => {
|
|
30892
30894
|
switch (editorTab) {
|
|
30893
|
-
case EditorTypes.
|
|
30895
|
+
case EditorTypes.Blog:
|
|
30894
30896
|
return generateHtmlPostPayload(params);
|
|
30895
30897
|
case EditorTypes.Media:
|
|
30896
30898
|
return generateMediaPostPayload(params);
|
|
@@ -30991,7 +30993,7 @@ const PostBuilderEditorInstance = ({
|
|
|
30991
30993
|
editor,
|
|
30992
30994
|
className: cn(
|
|
30993
30995
|
"pr-2",
|
|
30994
|
-
editorTab !== EditorTypes.
|
|
30996
|
+
editorTab !== EditorTypes.Blog && "hidden size-0 overflow-hidden pointer-events-none"
|
|
30995
30997
|
),
|
|
30996
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" }) })
|
|
30997
30999
|
}
|
|
@@ -31722,18 +31724,152 @@ const PostBuilderEditor = ({
|
|
|
31722
31724
|
}
|
|
31723
31725
|
);
|
|
31724
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
|
+
};
|
|
31725
31857
|
const PostBuilderProvider = ({
|
|
31726
31858
|
children,
|
|
31727
31859
|
apiBaseURL,
|
|
31728
31860
|
authToken,
|
|
31729
31861
|
toI18N,
|
|
31730
|
-
i18nKeys,
|
|
31862
|
+
i18nKeys = defaultTranslationKeyMappings,
|
|
31731
31863
|
logEvent
|
|
31732
31864
|
}) => {
|
|
31733
31865
|
const t = React.useCallback(
|
|
31734
31866
|
(key, fallback) => {
|
|
31735
|
-
const
|
|
31736
|
-
|
|
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;
|
|
31737
31873
|
return fallback || key;
|
|
31738
31874
|
},
|
|
31739
31875
|
[toI18N, i18nKeys]
|