@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.js
CHANGED
|
@@ -2524,7 +2524,7 @@ var ImageSearchFrom = /* @__PURE__ */ ((ImageSearchFrom2) => {
|
|
|
2524
2524
|
})(ImageSearchFrom || {});
|
|
2525
2525
|
var EditorTypes = /* @__PURE__ */ ((EditorTypes2) => {
|
|
2526
2526
|
EditorTypes2["Media"] = "Media";
|
|
2527
|
-
EditorTypes2["
|
|
2527
|
+
EditorTypes2["Blog"] = "Blog";
|
|
2528
2528
|
EditorTypes2["Poll"] = "Poll";
|
|
2529
2529
|
return EditorTypes2;
|
|
2530
2530
|
})(EditorTypes || {});
|
|
@@ -8528,12 +8528,25 @@ const usePostBuilderAnalytics = () => {
|
|
|
8528
8528
|
};
|
|
8529
8529
|
const editorTypes = enumToOptions(EditorTypes);
|
|
8530
8530
|
const EditorTypeTabs = ({ editorTab, onSwitchEditorTab }) => {
|
|
8531
|
+
const { t } = usePostBuilder();
|
|
8531
8532
|
const { trackTabSwitch } = usePostBuilderAnalytics();
|
|
8532
8533
|
const handleSwitchTab = (newTab) => {
|
|
8533
8534
|
const oldTab = editorTab;
|
|
8534
8535
|
trackTabSwitch({ oldTab, newTab });
|
|
8535
8536
|
onSwitchEditorTab(newTab);
|
|
8536
8537
|
};
|
|
8538
|
+
const translationKeyMapping = (tab) => {
|
|
8539
|
+
switch (tab) {
|
|
8540
|
+
case EditorTypes.Media:
|
|
8541
|
+
return "postTabKey";
|
|
8542
|
+
case EditorTypes.Blog:
|
|
8543
|
+
return "blogTabKey";
|
|
8544
|
+
case EditorTypes.Poll:
|
|
8545
|
+
return "pollTabKey";
|
|
8546
|
+
default:
|
|
8547
|
+
return "postTabKey";
|
|
8548
|
+
}
|
|
8549
|
+
};
|
|
8537
8550
|
return /* @__PURE__ */ jsx(
|
|
8538
8551
|
Tabs,
|
|
8539
8552
|
{
|
|
@@ -8541,7 +8554,7 @@ const EditorTypeTabs = ({ editorTab, onSwitchEditorTab }) => {
|
|
|
8541
8554
|
value: editorTab,
|
|
8542
8555
|
onValueChange: handleSwitchTab,
|
|
8543
8556
|
className: "w-full",
|
|
8544
|
-
children: /* @__PURE__ */ jsx(TabsList, { className: "w-full rounded-none border-b", children: editorTypes.map((data) => /* @__PURE__ */ jsx(TabsTrigger, { value: data.value.toString(), children: data.
|
|
8557
|
+
children: /* @__PURE__ */ jsx(TabsList, { className: "w-full rounded-none border-b", children: editorTypes.map((data) => /* @__PURE__ */ jsx(TabsTrigger, { value: data.value.toString(), children: t(translationKeyMapping(data.key), data.value) }, data.value)) })
|
|
8545
8558
|
}
|
|
8546
8559
|
);
|
|
8547
8560
|
};
|
|
@@ -14820,6 +14833,7 @@ const ToolbarButton = forwardRef(
|
|
|
14820
14833
|
({ id, icon: Icon2, tooltip, active, children, className, onClick, ...buttonProps }, ref) => {
|
|
14821
14834
|
const { editor } = useCurrentEditor();
|
|
14822
14835
|
const { trackFeature } = usePostBuilderAnalytics();
|
|
14836
|
+
const { t } = usePostBuilder();
|
|
14823
14837
|
const handleClick = (e) => {
|
|
14824
14838
|
onClick?.(e);
|
|
14825
14839
|
if (id) trackFeature({ featureName: id });
|
|
@@ -14845,7 +14859,7 @@ const ToolbarButton = forwardRef(
|
|
|
14845
14859
|
children: children ?? (Icon2 && /* @__PURE__ */ jsx(Icon2, { className: "size-full" }))
|
|
14846
14860
|
}
|
|
14847
14861
|
) }),
|
|
14848
|
-
/* @__PURE__ */ jsx(TooltipContent, { children: tooltip })
|
|
14862
|
+
/* @__PURE__ */ jsx(TooltipContent, { children: t(tooltip, tooltip) ?? tooltip })
|
|
14849
14863
|
] }) });
|
|
14850
14864
|
}
|
|
14851
14865
|
);
|
|
@@ -16252,6 +16266,7 @@ const LinkDecoratorModal = ({
|
|
|
16252
16266
|
}) => {
|
|
16253
16267
|
const { editor } = useCurrentEditor();
|
|
16254
16268
|
const { core } = useApi();
|
|
16269
|
+
const { t } = usePostBuilder();
|
|
16255
16270
|
const [uid, setUid] = useState(defaultValues?.uid ?? null);
|
|
16256
16271
|
const [link, setLink] = useState(defaultValues?.link ?? "");
|
|
16257
16272
|
const [text2, setText] = useState(defaultValues?.text || "");
|
|
@@ -16312,11 +16327,12 @@ const LinkDecoratorModal = ({
|
|
|
16312
16327
|
return /* @__PURE__ */ jsxs(Dialog, { open, onOpenChange: handleOpenChange, children: [
|
|
16313
16328
|
children ? /* @__PURE__ */ jsx(DialogTrigger, { asChild: true, children }) : null,
|
|
16314
16329
|
/* @__PURE__ */ jsxs(DialogContent, { className: "-translate-1/2", children: [
|
|
16315
|
-
/* @__PURE__ */ jsx(DialogHeader, { children: /* @__PURE__ */ jsx(DialogTitle, { children: "
|
|
16330
|
+
/* @__PURE__ */ jsx(DialogHeader, { children: /* @__PURE__ */ jsx(DialogTitle, { children: isUpdate ? t("updateLinkKey") : t("insertLinkKey") }) }),
|
|
16316
16331
|
/* @__PURE__ */ jsx(FieldSet, { children: /* @__PURE__ */ jsxs(FieldGroup, { className: "gap-3", children: [
|
|
16317
16332
|
/* @__PURE__ */ jsxs(Field, { className: "gap-1.5", children: [
|
|
16318
16333
|
/* @__PURE__ */ jsxs(FieldLabel, { children: [
|
|
16319
|
-
"
|
|
16334
|
+
t("linkInputLabelKey"),
|
|
16335
|
+
" ",
|
|
16320
16336
|
/* @__PURE__ */ jsx("span", { className: "text-destructive", children: "*" })
|
|
16321
16337
|
] }),
|
|
16322
16338
|
/* @__PURE__ */ jsxs(InputGroup, { children: [
|
|
@@ -16332,10 +16348,10 @@ const LinkDecoratorModal = ({
|
|
|
16332
16348
|
),
|
|
16333
16349
|
/* @__PURE__ */ jsx(InputGroupAddon, { children: /* @__PURE__ */ jsx(Link, {}) })
|
|
16334
16350
|
] }),
|
|
16335
|
-
!isValid && isValid !== void 0 && /* @__PURE__ */ jsx(FieldError, { errors: [{ message: "
|
|
16351
|
+
!isValid && isValid !== void 0 && /* @__PURE__ */ jsx(FieldError, { errors: [{ message: t("invalidLinkKey") }] })
|
|
16336
16352
|
] }),
|
|
16337
16353
|
!hideTextInput && /* @__PURE__ */ jsxs(Field, { className: "gap-1.5", children: [
|
|
16338
|
-
/* @__PURE__ */ jsx(FieldLabel, { children: "
|
|
16354
|
+
/* @__PURE__ */ jsx(FieldLabel, { children: t("linkTextInputLabelKey") }),
|
|
16339
16355
|
/* @__PURE__ */ jsxs(InputGroup, { children: [
|
|
16340
16356
|
/* @__PURE__ */ jsx(
|
|
16341
16357
|
InputGroupInput,
|
|
@@ -16344,7 +16360,7 @@ const LinkDecoratorModal = ({
|
|
|
16344
16360
|
value: text2,
|
|
16345
16361
|
onChange: handleChangeText,
|
|
16346
16362
|
onKeyDown: handleKeyDown,
|
|
16347
|
-
placeholder: "
|
|
16363
|
+
placeholder: t("linkTextInputLabelKey")
|
|
16348
16364
|
}
|
|
16349
16365
|
),
|
|
16350
16366
|
/* @__PURE__ */ jsx(InputGroupAddon, { children: /* @__PURE__ */ jsx(TextAlignStart, {}) })
|
|
@@ -16352,7 +16368,7 @@ const LinkDecoratorModal = ({
|
|
|
16352
16368
|
] })
|
|
16353
16369
|
] }) }),
|
|
16354
16370
|
/* @__PURE__ */ jsxs(DialogFooter, { children: [
|
|
16355
|
-
/* @__PURE__ */ jsx(Button, { variant: "secondary", onClick: () => onOpenChange?.(false), children: "
|
|
16371
|
+
/* @__PURE__ */ jsx(Button, { variant: "secondary", onClick: () => onOpenChange?.(false), children: t("cancelKey") }),
|
|
16356
16372
|
/* @__PURE__ */ jsxs(
|
|
16357
16373
|
Button,
|
|
16358
16374
|
{
|
|
@@ -16360,7 +16376,7 @@ const LinkDecoratorModal = ({
|
|
|
16360
16376
|
onClick: () => handleInsertLink(link, text2, uid ?? void 0),
|
|
16361
16377
|
children: [
|
|
16362
16378
|
isLoading && /* @__PURE__ */ jsx(Spinner, {}),
|
|
16363
|
-
isUpdate ? "
|
|
16379
|
+
isUpdate ? t("updateKey") : t("insertKey")
|
|
16364
16380
|
]
|
|
16365
16381
|
}
|
|
16366
16382
|
)
|
|
@@ -18336,6 +18352,7 @@ function ImageSearchModal({
|
|
|
18336
18352
|
onImageSelect,
|
|
18337
18353
|
children
|
|
18338
18354
|
}) {
|
|
18355
|
+
const { t } = usePostBuilder();
|
|
18339
18356
|
const [activeTab, setActiveTab] = useState("gifs");
|
|
18340
18357
|
const [searchQuery, setSearchQuery] = useState("");
|
|
18341
18358
|
const imageSearch = useMediaSearch("images");
|
|
@@ -18403,7 +18420,7 @@ function ImageSearchModal({
|
|
|
18403
18420
|
return /* @__PURE__ */ jsxs(Dialog, { open, onOpenChange: handleOpenChange, children: [
|
|
18404
18421
|
/* @__PURE__ */ jsx(DialogTrigger, { asChild: true, children: children ?? /* @__PURE__ */ jsx(Button, { children: "Open Search Modal" }) }),
|
|
18405
18422
|
/* @__PURE__ */ jsxs(DialogContent, { className: "max-w-4xl w-full h-[80vh] flex flex-col overflow-hidden px-0 py-0 -translate-1/2", children: [
|
|
18406
|
-
/* @__PURE__ */ jsx(DialogHeader, { className: "p-4 border-b bg-accent", children: /* @__PURE__ */ jsx(DialogTitle, { children: "
|
|
18423
|
+
/* @__PURE__ */ jsx(DialogHeader, { className: "p-4 border-b bg-accent", children: /* @__PURE__ */ jsx(DialogTitle, { children: t("mediaSearchTitleKey") }) }),
|
|
18407
18424
|
/* @__PURE__ */ jsxs(
|
|
18408
18425
|
Tabs,
|
|
18409
18426
|
{
|
|
@@ -18413,15 +18430,15 @@ function ImageSearchModal({
|
|
|
18413
18430
|
className: "flex-1 grow flex flex-col overflow-y-auto",
|
|
18414
18431
|
children: [
|
|
18415
18432
|
/* @__PURE__ */ jsx("div", { className: "px-4", children: /* @__PURE__ */ jsxs(TabsList, { className: "grid w-full grid-cols-2", children: [
|
|
18416
|
-
/* @__PURE__ */ jsx(TabsTrigger, { value: "gifs", children: "
|
|
18417
|
-
/* @__PURE__ */ jsx(TabsTrigger, { value: "images", children: "
|
|
18433
|
+
/* @__PURE__ */ jsx(TabsTrigger, { value: "gifs", children: t("gifSearchKey") }),
|
|
18434
|
+
/* @__PURE__ */ jsx(TabsTrigger, { value: "images", children: t("imageSearchKey") })
|
|
18418
18435
|
] }) }),
|
|
18419
18436
|
/* @__PURE__ */ jsx(
|
|
18420
18437
|
SearchBar,
|
|
18421
18438
|
{
|
|
18422
18439
|
value: searchQuery,
|
|
18423
18440
|
onChange: handleSearch,
|
|
18424
|
-
placeholder:
|
|
18441
|
+
placeholder: activeTab === "gifs" ? t("searchGifPlaceholder") : t("searchIMagePlaceholder")
|
|
18425
18442
|
}
|
|
18426
18443
|
),
|
|
18427
18444
|
/* @__PURE__ */ jsx(TabsContent, { value: "images", className: "flex-1 grow mt-4 overflow-y-auto", children: /* @__PURE__ */ jsx(
|
|
@@ -18452,7 +18469,7 @@ function ImageSearchModal({
|
|
|
18452
18469
|
}
|
|
18453
18470
|
function SearchBar({ value, onChange, placeholder }) {
|
|
18454
18471
|
return /* @__PURE__ */ jsx("div", { className: "mt-2 px-4", children: /* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
18455
|
-
/* @__PURE__ */ jsx(Search, { className: "absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground" }),
|
|
18472
|
+
/* @__PURE__ */ jsx(Search, { className: "absolute left-3 top-1/2 -translate-y-1/2 transform-none h-4 w-4 text-muted-foreground" }),
|
|
18456
18473
|
/* @__PURE__ */ jsx(
|
|
18457
18474
|
Input,
|
|
18458
18475
|
{
|
|
@@ -20225,7 +20242,7 @@ function isOnlyContentNode(node, targetType, options = {}) {
|
|
|
20225
20242
|
return foundTargetType && !foundOtherContentNode;
|
|
20226
20243
|
}
|
|
20227
20244
|
const TOOLBAR_FEATURES = {
|
|
20228
|
-
[EditorTypes.
|
|
20245
|
+
[EditorTypes.Blog]: {
|
|
20229
20246
|
showFormatting: true,
|
|
20230
20247
|
showImage: true,
|
|
20231
20248
|
showVideo: true,
|
|
@@ -20262,6 +20279,7 @@ const Toolbar = ({
|
|
|
20262
20279
|
const editorState = useEditorStateSnapshot(editor);
|
|
20263
20280
|
const { showCrossMentionIndicator } = useEditorWithMentionTracking(editor, { debounceMs: 150 });
|
|
20264
20281
|
const { trackFeature } = usePostBuilderAnalytics();
|
|
20282
|
+
const { t } = usePostBuilder();
|
|
20265
20283
|
if (!editor) return null;
|
|
20266
20284
|
const features = TOOLBAR_FEATURES[editorType];
|
|
20267
20285
|
const handleClickLink = (e) => {
|
|
@@ -20271,7 +20289,7 @@ const Toolbar = ({
|
|
|
20271
20289
|
}
|
|
20272
20290
|
};
|
|
20273
20291
|
const handleInsertLink = (link, text2, uid, previewPayload) => {
|
|
20274
|
-
const linkText = editorType === EditorTypes.
|
|
20292
|
+
const linkText = editorType === EditorTypes.Blog ? text2 || link : link;
|
|
20275
20293
|
if (uid) {
|
|
20276
20294
|
editor.commands.updateLink(uid, { href: link, text: linkText, previewPayload });
|
|
20277
20295
|
return;
|
|
@@ -20352,7 +20370,7 @@ const Toolbar = ({
|
|
|
20352
20370
|
{
|
|
20353
20371
|
id: FEATURE_NAME_MAP.undo,
|
|
20354
20372
|
icon: Undo,
|
|
20355
|
-
tooltip: "
|
|
20373
|
+
tooltip: "undoKey",
|
|
20356
20374
|
onClick: actions?.undo,
|
|
20357
20375
|
disabled: !editorState?.canUndo
|
|
20358
20376
|
}
|
|
@@ -20362,7 +20380,7 @@ const Toolbar = ({
|
|
|
20362
20380
|
{
|
|
20363
20381
|
id: FEATURE_NAME_MAP.redo,
|
|
20364
20382
|
icon: Redo,
|
|
20365
|
-
tooltip: "
|
|
20383
|
+
tooltip: "redoKey",
|
|
20366
20384
|
onClick: actions?.redo,
|
|
20367
20385
|
disabled: !editorState?.canRedo
|
|
20368
20386
|
}
|
|
@@ -20371,7 +20389,7 @@ const Toolbar = ({
|
|
|
20371
20389
|
/* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
20372
20390
|
ToolbarButton,
|
|
20373
20391
|
{
|
|
20374
|
-
tooltip: "
|
|
20392
|
+
tooltip: "headingOptionsKey",
|
|
20375
20393
|
icon: getHeadingIcon(editorState),
|
|
20376
20394
|
"aria-label": "More formatting options"
|
|
20377
20395
|
}
|
|
@@ -20382,13 +20400,14 @@ const Toolbar = ({
|
|
|
20382
20400
|
{
|
|
20383
20401
|
id: FEATURE_NAME_MAP.paragraph,
|
|
20384
20402
|
className: "w-full justify-start",
|
|
20385
|
-
tooltip: "
|
|
20403
|
+
tooltip: "paragraphKey",
|
|
20386
20404
|
onClick: actions?.setParagraph,
|
|
20387
20405
|
active: editorState?.isParagraph,
|
|
20388
20406
|
disabled: !editorState?.canParagraph,
|
|
20389
20407
|
children: [
|
|
20390
20408
|
/* @__PURE__ */ jsx(Type, {}),
|
|
20391
|
-
"
|
|
20409
|
+
" ",
|
|
20410
|
+
t("paragraphKey")
|
|
20392
20411
|
]
|
|
20393
20412
|
}
|
|
20394
20413
|
) }),
|
|
@@ -20397,13 +20416,14 @@ const Toolbar = ({
|
|
|
20397
20416
|
{
|
|
20398
20417
|
id: HEADING_FEATURE_MAP[1],
|
|
20399
20418
|
className: "w-full justify-start",
|
|
20400
|
-
tooltip: "
|
|
20419
|
+
tooltip: "heading1Key",
|
|
20401
20420
|
onClick: () => actions?.toggleHeading(1),
|
|
20402
20421
|
active: editorState?.isHeading1,
|
|
20403
20422
|
disabled: !editorState?.canHeading1,
|
|
20404
20423
|
children: [
|
|
20405
20424
|
/* @__PURE__ */ jsx(Heading1, {}),
|
|
20406
|
-
"
|
|
20425
|
+
" ",
|
|
20426
|
+
t("heading1Key")
|
|
20407
20427
|
]
|
|
20408
20428
|
}
|
|
20409
20429
|
) }),
|
|
@@ -20412,13 +20432,14 @@ const Toolbar = ({
|
|
|
20412
20432
|
{
|
|
20413
20433
|
id: HEADING_FEATURE_MAP[2],
|
|
20414
20434
|
className: "w-full justify-start",
|
|
20415
|
-
tooltip: "
|
|
20435
|
+
tooltip: "heading2Key",
|
|
20416
20436
|
onClick: () => actions?.toggleHeading(2),
|
|
20417
20437
|
active: editorState?.isHeading2,
|
|
20418
20438
|
disabled: !editorState?.canHeading2,
|
|
20419
20439
|
children: [
|
|
20420
20440
|
/* @__PURE__ */ jsx(Heading2, {}),
|
|
20421
|
-
"
|
|
20441
|
+
" ",
|
|
20442
|
+
t("heading2Key")
|
|
20422
20443
|
]
|
|
20423
20444
|
}
|
|
20424
20445
|
) }),
|
|
@@ -20427,13 +20448,14 @@ const Toolbar = ({
|
|
|
20427
20448
|
{
|
|
20428
20449
|
id: HEADING_FEATURE_MAP[3],
|
|
20429
20450
|
className: "w-full justify-start",
|
|
20430
|
-
tooltip: "
|
|
20451
|
+
tooltip: "heading3Key",
|
|
20431
20452
|
onClick: () => actions?.toggleHeading(3),
|
|
20432
20453
|
active: editorState?.isHeading3,
|
|
20433
20454
|
disabled: !editorState?.canHeading3,
|
|
20434
20455
|
children: [
|
|
20435
20456
|
/* @__PURE__ */ jsx(Heading3, {}),
|
|
20436
|
-
"
|
|
20457
|
+
" ",
|
|
20458
|
+
t("heading3Key")
|
|
20437
20459
|
]
|
|
20438
20460
|
}
|
|
20439
20461
|
) })
|
|
@@ -20445,7 +20467,7 @@ const Toolbar = ({
|
|
|
20445
20467
|
{
|
|
20446
20468
|
id: FEATURE_NAME_MAP.bold,
|
|
20447
20469
|
icon: Bold,
|
|
20448
|
-
tooltip: "
|
|
20470
|
+
tooltip: "boldKey",
|
|
20449
20471
|
onClick: actions?.toggleBold,
|
|
20450
20472
|
active: editorState?.isBold,
|
|
20451
20473
|
disabled: !editorState?.canBold
|
|
@@ -20457,7 +20479,7 @@ const Toolbar = ({
|
|
|
20457
20479
|
{
|
|
20458
20480
|
id: FEATURE_NAME_MAP.italic,
|
|
20459
20481
|
icon: Italic,
|
|
20460
|
-
tooltip: "
|
|
20482
|
+
tooltip: "italicKey",
|
|
20461
20483
|
onClick: actions?.toggleItalic,
|
|
20462
20484
|
active: editorState?.isItalic,
|
|
20463
20485
|
disabled: !editorState?.canItalic
|
|
@@ -20468,7 +20490,7 @@ const Toolbar = ({
|
|
|
20468
20490
|
{
|
|
20469
20491
|
id: FEATURE_NAME_MAP.strike,
|
|
20470
20492
|
icon: Strikethrough,
|
|
20471
|
-
tooltip: "
|
|
20493
|
+
tooltip: "strikethroughKey",
|
|
20472
20494
|
onClick: actions?.toggleStrikethrough,
|
|
20473
20495
|
active: editorState?.isStrike,
|
|
20474
20496
|
disabled: !editorState?.canStrike
|
|
@@ -20481,7 +20503,7 @@ const Toolbar = ({
|
|
|
20481
20503
|
{
|
|
20482
20504
|
id: FEATURE_NAME_MAP.bulletList,
|
|
20483
20505
|
icon: List,
|
|
20484
|
-
tooltip: "
|
|
20506
|
+
tooltip: "bulletListKey",
|
|
20485
20507
|
onClick: actions?.toggleBulletList,
|
|
20486
20508
|
active: editorState?.isBulletList,
|
|
20487
20509
|
disabled: !editorState?.canBulletList
|
|
@@ -20492,7 +20514,7 @@ const Toolbar = ({
|
|
|
20492
20514
|
{
|
|
20493
20515
|
id: FEATURE_NAME_MAP.orderedList,
|
|
20494
20516
|
icon: ListOrdered,
|
|
20495
|
-
tooltip: "
|
|
20517
|
+
tooltip: "orderedListKey",
|
|
20496
20518
|
onClick: actions?.toggleOrderedList,
|
|
20497
20519
|
active: editorState?.isOrderedList,
|
|
20498
20520
|
disabled: !editorState?.canOrderedList
|
|
@@ -20505,7 +20527,7 @@ const Toolbar = ({
|
|
|
20505
20527
|
{
|
|
20506
20528
|
id: FEATURE_NAME_MAP.blockquote,
|
|
20507
20529
|
icon: TextQuote,
|
|
20508
|
-
tooltip: "
|
|
20530
|
+
tooltip: "blockquoteKey",
|
|
20509
20531
|
onClick: actions?.toggleBlockquote,
|
|
20510
20532
|
active: editorState?.isBlockquote,
|
|
20511
20533
|
disabled: !editorState?.canBlockquote
|
|
@@ -20516,7 +20538,7 @@ const Toolbar = ({
|
|
|
20516
20538
|
{
|
|
20517
20539
|
id: FEATURE_NAME_MAP.code,
|
|
20518
20540
|
icon: Code,
|
|
20519
|
-
tooltip: "
|
|
20541
|
+
tooltip: "codeKey",
|
|
20520
20542
|
onClick: actions?.toggleCode,
|
|
20521
20543
|
active: editorState?.isCode,
|
|
20522
20544
|
disabled: !editorState?.canCode
|
|
@@ -20527,7 +20549,7 @@ const Toolbar = ({
|
|
|
20527
20549
|
{
|
|
20528
20550
|
id: FEATURE_NAME_MAP.codeBlock,
|
|
20529
20551
|
icon: FileCode2,
|
|
20530
|
-
tooltip: "
|
|
20552
|
+
tooltip: "codeBlockKey",
|
|
20531
20553
|
onClick: actions?.toggleCodeBlock,
|
|
20532
20554
|
active: editorState?.isCodeBlock,
|
|
20533
20555
|
disabled: !editorState?.canCodeBlock
|
|
@@ -20538,7 +20560,7 @@ const Toolbar = ({
|
|
|
20538
20560
|
/* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
20539
20561
|
ToolbarButton,
|
|
20540
20562
|
{
|
|
20541
|
-
tooltip: "
|
|
20563
|
+
tooltip: "moreOptionsKey",
|
|
20542
20564
|
icon: Ellipsis,
|
|
20543
20565
|
"aria-label": "More formatting options"
|
|
20544
20566
|
}
|
|
@@ -20549,7 +20571,7 @@ const Toolbar = ({
|
|
|
20549
20571
|
{
|
|
20550
20572
|
id: FEATURE_NAME_MAP.italic,
|
|
20551
20573
|
icon: Italic,
|
|
20552
|
-
tooltip: "
|
|
20574
|
+
tooltip: "italicKey",
|
|
20553
20575
|
onClick: actions?.toggleItalic,
|
|
20554
20576
|
active: editorState?.isItalic,
|
|
20555
20577
|
disabled: !editorState?.canItalic
|
|
@@ -20560,7 +20582,7 @@ const Toolbar = ({
|
|
|
20560
20582
|
{
|
|
20561
20583
|
id: FEATURE_NAME_MAP.strike,
|
|
20562
20584
|
icon: Strikethrough,
|
|
20563
|
-
tooltip: "
|
|
20585
|
+
tooltip: "strikethroughKey",
|
|
20564
20586
|
onClick: actions?.toggleStrikethrough,
|
|
20565
20587
|
active: editorState?.isStrike,
|
|
20566
20588
|
disabled: !editorState?.canStrike
|
|
@@ -20571,7 +20593,7 @@ const Toolbar = ({
|
|
|
20571
20593
|
{
|
|
20572
20594
|
id: FEATURE_NAME_MAP.blockquote,
|
|
20573
20595
|
icon: TextQuote,
|
|
20574
|
-
tooltip: "
|
|
20596
|
+
tooltip: "blockquoteKey",
|
|
20575
20597
|
onClick: actions?.toggleBlockquote,
|
|
20576
20598
|
active: editorState?.isBlockquote,
|
|
20577
20599
|
disabled: !editorState?.canBlockquote
|
|
@@ -20582,7 +20604,7 @@ const Toolbar = ({
|
|
|
20582
20604
|
{
|
|
20583
20605
|
id: FEATURE_NAME_MAP.code,
|
|
20584
20606
|
icon: Code,
|
|
20585
|
-
tooltip: "
|
|
20607
|
+
tooltip: "codeKey",
|
|
20586
20608
|
onClick: actions?.toggleCode,
|
|
20587
20609
|
active: editorState?.isCode,
|
|
20588
20610
|
disabled: !editorState?.canCode
|
|
@@ -20593,7 +20615,7 @@ const Toolbar = ({
|
|
|
20593
20615
|
{
|
|
20594
20616
|
id: FEATURE_NAME_MAP.codeBlock,
|
|
20595
20617
|
icon: FileCode2,
|
|
20596
|
-
tooltip: "
|
|
20618
|
+
tooltip: "codeBlockKey",
|
|
20597
20619
|
onClick: actions?.toggleCodeBlock,
|
|
20598
20620
|
active: editorState?.isCodeBlock,
|
|
20599
20621
|
disabled: !editorState?.canCodeBlock
|
|
@@ -20635,7 +20657,7 @@ const Toolbar = ({
|
|
|
20635
20657
|
{
|
|
20636
20658
|
id: FEATURE_NAME_MAP.image,
|
|
20637
20659
|
icon: ImagePlus,
|
|
20638
|
-
tooltip: "
|
|
20660
|
+
tooltip: "insertImageKey",
|
|
20639
20661
|
disabled: !editorState?.canInsertImage,
|
|
20640
20662
|
onMouseOver: () => setMediaType(MediaNodeTypes.Image),
|
|
20641
20663
|
onClick: handleOpenLocalMediaPicker
|
|
@@ -20647,7 +20669,7 @@ const Toolbar = ({
|
|
|
20647
20669
|
id: FEATURE_NAME_MAP.video,
|
|
20648
20670
|
icon: Video,
|
|
20649
20671
|
disabled: !editorState?.canInsertVideo,
|
|
20650
|
-
tooltip: "
|
|
20672
|
+
tooltip: "insertVideoKey",
|
|
20651
20673
|
onMouseOver: () => setMediaType(MediaNodeTypes.Video),
|
|
20652
20674
|
onClick: handleOpenLocalMediaPicker
|
|
20653
20675
|
}
|
|
@@ -20658,7 +20680,7 @@ const Toolbar = ({
|
|
|
20658
20680
|
id: FEATURE_NAME_MAP.audio,
|
|
20659
20681
|
icon: Music,
|
|
20660
20682
|
disabled: !editorState?.canInsertAudio,
|
|
20661
|
-
tooltip: "
|
|
20683
|
+
tooltip: "insertAudioKey",
|
|
20662
20684
|
onMouseOver: () => setMediaType(MediaNodeTypes.Audio),
|
|
20663
20685
|
onClick: handleOpenLocalMediaPicker
|
|
20664
20686
|
}
|
|
@@ -20676,7 +20698,7 @@ const Toolbar = ({
|
|
|
20676
20698
|
onClick: handleOpenGifPicker,
|
|
20677
20699
|
disabled: !editorState?.canInsertImage,
|
|
20678
20700
|
icon: GifIcon,
|
|
20679
|
-
tooltip: "
|
|
20701
|
+
tooltip: "searchGifOrImagesKey",
|
|
20680
20702
|
className: "p-1 [&>svg]:size-5!"
|
|
20681
20703
|
}
|
|
20682
20704
|
)
|
|
@@ -20696,7 +20718,7 @@ const Toolbar = ({
|
|
|
20696
20718
|
{
|
|
20697
20719
|
id: FEATURE_NAME_MAP.customLink,
|
|
20698
20720
|
icon: Link,
|
|
20699
|
-
tooltip: "
|
|
20721
|
+
tooltip: "addLinkPreviewKey",
|
|
20700
20722
|
onClick: handleClickLink,
|
|
20701
20723
|
active: editorState?.isLink,
|
|
20702
20724
|
disabled: !editorState?.canLink
|
|
@@ -20717,7 +20739,8 @@ const Toolbar = ({
|
|
|
20717
20739
|
}
|
|
20718
20740
|
),
|
|
20719
20741
|
/* @__PURE__ */ jsxs(Label$1, { htmlFor: "send-cross-mention", children: [
|
|
20720
|
-
"
|
|
20742
|
+
t("crossPostKey"),
|
|
20743
|
+
" ",
|
|
20721
20744
|
/* @__PURE__ */ jsx(Forward, {})
|
|
20722
20745
|
] })
|
|
20723
20746
|
] })
|
|
@@ -20731,7 +20754,8 @@ const Toolbar = ({
|
|
|
20731
20754
|
"cursor-pointer bg-primary-send hover:bg-primary-send/85 active:scale-95 w-fit ml-auto"
|
|
20732
20755
|
),
|
|
20733
20756
|
children: [
|
|
20734
|
-
"
|
|
20757
|
+
t("postKey"),
|
|
20758
|
+
" ",
|
|
20735
20759
|
isSubmitting ? /* @__PURE__ */ jsx(Spinner, {}) : /* @__PURE__ */ jsx(SendHorizontal, {})
|
|
20736
20760
|
]
|
|
20737
20761
|
}
|
|
@@ -20980,7 +21004,7 @@ const EditMediaToolbar = ({
|
|
|
20980
21004
|
{
|
|
20981
21005
|
active: align === Alignment.LEFT,
|
|
20982
21006
|
icon: TextAlignStart,
|
|
20983
|
-
tooltip: "
|
|
21007
|
+
tooltip: "alignLeftKey",
|
|
20984
21008
|
onClick: () => onAlign(Alignment.LEFT)
|
|
20985
21009
|
}
|
|
20986
21010
|
),
|
|
@@ -20989,7 +21013,7 @@ const EditMediaToolbar = ({
|
|
|
20989
21013
|
{
|
|
20990
21014
|
active: align === Alignment.CENTER,
|
|
20991
21015
|
icon: TextAlignCenter,
|
|
20992
|
-
tooltip: "
|
|
21016
|
+
tooltip: "alignCenterKey",
|
|
20993
21017
|
onClick: () => onAlign(Alignment.CENTER)
|
|
20994
21018
|
}
|
|
20995
21019
|
),
|
|
@@ -20998,7 +21022,7 @@ const EditMediaToolbar = ({
|
|
|
20998
21022
|
{
|
|
20999
21023
|
active: align === Alignment.RIGHT,
|
|
21000
21024
|
icon: TextAlignEnd,
|
|
21001
|
-
tooltip: "
|
|
21025
|
+
tooltip: "alignRightKey",
|
|
21002
21026
|
onClick: () => onAlign(Alignment.RIGHT)
|
|
21003
21027
|
}
|
|
21004
21028
|
)
|
|
@@ -21009,7 +21033,7 @@ const EditMediaToolbar = ({
|
|
|
21009
21033
|
variant: "destructive",
|
|
21010
21034
|
className: "bg-transparent hover:bg-accent text-red-300 hover:text-destructive",
|
|
21011
21035
|
icon: Trash2,
|
|
21012
|
-
tooltip: "
|
|
21036
|
+
tooltip: "deleteKey",
|
|
21013
21037
|
onClick: onDelete
|
|
21014
21038
|
}
|
|
21015
21039
|
)
|
|
@@ -22842,6 +22866,7 @@ const TextInputSection = ({
|
|
|
22842
22866
|
onSubmit,
|
|
22843
22867
|
disabled
|
|
22844
22868
|
}) => {
|
|
22869
|
+
const { t } = usePostBuilder();
|
|
22845
22870
|
const handleKeyDown = (e) => {
|
|
22846
22871
|
if (e.key === "Enter") {
|
|
22847
22872
|
e.preventDefault();
|
|
@@ -22850,13 +22875,13 @@ const TextInputSection = ({
|
|
|
22850
22875
|
};
|
|
22851
22876
|
const isNearLimit = value.length > POLL_LIMITS.MAX_TEXT_LENGTH * 0.9;
|
|
22852
22877
|
return /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-2", children: /* @__PURE__ */ jsx("div", { className: "flex items-end gap-2", children: /* @__PURE__ */ jsxs("div", { className: "flex-1 space-y-1.5", children: [
|
|
22853
|
-
/* @__PURE__ */ jsx("label", { htmlFor: "poll-text-input", className: "text-sm font-medium text-foreground", children: "
|
|
22878
|
+
/* @__PURE__ */ jsx("label", { htmlFor: "poll-text-input", className: "text-sm font-medium text-foreground", children: t("addTextOptionKey") }),
|
|
22854
22879
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center sm:gap-3 gap-1", children: [
|
|
22855
22880
|
/* @__PURE__ */ jsx(
|
|
22856
22881
|
Input,
|
|
22857
22882
|
{
|
|
22858
22883
|
id: "poll-text-input",
|
|
22859
|
-
placeholder: "
|
|
22884
|
+
placeholder: t("enterTextOptionKey"),
|
|
22860
22885
|
value,
|
|
22861
22886
|
onChange: (e) => onChange(e.target.value),
|
|
22862
22887
|
onKeyDown: handleKeyDown,
|
|
@@ -22874,13 +22899,13 @@ const TextInputSection = ({
|
|
|
22874
22899
|
size: "default",
|
|
22875
22900
|
children: [
|
|
22876
22901
|
/* @__PURE__ */ jsx(Type, { className: "h-4 w-4 sm:mr-2" }),
|
|
22877
|
-
/* @__PURE__ */ jsx("span", { className: "hidden sm:inline", children: "
|
|
22902
|
+
/* @__PURE__ */ jsx("span", { className: "hidden sm:inline", children: t("addKey") })
|
|
22878
22903
|
]
|
|
22879
22904
|
}
|
|
22880
22905
|
)
|
|
22881
22906
|
] }),
|
|
22882
22907
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between text-xs text-muted-foreground", children: [
|
|
22883
|
-
/* @__PURE__ */ jsx("span", { children: "
|
|
22908
|
+
/* @__PURE__ */ jsx("span", { children: t("pressEnterToAddKey") }),
|
|
22884
22909
|
/* @__PURE__ */ jsxs(
|
|
22885
22910
|
"span",
|
|
22886
22911
|
{
|
|
@@ -22903,6 +22928,7 @@ const FileInputSection = ({
|
|
|
22903
22928
|
onImageSelect,
|
|
22904
22929
|
disabled
|
|
22905
22930
|
}) => {
|
|
22931
|
+
const { t } = usePostBuilder();
|
|
22906
22932
|
const ref = useRef(null);
|
|
22907
22933
|
const [openSearchModal, setOpenSearchModal] = useState(false);
|
|
22908
22934
|
const handleFileSelect = (e) => {
|
|
@@ -22912,7 +22938,7 @@ const FileInputSection = ({
|
|
|
22912
22938
|
void onFileSelect(files);
|
|
22913
22939
|
e.target.value = "";
|
|
22914
22940
|
};
|
|
22915
|
-
return /* @__PURE__ */ jsxs("div", { className: "flex
|
|
22941
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
22916
22942
|
/* @__PURE__ */ jsxs(
|
|
22917
22943
|
Button,
|
|
22918
22944
|
{
|
|
@@ -22922,7 +22948,7 @@ const FileInputSection = ({
|
|
|
22922
22948
|
onClick: () => ref.current?.click(),
|
|
22923
22949
|
children: [
|
|
22924
22950
|
/* @__PURE__ */ jsx(ImagePlus, { className: "h-4 w-4" }),
|
|
22925
|
-
"
|
|
22951
|
+
t("uploadKey")
|
|
22926
22952
|
]
|
|
22927
22953
|
}
|
|
22928
22954
|
),
|
|
@@ -22947,7 +22973,8 @@ const FileInputSection = ({
|
|
|
22947
22973
|
onImageSelect,
|
|
22948
22974
|
children: /* @__PURE__ */ jsxs(Button, { disabled, className: "cursor-pointer flex-1 [&>svg]:size-6", children: [
|
|
22949
22975
|
/* @__PURE__ */ jsx(GifIcon, {}),
|
|
22950
|
-
"
|
|
22976
|
+
" ",
|
|
22977
|
+
t("searchGifOrImagesKey")
|
|
22951
22978
|
] })
|
|
22952
22979
|
}
|
|
22953
22980
|
)
|
|
@@ -23774,7 +23801,7 @@ const LinkMarkView = ({ mark, editor }) => {
|
|
|
23774
23801
|
ToolbarButton,
|
|
23775
23802
|
{
|
|
23776
23803
|
size: "icon",
|
|
23777
|
-
tooltip: "
|
|
23804
|
+
tooltip: "visitLinkKey",
|
|
23778
23805
|
onClick: () => window.open(mark.attrs.href, "_blank"),
|
|
23779
23806
|
children: /* @__PURE__ */ jsx(ExternalLink, {})
|
|
23780
23807
|
}
|
|
@@ -23791,14 +23818,14 @@ const LinkMarkView = ({ mark, editor }) => {
|
|
|
23791
23818
|
},
|
|
23792
23819
|
onInsertLink: handleUpdateLink,
|
|
23793
23820
|
hideTextInput: mark?.attrs?.isLinkMode,
|
|
23794
|
-
children: /* @__PURE__ */ jsx(ToolbarButton, { size: "icon", tooltip: "
|
|
23821
|
+
children: /* @__PURE__ */ jsx(ToolbarButton, { size: "icon", tooltip: "editLinkKey", children: /* @__PURE__ */ jsx(SquarePen, {}) })
|
|
23795
23822
|
}
|
|
23796
23823
|
),
|
|
23797
23824
|
/* @__PURE__ */ jsx(
|
|
23798
23825
|
ToolbarButton,
|
|
23799
23826
|
{
|
|
23800
23827
|
size: "icon",
|
|
23801
|
-
tooltip: "
|
|
23828
|
+
tooltip: "unsetLinkKey",
|
|
23802
23829
|
onClick: () => {
|
|
23803
23830
|
setOpen(false);
|
|
23804
23831
|
editor.commands.unsetLink();
|
|
@@ -29669,7 +29696,7 @@ const MentionList = forwardRef((props, ref) => {
|
|
|
29669
29696
|
filteredItems.length,
|
|
29670
29697
|
")"
|
|
29671
29698
|
] }),
|
|
29672
|
-
/* @__PURE__ */ jsx("ul", { className: "max-h-64 overflow-y-auto", children: filteredItems.length === 0 ? /* @__PURE__ */ 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__ */ jsx("div", { className: "p-1", children: filteredItems.map((item, index2) => /* @__PURE__ */
|
|
29699
|
+
/* @__PURE__ */ jsx("ul", { className: "max-h-64 overflow-y-auto", children: filteredItems.length === 0 ? /* @__PURE__ */ 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__ */ jsx("div", { className: "p-1", children: filteredItems.map((item, index2) => /* @__PURE__ */ jsxs(
|
|
29673
29700
|
"li",
|
|
29674
29701
|
{
|
|
29675
29702
|
ref: (el) => {
|
|
@@ -29677,39 +29704,12 @@ const MentionList = forwardRef((props, ref) => {
|
|
|
29677
29704
|
},
|
|
29678
29705
|
onClick: () => selectItem(index2),
|
|
29679
29706
|
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"}`,
|
|
29680
|
-
children:
|
|
29681
|
-
/* @__PURE__ */ jsx(
|
|
29682
|
-
|
|
29683
|
-
{
|
|
29684
|
-
src: item.avatar,
|
|
29685
|
-
alt: item.label,
|
|
29686
|
-
className: "h-9 w-9 rounded-full object-cover"
|
|
29687
|
-
}
|
|
29688
|
-
) : /* @__PURE__ */ jsx("span", { className: "text-white font-medium text-sm", children: item.label?.charAt(0).toUpperCase() }) }),
|
|
29689
|
-
/* @__PURE__ */ jsxs("div", { className: "flex flex-col min-w-0 flex-1", children: [
|
|
29707
|
+
children: [
|
|
29708
|
+
/* @__PURE__ */ jsx(Avatar, { className: "size-9 shrink-0 bg-linear-to-br from-blue-400 to-blue-600", children: item.avatar ? /* @__PURE__ */ jsx(AvatarImage, { src: item.avatar, alt: item.label }) : /* @__PURE__ */ jsx(AvatarFallback, { className: "text-white bg-transparent font-medium text-sm", children: item.label?.charAt(0).toUpperCase() }) }),
|
|
29709
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-col min-w-0 flex-1", children: isMention ? /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
29690
29710
|
/* @__PURE__ */ jsx("span", { className: "font-medium text-sm text-gray-900 dark:text-gray-100 truncate", children: item.label }),
|
|
29691
29711
|
item.email && /* @__PURE__ */ jsx("span", { className: "text-xs text-gray-500 dark:text-gray-400 truncate", children: item.email })
|
|
29692
|
-
] })
|
|
29693
|
-
] }) : /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
29694
|
-
/* @__PURE__ */ 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__ */ jsx(
|
|
29695
|
-
"svg",
|
|
29696
|
-
{
|
|
29697
|
-
className: "h-5 w-5 text-white",
|
|
29698
|
-
fill: "none",
|
|
29699
|
-
stroke: "currentColor",
|
|
29700
|
-
viewBox: "0 0 24 24",
|
|
29701
|
-
children: /* @__PURE__ */ jsx(
|
|
29702
|
-
"path",
|
|
29703
|
-
{
|
|
29704
|
-
strokeLinecap: "round",
|
|
29705
|
-
strokeLinejoin: "round",
|
|
29706
|
-
strokeWidth: 2,
|
|
29707
|
-
d: "M7 20l4-16m2 16l4-16M6 9h14M4 15h14"
|
|
29708
|
-
}
|
|
29709
|
-
)
|
|
29710
|
-
}
|
|
29711
|
-
) }),
|
|
29712
|
-
/* @__PURE__ */ jsxs("div", { className: "flex flex-col min-w-0 flex-1", children: [
|
|
29712
|
+
] }) : /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
29713
29713
|
/* @__PURE__ */ jsxs("span", { className: "font-medium text-sm text-gray-900 dark:text-gray-100 truncate", children: [
|
|
29714
29714
|
"#",
|
|
29715
29715
|
item.label
|
|
@@ -29718,8 +29718,8 @@ const MentionList = forwardRef((props, ref) => {
|
|
|
29718
29718
|
item.count.toLocaleString(),
|
|
29719
29719
|
" posts"
|
|
29720
29720
|
] })
|
|
29721
|
-
] })
|
|
29722
|
-
]
|
|
29721
|
+
] }) })
|
|
29722
|
+
]
|
|
29723
29723
|
},
|
|
29724
29724
|
item.id
|
|
29725
29725
|
)) }) }),
|
|
@@ -29769,7 +29769,7 @@ const mentionService = (api, mfs, store) => {
|
|
|
29769
29769
|
return [];
|
|
29770
29770
|
}
|
|
29771
29771
|
const response = await api.fetchGroupConversations(999, 0);
|
|
29772
|
-
return response.entries.
|
|
29772
|
+
return response.entries.map(
|
|
29773
29773
|
(item) => ({
|
|
29774
29774
|
id: item?.group_id,
|
|
29775
29775
|
label: item?.group?.name,
|
|
@@ -29882,16 +29882,6 @@ const configureMentionExtension = (api, mfs, store) => {
|
|
|
29882
29882
|
]
|
|
29883
29883
|
});
|
|
29884
29884
|
};
|
|
29885
|
-
function Skeleton({ className, ...props }) {
|
|
29886
|
-
return /* @__PURE__ */ jsx(
|
|
29887
|
-
"div",
|
|
29888
|
-
{
|
|
29889
|
-
"data-slot": "skeleton",
|
|
29890
|
-
className: cn("bg-accent animate-pulse rounded-md", className),
|
|
29891
|
-
...props
|
|
29892
|
-
}
|
|
29893
|
-
);
|
|
29894
|
-
}
|
|
29895
29885
|
const LinkPreviewCompact = ({
|
|
29896
29886
|
selected,
|
|
29897
29887
|
href,
|
|
@@ -29901,6 +29891,7 @@ const LinkPreviewCompact = ({
|
|
|
29901
29891
|
domain,
|
|
29902
29892
|
onClickDelete
|
|
29903
29893
|
}) => {
|
|
29894
|
+
const { t } = usePostBuilder();
|
|
29904
29895
|
const safeDomain = useMemo(() => {
|
|
29905
29896
|
try {
|
|
29906
29897
|
return domain || new URL(href).hostname;
|
|
@@ -29922,16 +29913,16 @@ const LinkPreviewCompact = ({
|
|
|
29922
29913
|
),
|
|
29923
29914
|
children: [
|
|
29924
29915
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 absolute z-50 right-2 top-1", children: [
|
|
29925
|
-
/* @__PURE__ */ jsx(ToolbarButton, { asChild: true, tooltip: "
|
|
29916
|
+
/* @__PURE__ */ jsx(ToolbarButton, { asChild: true, tooltip: "visitLinkKey", children: /* @__PURE__ */ jsxs("span", { className: "relative", children: [
|
|
29926
29917
|
/* @__PURE__ */ jsx("a", { href, target: "_blank", rel: "noopener noreferrer", className: "absolute inset-0" }),
|
|
29927
29918
|
/* @__PURE__ */ jsx(ExternalLink, {})
|
|
29928
29919
|
] }) }),
|
|
29929
29920
|
/* @__PURE__ */ jsx(
|
|
29930
29921
|
ToolbarButton,
|
|
29931
29922
|
{
|
|
29932
|
-
tooltip: "
|
|
29923
|
+
tooltip: "removeLinkPreviewKey",
|
|
29933
29924
|
onClick: handleDelete,
|
|
29934
|
-
"aria-label": "
|
|
29925
|
+
"aria-label": t("removeLinkPreviewKey"),
|
|
29935
29926
|
type: "button",
|
|
29936
29927
|
size: "icon",
|
|
29937
29928
|
className: "cursor-pointer size-6 shadow-none bg-transparent group-hover:bg-destructive/5 hover:bg-destructive/10 text-destructive hover:text-destructive",
|
|
@@ -29940,7 +29931,7 @@ const LinkPreviewCompact = ({
|
|
|
29940
29931
|
)
|
|
29941
29932
|
] }),
|
|
29942
29933
|
/* @__PURE__ */ jsx("div", { className: "relative z-0 w-full", children: /* @__PURE__ */ 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: [
|
|
29943
|
-
/* @__PURE__ */ jsx("div", { className: "relative h-16 w-16
|
|
29934
|
+
/* @__PURE__ */ jsx("div", { className: "relative h-16 w-16 shrink-0 overflow-hidden rounded-md bg-muted", children: /* @__PURE__ */ jsx(
|
|
29944
29935
|
"img",
|
|
29945
29936
|
{
|
|
29946
29937
|
src: image,
|
|
@@ -29953,7 +29944,7 @@ const LinkPreviewCompact = ({
|
|
|
29953
29944
|
/* @__PURE__ */ jsx("p", { className: "line-clamp-1 text-xs text-muted-foreground", children: description }),
|
|
29954
29945
|
/* @__PURE__ */ jsxs("div", { className: "mt-1 flex items-center gap-1 text-xs text-muted-foreground", children: [
|
|
29955
29946
|
/* @__PURE__ */ jsx("span", { className: "truncate", children: safeDomain }),
|
|
29956
|
-
/* @__PURE__ */ jsx(ExternalLink, { className: "h-3 w-3
|
|
29947
|
+
/* @__PURE__ */ jsx(ExternalLink, { className: "h-3 w-3 shrink-0 opacity-50" })
|
|
29957
29948
|
] })
|
|
29958
29949
|
] })
|
|
29959
29950
|
] }) })
|
|
@@ -29970,6 +29961,7 @@ const LinkPreviewExtended = ({
|
|
|
29970
29961
|
domain,
|
|
29971
29962
|
onClickDelete
|
|
29972
29963
|
}) => {
|
|
29964
|
+
const { t } = usePostBuilder();
|
|
29973
29965
|
const safeDomain = useMemo(() => {
|
|
29974
29966
|
try {
|
|
29975
29967
|
return domain || new URL(href).hostname;
|
|
@@ -29995,7 +29987,7 @@ const LinkPreviewExtended = ({
|
|
|
29995
29987
|
ToolbarButton,
|
|
29996
29988
|
{
|
|
29997
29989
|
asChild: true,
|
|
29998
|
-
tooltip: "
|
|
29990
|
+
tooltip: "visitLinkKey",
|
|
29999
29991
|
className: "cursor-pointer backdrop-blur-2xl size-6 shadow-none group-hover:bg-accent/70 group-hover:text-accent-foreground text-primary-send",
|
|
30000
29992
|
children: /* @__PURE__ */ jsxs("span", { className: "relative", children: [
|
|
30001
29993
|
/* @__PURE__ */ jsx("a", { href, target: "_blank", rel: "noopener noreferrer", className: "absolute inset-0" }),
|
|
@@ -30006,9 +29998,9 @@ const LinkPreviewExtended = ({
|
|
|
30006
29998
|
/* @__PURE__ */ jsx(
|
|
30007
29999
|
ToolbarButton,
|
|
30008
30000
|
{
|
|
30009
|
-
tooltip: "
|
|
30001
|
+
tooltip: "removeLinkPreviewKey",
|
|
30010
30002
|
onClick: handleDelete,
|
|
30011
|
-
"aria-label": "
|
|
30003
|
+
"aria-label": t("removeLinkPreviewKey"),
|
|
30012
30004
|
type: "button",
|
|
30013
30005
|
size: "icon",
|
|
30014
30006
|
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",
|
|
@@ -30038,8 +30030,19 @@ const LinkPreviewExtended = ({
|
|
|
30038
30030
|
}
|
|
30039
30031
|
);
|
|
30040
30032
|
};
|
|
30033
|
+
function Skeleton({ className, ...props }) {
|
|
30034
|
+
return /* @__PURE__ */ jsx(
|
|
30035
|
+
"div",
|
|
30036
|
+
{
|
|
30037
|
+
"data-slot": "skeleton",
|
|
30038
|
+
className: cn("bg-accent animate-pulse rounded-md", className),
|
|
30039
|
+
...props
|
|
30040
|
+
}
|
|
30041
|
+
);
|
|
30042
|
+
}
|
|
30041
30043
|
const LinkPreviewCard = ({ node, deleteNode, selected }) => {
|
|
30042
30044
|
const { loading, href, domain, variant } = node.attrs;
|
|
30045
|
+
const { t } = usePostBuilder();
|
|
30043
30046
|
const safeDomain = useMemo(() => {
|
|
30044
30047
|
try {
|
|
30045
30048
|
return domain || new URL(href).hostname;
|
|
@@ -30048,7 +30051,7 @@ const LinkPreviewCard = ({ node, deleteNode, selected }) => {
|
|
|
30048
30051
|
}
|
|
30049
30052
|
}, [href, domain]);
|
|
30050
30053
|
if (loading)
|
|
30051
|
-
return /* @__PURE__ */ jsx(NodeViewWrapper, { children: /* @__PURE__ */ jsx(Skeleton, { className: "w-full h-24 flex items-center justify-center rounded-lg", children: /* @__PURE__ */ jsx("span", { className: "text-sm text-muted-foreground", children: "
|
|
30054
|
+
return /* @__PURE__ */ jsx(NodeViewWrapper, { children: /* @__PURE__ */ jsx(Skeleton, { className: "w-full h-24 flex items-center justify-center rounded-lg", children: /* @__PURE__ */ jsx("span", { className: "text-sm text-muted-foreground", children: t("fetchingMetadataKey") }) }) });
|
|
30052
30055
|
if (!href) return null;
|
|
30053
30056
|
return /* @__PURE__ */ jsx(NodeViewWrapper, { contentEditable: false, "data-drag-handle": true, children: variant === LinkPreviewType.Compact ? /* @__PURE__ */ jsx(
|
|
30054
30057
|
LinkPreviewCompact,
|
|
@@ -30528,7 +30531,7 @@ const CODE_BLOCK_HTML_ATTRIBUTES = {
|
|
|
30528
30531
|
};
|
|
30529
30532
|
const createCustomDocument = (content) => Document.extend({ content });
|
|
30530
30533
|
const PollDoc = createCustomDocument("paragraph poll");
|
|
30531
|
-
const MediaDoc = createCustomDocument("paragraph media? linkPreview? mediaGroup?");
|
|
30534
|
+
const MediaDoc = createCustomDocument("paragraph+ media? linkPreview? mediaGroup?");
|
|
30532
30535
|
createCustomDocument("paragraph linkPreview?");
|
|
30533
30536
|
const getStarterKitConfig = ({
|
|
30534
30537
|
includeLink = false,
|
|
@@ -30548,7 +30551,7 @@ const getPlaceholderExtension = (placeholder) => Placeholder.configure({
|
|
|
30548
30551
|
const getMentionExtension = (core, mfs, store) => configureMentionExtension(core, mfs, store);
|
|
30549
30552
|
const getExtensions = ({ editorType, api, store, user }) => {
|
|
30550
30553
|
const extensionMap = {
|
|
30551
|
-
[EditorTypes.
|
|
30554
|
+
[EditorTypes.Blog]: getDefaultExtensions,
|
|
30552
30555
|
[EditorTypes.Media]: getMediaExtensions,
|
|
30553
30556
|
// [EditorTypes.Link]: getLinkExtensions,
|
|
30554
30557
|
[EditorTypes.Poll]: getPollExtensions
|
|
@@ -30710,7 +30713,7 @@ const usePostBuilderEditor = ({ editorType, groupId, postId, user }) => {
|
|
|
30710
30713
|
editorProps: getEditorProps(),
|
|
30711
30714
|
onCreate: ({ editor: editor2 }) => {
|
|
30712
30715
|
store.getState().setEditor(editor2);
|
|
30713
|
-
if (editorType === EditorTypes.
|
|
30716
|
+
if (editorType === EditorTypes.Blog) editor2?.chain()?.focus()?.run();
|
|
30714
30717
|
if (editorType === EditorTypes.Media) editor2?.chain()?.focus()?.run();
|
|
30715
30718
|
if (editorType === EditorTypes.Poll) initializePollEditor(editor2);
|
|
30716
30719
|
},
|
|
@@ -30859,7 +30862,7 @@ const generatePollPostPayload = ({
|
|
|
30859
30862
|
};
|
|
30860
30863
|
const generateCreatePostPayload = (editorTab, params) => {
|
|
30861
30864
|
switch (editorTab) {
|
|
30862
|
-
case EditorTypes.
|
|
30865
|
+
case EditorTypes.Blog:
|
|
30863
30866
|
return generateHtmlPostPayload(params);
|
|
30864
30867
|
case EditorTypes.Media:
|
|
30865
30868
|
return generateMediaPostPayload(params);
|
|
@@ -30960,7 +30963,7 @@ const PostBuilderEditorInstance = ({
|
|
|
30960
30963
|
editor,
|
|
30961
30964
|
className: cn(
|
|
30962
30965
|
"pr-2",
|
|
30963
|
-
editorTab !== EditorTypes.
|
|
30966
|
+
editorTab !== EditorTypes.Blog && "hidden size-0 overflow-hidden pointer-events-none"
|
|
30964
30967
|
),
|
|
30965
30968
|
children: /* @__PURE__ */ jsx(Button, { variant: "ghost", className: "bg-white cursor-grab py-0.5 px-0 border size-auto", children: /* @__PURE__ */ jsx(GripVertical, { className: "text-muted-foreground" }) })
|
|
30966
30969
|
}
|
|
@@ -31691,18 +31694,152 @@ const PostBuilderEditor = ({
|
|
|
31691
31694
|
}
|
|
31692
31695
|
);
|
|
31693
31696
|
};
|
|
31697
|
+
const translationFallback = {
|
|
31698
|
+
// General
|
|
31699
|
+
addKey: "Add",
|
|
31700
|
+
cancelKey: "Cancel",
|
|
31701
|
+
deleteKey: "Delete",
|
|
31702
|
+
editKey: "Edit",
|
|
31703
|
+
updateKey: "Update",
|
|
31704
|
+
insertKey: "Insert",
|
|
31705
|
+
uploadKey: "Upload",
|
|
31706
|
+
postKey: "Post",
|
|
31707
|
+
crossPostKey: "Cross-post to groups you #mention?",
|
|
31708
|
+
//Editor Tabs
|
|
31709
|
+
postTabKey: "Post",
|
|
31710
|
+
blogTabKey: "Blog",
|
|
31711
|
+
pollTabKey: "Poll",
|
|
31712
|
+
// Toolbar buttons
|
|
31713
|
+
alignLeftKey: "Align Left",
|
|
31714
|
+
alignCenterKey: "Align Center",
|
|
31715
|
+
alignRightKey: "Align Right",
|
|
31716
|
+
undoKey: "Undo",
|
|
31717
|
+
redoKey: "Redo",
|
|
31718
|
+
headingOptionsKey: "Heading Options",
|
|
31719
|
+
paragraphKey: "Paragraph",
|
|
31720
|
+
heading1Key: "Heading 1",
|
|
31721
|
+
heading2Key: "Heading 2",
|
|
31722
|
+
heading3Key: "Heading 3",
|
|
31723
|
+
boldKey: "Bold",
|
|
31724
|
+
italicKey: "Italic",
|
|
31725
|
+
strikethroughKey: "Strikethrough",
|
|
31726
|
+
bulletListKey: "Bullet List",
|
|
31727
|
+
orderedListKey: "Ordered List",
|
|
31728
|
+
blockquoteKey: "BlockQuote",
|
|
31729
|
+
codeKey: "Code",
|
|
31730
|
+
codeBlockKey: "Codeblock",
|
|
31731
|
+
moreOptionsKey: "More formatting options",
|
|
31732
|
+
// Media
|
|
31733
|
+
insertImageKey: "Insert Image",
|
|
31734
|
+
// Toolbar
|
|
31735
|
+
insertVideoKey: "Insert Video",
|
|
31736
|
+
// Toolbar
|
|
31737
|
+
insertAudioKey: "Insert Audio",
|
|
31738
|
+
// Toolbar
|
|
31739
|
+
searchGifOrImagesKey: "Search Gif/Images Online",
|
|
31740
|
+
mediaSearchTitleKey: "Search Media",
|
|
31741
|
+
gifSearchKey: "GIF Search",
|
|
31742
|
+
imageSearchKey: "Image Search",
|
|
31743
|
+
searchGifPlaceholder: "Search GIFs...",
|
|
31744
|
+
searchIMagePlaceholder: "Search Images...",
|
|
31745
|
+
// Links
|
|
31746
|
+
addLinkPreviewKey: "Add link with preview",
|
|
31747
|
+
editLinkKey: "Edit Link",
|
|
31748
|
+
visitLinkKey: "Visit Link",
|
|
31749
|
+
unsetLinkKey: "Unset Link",
|
|
31750
|
+
linkInputLabelKey: "Link URL",
|
|
31751
|
+
linkTextInputLabelKey: "Text to display",
|
|
31752
|
+
invalidLinkKey: "Please enter a valid URL",
|
|
31753
|
+
insertLinkKey: "Insert Link",
|
|
31754
|
+
updateLinkKey: "Update Link",
|
|
31755
|
+
removeLinkPreviewKey: "Remove Link Preview",
|
|
31756
|
+
fetchingMetadataKey: "Fetching Link Metadata...",
|
|
31757
|
+
// Poll related
|
|
31758
|
+
addTextOptionKey: "Add text option",
|
|
31759
|
+
enterTextOptionKey: "Enter a text option...",
|
|
31760
|
+
pressEnterToAddKey: "Press Enter to add"
|
|
31761
|
+
};
|
|
31762
|
+
const defaultTranslationKeyMappings = {
|
|
31763
|
+
// General
|
|
31764
|
+
addKey: "general_add",
|
|
31765
|
+
cancelKey: "cancel",
|
|
31766
|
+
deleteKey: "general_delete",
|
|
31767
|
+
editKey: "general_edit",
|
|
31768
|
+
updateKey: "general_update",
|
|
31769
|
+
insertKey: "general_insert",
|
|
31770
|
+
uploadKey: "general_upload",
|
|
31771
|
+
postKey: "general_send_post",
|
|
31772
|
+
crossPostKey: "cross_mention_title",
|
|
31773
|
+
//Editor Tabs
|
|
31774
|
+
postTabKey: "post_builder_tab_post_title",
|
|
31775
|
+
blogTabKey: "post_builder_tab_blog_title",
|
|
31776
|
+
pollTabKey: "post_builder_tab_poll_title",
|
|
31777
|
+
// Toolbar buttons
|
|
31778
|
+
alignLeftKey: "post_builder_formatting_tooltip_align_left",
|
|
31779
|
+
alignCenterKey: "post_builder_formatting_tooltip_align_center",
|
|
31780
|
+
alignRightKey: "post_builder_formatting_tooltip_align_right",
|
|
31781
|
+
undoKey: "post_builder_formatting_tooltip_undo",
|
|
31782
|
+
redoKey: "post_builder_formatting_tooltip_redo",
|
|
31783
|
+
headingOptionsKey: "post_builder_formatting_tooltip_heading_options",
|
|
31784
|
+
paragraphKey: "post_builder_formatting_tooltip_paragraph",
|
|
31785
|
+
heading1Key: "post_builder_formatting_tooltip_heading_one",
|
|
31786
|
+
heading2Key: "post_builder_formatting_tooltip_heading_two",
|
|
31787
|
+
heading3Key: "post_builder_formatting_tooltip_heading_three",
|
|
31788
|
+
boldKey: "post_builder_formatting_tooltip_bold",
|
|
31789
|
+
italicKey: "post_builder_formatting_tooltip_italic",
|
|
31790
|
+
strikethroughKey: "post_builder_formatting_tooltip_strikethrough",
|
|
31791
|
+
bulletListKey: "post_builder_formatting_tooltip_list_bullet",
|
|
31792
|
+
orderedListKey: "post_builder_formatting_tooltip_list_ordered",
|
|
31793
|
+
blockquoteKey: "post_builder_formatting_tooltip_blockquote",
|
|
31794
|
+
codeKey: "post_builder_formatting_tooltip_code",
|
|
31795
|
+
codeBlockKey: "post_builder_formatting_tooltip_codeblock",
|
|
31796
|
+
moreOptionsKey: "post_builder_formatting_tooltip_more_options",
|
|
31797
|
+
// Media
|
|
31798
|
+
insertImageKey: "post_builder_tooltip_insert_image",
|
|
31799
|
+
// Toolbar
|
|
31800
|
+
insertVideoKey: "post_builder_tooltip_insert_video",
|
|
31801
|
+
// Toolbar
|
|
31802
|
+
insertAudioKey: "post_builder_tooltip_insert_audio",
|
|
31803
|
+
// Toolbar
|
|
31804
|
+
searchGifOrImagesKey: "post_builder_tooltip_search_gif_or_image",
|
|
31805
|
+
mediaSearchTitleKey: "post_builder_media_search_modal_title",
|
|
31806
|
+
gifSearchKey: "post_builder_media_search_tab_gif_title",
|
|
31807
|
+
imageSearchKey: "post_builder_media_search_tab_image_title",
|
|
31808
|
+
searchGifPlaceholder: "post_builder_media_search_input_gif_placeholder",
|
|
31809
|
+
searchIMagePlaceholder: "post_builder_media_search_input_image_placeholder",
|
|
31810
|
+
// Links
|
|
31811
|
+
addLinkPreviewKey: "post_builder_tooltip_link_add",
|
|
31812
|
+
editLinkKey: "post_builder_tooltip_link_edit",
|
|
31813
|
+
visitLinkKey: "post_builder_tooltip_link_visit",
|
|
31814
|
+
unsetLinkKey: "post_builder_tooltip_link_unset",
|
|
31815
|
+
linkInputLabelKey: "post_builder_link_input_label",
|
|
31816
|
+
linkTextInputLabelKey: "post_builder_link_text_input_label",
|
|
31817
|
+
invalidLinkKey: "post_builder_link_input_invalid",
|
|
31818
|
+
insertLinkKey: "post_builder_link_insert_modal_title",
|
|
31819
|
+
updateLinkKey: "post_builder_link_update_modal_title",
|
|
31820
|
+
removeLinkPreviewKey: "post_builder_tooltip_link_remove_preview",
|
|
31821
|
+
fetchingMetadataKey: "post_builder_link_loading_metadata_placeholder",
|
|
31822
|
+
// Poll related
|
|
31823
|
+
addTextOptionKey: "post_builder_poll_add_text_option_input_label",
|
|
31824
|
+
enterTextOptionKey: "post_builder_poll_add_text_option_input_placeholder",
|
|
31825
|
+
pressEnterToAddKey: "post_builder_poll_add_text_option_input_command"
|
|
31826
|
+
};
|
|
31694
31827
|
const PostBuilderProvider = ({
|
|
31695
31828
|
children,
|
|
31696
31829
|
apiBaseURL,
|
|
31697
31830
|
authToken,
|
|
31698
31831
|
toI18N,
|
|
31699
|
-
i18nKeys,
|
|
31832
|
+
i18nKeys = defaultTranslationKeyMappings,
|
|
31700
31833
|
logEvent
|
|
31701
31834
|
}) => {
|
|
31702
31835
|
const t = useCallback(
|
|
31703
31836
|
(key, fallback) => {
|
|
31704
|
-
const
|
|
31705
|
-
|
|
31837
|
+
const i18nKeysDerived = { ...defaultTranslationKeyMappings, ...i18nKeys };
|
|
31838
|
+
const translationKey = i18nKeysDerived[key];
|
|
31839
|
+
const message = toI18N(translationKey);
|
|
31840
|
+
if (message !== translationKey) return message;
|
|
31841
|
+
const defaultMessage = translationFallback[key];
|
|
31842
|
+
if (defaultMessage) return defaultMessage;
|
|
31706
31843
|
return fallback || key;
|
|
31707
31844
|
},
|
|
31708
31845
|
[toI18N, i18nKeys]
|