@select-org/select-post-builder 1.1.24 → 1.1.26
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 +1 -0
- package/dist/post-builder.cjs.js +60 -22
- package/dist/post-builder.css +4 -0
- package/dist/post-builder.js +60 -22
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
package/dist/post-builder.cjs.js
CHANGED
|
@@ -16351,7 +16351,7 @@ function AvatarFallback({ className, ...props }) {
|
|
|
16351
16351
|
}
|
|
16352
16352
|
);
|
|
16353
16353
|
}
|
|
16354
|
-
const GroupSelector = ({ store }) => {
|
|
16354
|
+
const GroupSelector = ({ store, onGroupSelect }) => {
|
|
16355
16355
|
const { core: core2 } = useApi();
|
|
16356
16356
|
const [groups, setGroups] = React.useState([]);
|
|
16357
16357
|
const [isLoading, setIsLoading] = React.useState(false);
|
|
@@ -16388,6 +16388,7 @@ const GroupSelector = ({ store }) => {
|
|
|
16388
16388
|
}, [core2]);
|
|
16389
16389
|
const handleValueChange = (value) => {
|
|
16390
16390
|
store.getState().selectGroup(value);
|
|
16391
|
+
onGroupSelect?.(value);
|
|
16391
16392
|
};
|
|
16392
16393
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "not-prose flex items-center gap-3", children: /* @__PURE__ */ jsxRuntime.jsxs(Select, { value: currentValue, onValueChange: handleValueChange, disabled: isLoading, children: [
|
|
16393
16394
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -25671,8 +25672,23 @@ const PollCreator = ({ choices, onChange }) => {
|
|
|
25671
25672
|
};
|
|
25672
25673
|
const handleFileUpload = async (files) => {
|
|
25673
25674
|
if (!files || !canAddMore) return;
|
|
25674
|
-
|
|
25675
|
+
let filesArray = files.slice(0, remainingSlots);
|
|
25675
25676
|
const startIndex = internalChoices.length;
|
|
25677
|
+
filesArray = await Promise.all(
|
|
25678
|
+
filesArray.map(async (file) => {
|
|
25679
|
+
if (file.type.startsWith("image/")) {
|
|
25680
|
+
try {
|
|
25681
|
+
const compressed = await imageCompression(file, {
|
|
25682
|
+
maxSizeMB: 10
|
|
25683
|
+
});
|
|
25684
|
+
return compressed;
|
|
25685
|
+
} catch (error) {
|
|
25686
|
+
return file;
|
|
25687
|
+
}
|
|
25688
|
+
}
|
|
25689
|
+
return file;
|
|
25690
|
+
})
|
|
25691
|
+
);
|
|
25676
25692
|
const placeholders = filesArray.map((_, i2) => ({
|
|
25677
25693
|
type: "placeholder",
|
|
25678
25694
|
key: `placeholder-${Date.now()}-${i2}`
|
|
@@ -32465,7 +32481,7 @@ const MentionList = React.forwardRef((props, ref) => {
|
|
|
32465
32481
|
});
|
|
32466
32482
|
MentionList.displayName = "MentionList";
|
|
32467
32483
|
const isReactNativeWebView = () => typeof window !== "undefined" && window.ReactNativeWebView !== void 0;
|
|
32468
|
-
const mentionService = (api, mfs, store) => {
|
|
32484
|
+
const mentionService = (api, mfs, store, user) => {
|
|
32469
32485
|
const fetchMentions = async () => {
|
|
32470
32486
|
const params = store.getState().getMentionParams();
|
|
32471
32487
|
if (!params) {
|
|
@@ -32473,7 +32489,7 @@ const mentionService = (api, mfs, store) => {
|
|
|
32473
32489
|
}
|
|
32474
32490
|
const { groupId, postId } = params;
|
|
32475
32491
|
const response = postId ? await mfs.getRecommendationPost(groupId, postId, 0, 999) : await mfs.getRecommendationGroup(groupId, 0, 999);
|
|
32476
|
-
|
|
32492
|
+
const apiResults = response.entries?.filter((item) => Boolean(item?.user_data))?.map(
|
|
32477
32493
|
(item) => ({
|
|
32478
32494
|
id: item?.user_data?.id,
|
|
32479
32495
|
label: item?.user_data?.name,
|
|
@@ -32484,7 +32500,22 @@ const mentionService = (api, mfs, store) => {
|
|
|
32484
32500
|
type: MentionType.User,
|
|
32485
32501
|
from: PostType.Post
|
|
32486
32502
|
})
|
|
32487
|
-
);
|
|
32503
|
+
) ?? [];
|
|
32504
|
+
if (user) {
|
|
32505
|
+
const loggedInUserMention = {
|
|
32506
|
+
id: user.id,
|
|
32507
|
+
label: user.name,
|
|
32508
|
+
avatar: user.avatar,
|
|
32509
|
+
inThisThread: 1,
|
|
32510
|
+
name: user.name,
|
|
32511
|
+
selectId: user.username,
|
|
32512
|
+
type: MentionType.User,
|
|
32513
|
+
from: PostType.Post
|
|
32514
|
+
};
|
|
32515
|
+
const filteredResults = apiResults.filter((item) => item.id !== user.id);
|
|
32516
|
+
return [loggedInUserMention, ...filteredResults];
|
|
32517
|
+
}
|
|
32518
|
+
return apiResults;
|
|
32488
32519
|
};
|
|
32489
32520
|
const fetchHashtags = async () => {
|
|
32490
32521
|
const { selectedGroupId, groupId } = store.getState();
|
|
@@ -32556,8 +32587,8 @@ function createSuggestion(char, fetchItems) {
|
|
|
32556
32587
|
}
|
|
32557
32588
|
};
|
|
32558
32589
|
}
|
|
32559
|
-
const configureMentionExtension = (api, mfs, store) => {
|
|
32560
|
-
const service = mentionService(api, mfs, store);
|
|
32590
|
+
const configureMentionExtension = (api, mfs, store, user) => {
|
|
32591
|
+
const service = mentionService(api, mfs, store, user);
|
|
32561
32592
|
return Mention.configure({
|
|
32562
32593
|
HTMLAttributes: {
|
|
32563
32594
|
class: "inline-block px-1.5 py-0.5 rounded font-medium no-underline cursor-pointer transition-all duration-200"
|
|
@@ -33298,7 +33329,7 @@ const getPlaceholderExtension = (placeholder) => extensions.Placeholder.configur
|
|
|
33298
33329
|
// emptyEditorClass:
|
|
33299
33330
|
// 'first:before:content-[attr(data-placeholder)] before:text-muted-foreground before:float-left before:h-0 before:pointer-events-none',
|
|
33300
33331
|
});
|
|
33301
|
-
const getMentionExtension = (core2, mfs, store) => configureMentionExtension(core2, mfs, store);
|
|
33332
|
+
const getMentionExtension = (core2, mfs, store, user) => configureMentionExtension(core2, mfs, store, user);
|
|
33302
33333
|
const getExtensions = ({ editorType, api, store, user }) => {
|
|
33303
33334
|
const extensionMap = {
|
|
33304
33335
|
[EditorTypes.Blog]: getDefaultExtensions,
|
|
@@ -33330,12 +33361,12 @@ const getDefaultExtensions = ({ api, store, user }) => {
|
|
|
33330
33361
|
api: core2
|
|
33331
33362
|
}),
|
|
33332
33363
|
LinkPreview,
|
|
33333
|
-
getMentionExtension(core2, mfs, store),
|
|
33364
|
+
getMentionExtension(core2, mfs, store, user),
|
|
33334
33365
|
SmartMediaUpload.configure({ api: fileStore }),
|
|
33335
33366
|
SmartLinkPaste.configure({ api: core2 })
|
|
33336
33367
|
];
|
|
33337
33368
|
};
|
|
33338
|
-
const getPollExtensions = ({ api, store }) => {
|
|
33369
|
+
const getPollExtensions = ({ api, store, user }) => {
|
|
33339
33370
|
const { core: core2, mfs } = api;
|
|
33340
33371
|
return [
|
|
33341
33372
|
PollDoc,
|
|
@@ -33346,7 +33377,7 @@ const getPollExtensions = ({ api, store }) => {
|
|
|
33346
33377
|
getPlaceholderExtension("Ask a Question"),
|
|
33347
33378
|
EnterHardBreak,
|
|
33348
33379
|
Poll,
|
|
33349
|
-
getMentionExtension(core2, mfs, store)
|
|
33380
|
+
getMentionExtension(core2, mfs, store, user)
|
|
33350
33381
|
];
|
|
33351
33382
|
};
|
|
33352
33383
|
const getMediaExtensions = ({ api, store, user }) => {
|
|
@@ -33374,7 +33405,7 @@ const getMediaExtensions = ({ api, store, user }) => {
|
|
|
33374
33405
|
// selectable: false,
|
|
33375
33406
|
draggable: false
|
|
33376
33407
|
}),
|
|
33377
|
-
getMentionExtension(core2, mfs, store),
|
|
33408
|
+
getMentionExtension(core2, mfs, store, user),
|
|
33378
33409
|
SmartMediaUpload.configure({ api: fileStore }),
|
|
33379
33410
|
SmartLinkPaste.configure({ api: core2, autoEmbed: false, autoLinkSelection: false })
|
|
33380
33411
|
];
|
|
@@ -33641,7 +33672,8 @@ const PostBuilderEditorInstance = ({
|
|
|
33641
33672
|
clearOnSuccess,
|
|
33642
33673
|
onCreatePost,
|
|
33643
33674
|
className,
|
|
33644
|
-
store
|
|
33675
|
+
store,
|
|
33676
|
+
placement
|
|
33645
33677
|
}) => {
|
|
33646
33678
|
const [isDragging, setIsDragging] = React.useState(false);
|
|
33647
33679
|
const { trackPublish } = useAnalyticsTracking();
|
|
@@ -33707,11 +33739,12 @@ const PostBuilderEditorInstance = ({
|
|
|
33707
33739
|
"div",
|
|
33708
33740
|
{
|
|
33709
33741
|
className: cn(
|
|
33710
|
-
"post-builder-editor bg-background border rounded-md overflow-hidden
|
|
33742
|
+
"post-builder-editor bg-background border rounded-md overflow-hidden max-h-full grow flex flex-col overflow-y-auto transition-all duration-300 ease-in-out",
|
|
33743
|
+
placement === EditorPlacement.Comment ? "min-h-32" : "min-h-60",
|
|
33711
33744
|
className
|
|
33712
33745
|
),
|
|
33713
33746
|
children: [
|
|
33714
|
-
/* @__PURE__ */ jsxRuntime.jsx(EditorTypeTabs, { editorTab, onSwitchEditorTab: onSwitchEditor }),
|
|
33747
|
+
placement !== EditorPlacement.Comment && /* @__PURE__ */ jsxRuntime.jsx(EditorTypeTabs, { editorTab, onSwitchEditorTab: onSwitchEditor }),
|
|
33715
33748
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
33716
33749
|
Toolbar,
|
|
33717
33750
|
{
|
|
@@ -33765,6 +33798,8 @@ const PostBuilderEditorInstanceWithDialog = ({
|
|
|
33765
33798
|
hideGroupSelector,
|
|
33766
33799
|
open,
|
|
33767
33800
|
onOpenChange,
|
|
33801
|
+
onGroupSelect,
|
|
33802
|
+
placement,
|
|
33768
33803
|
...rest
|
|
33769
33804
|
}) => {
|
|
33770
33805
|
const { trackAbandon } = useAnalyticsTracking();
|
|
@@ -33788,11 +33823,11 @@ const PostBuilderEditorInstanceWithDialog = ({
|
|
|
33788
33823
|
/* @__PURE__ */ jsxRuntime.jsxs(DialogHeader, { children: [
|
|
33789
33824
|
/* @__PURE__ */ jsxRuntime.jsx(DialogTitle, { className: "sr-only", children: "Post Builder Modal" }),
|
|
33790
33825
|
!hideGroupSelector && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-3", children: [
|
|
33791
|
-
/* @__PURE__ */ jsxRuntime.jsx(GroupSelector, { user, store }),
|
|
33826
|
+
/* @__PURE__ */ jsxRuntime.jsx(GroupSelector, { user, store, onGroupSelect }),
|
|
33792
33827
|
/* @__PURE__ */ jsxRuntime.jsx(DialogClose, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(Button, { variant: "outline", size: "icon", children: /* @__PURE__ */ jsxRuntime.jsx(X, {}) }) })
|
|
33793
33828
|
] })
|
|
33794
33829
|
] }),
|
|
33795
|
-
/* @__PURE__ */ jsxRuntime.jsx(PostBuilderEditorInstance, { ...rest, store })
|
|
33830
|
+
/* @__PURE__ */ jsxRuntime.jsx(PostBuilderEditorInstance, { ...rest, store, placement })
|
|
33796
33831
|
]
|
|
33797
33832
|
}
|
|
33798
33833
|
) });
|
|
@@ -33861,7 +33896,8 @@ const PostBuilderEditor = ({
|
|
|
33861
33896
|
openModal,
|
|
33862
33897
|
onModalOpenChange,
|
|
33863
33898
|
isSubmitting,
|
|
33864
|
-
onCreatePost
|
|
33899
|
+
onCreatePost,
|
|
33900
|
+
onGroupSelect
|
|
33865
33901
|
}) => {
|
|
33866
33902
|
const [editorTab, setEditorTab] = React.useState(EditorTypes.Media);
|
|
33867
33903
|
const [sessionId, setSessionId] = React.useState("");
|
|
@@ -33917,7 +33953,7 @@ const PostBuilderEditor = ({
|
|
|
33917
33953
|
/* @__PURE__ */ jsxRuntime.jsx(react.EditorContext.Provider, { value: providerValue, children: openModal ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
33918
33954
|
PostBuilderEditorInstanceWithDialog,
|
|
33919
33955
|
{
|
|
33920
|
-
placement
|
|
33956
|
+
placement,
|
|
33921
33957
|
hideGroupSelector,
|
|
33922
33958
|
user,
|
|
33923
33959
|
editor,
|
|
@@ -33929,10 +33965,11 @@ const PostBuilderEditor = ({
|
|
|
33929
33965
|
onOpenChange: onModalOpenChange,
|
|
33930
33966
|
onCreatePost,
|
|
33931
33967
|
isSubmitting,
|
|
33932
|
-
clearOnSuccess
|
|
33968
|
+
clearOnSuccess,
|
|
33969
|
+
onGroupSelect
|
|
33933
33970
|
}
|
|
33934
33971
|
) : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "prose-blockquote: flex-1 flex flex-col space-y-3 max-w-full max-h-[calc(100dvh-7rem)]", children: [
|
|
33935
|
-
!hideGroupSelector && /* @__PURE__ */ jsxRuntime.jsx(GroupSelector, { user, store }),
|
|
33972
|
+
!hideGroupSelector && /* @__PURE__ */ jsxRuntime.jsx(GroupSelector, { user, store, onGroupSelect }),
|
|
33936
33973
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
33937
33974
|
PostBuilderEditorInstance,
|
|
33938
33975
|
{
|
|
@@ -33943,7 +33980,8 @@ const PostBuilderEditor = ({
|
|
|
33943
33980
|
store,
|
|
33944
33981
|
isSubmitting,
|
|
33945
33982
|
onCreatePost,
|
|
33946
|
-
clearOnSuccess
|
|
33983
|
+
clearOnSuccess,
|
|
33984
|
+
placement
|
|
33947
33985
|
}
|
|
33948
33986
|
)
|
|
33949
33987
|
] }) }),
|
package/dist/post-builder.css
CHANGED
|
@@ -1648,6 +1648,10 @@ body {
|
|
|
1648
1648
|
min-height: calc(var(--spacing) * 16);
|
|
1649
1649
|
}
|
|
1650
1650
|
|
|
1651
|
+
[data-theme="select-post-builder"] .min-h-32 {
|
|
1652
|
+
min-height: calc(var(--spacing) * 32);
|
|
1653
|
+
}
|
|
1654
|
+
|
|
1651
1655
|
[data-theme="select-post-builder"] .min-h-44 {
|
|
1652
1656
|
min-height: calc(var(--spacing) * 44);
|
|
1653
1657
|
}
|
package/dist/post-builder.js
CHANGED
|
@@ -16321,7 +16321,7 @@ function AvatarFallback({ className, ...props }) {
|
|
|
16321
16321
|
}
|
|
16322
16322
|
);
|
|
16323
16323
|
}
|
|
16324
|
-
const GroupSelector = ({ store }) => {
|
|
16324
|
+
const GroupSelector = ({ store, onGroupSelect }) => {
|
|
16325
16325
|
const { core } = useApi();
|
|
16326
16326
|
const [groups, setGroups] = useState([]);
|
|
16327
16327
|
const [isLoading, setIsLoading] = useState(false);
|
|
@@ -16358,6 +16358,7 @@ const GroupSelector = ({ store }) => {
|
|
|
16358
16358
|
}, [core]);
|
|
16359
16359
|
const handleValueChange = (value) => {
|
|
16360
16360
|
store.getState().selectGroup(value);
|
|
16361
|
+
onGroupSelect?.(value);
|
|
16361
16362
|
};
|
|
16362
16363
|
return /* @__PURE__ */ jsx("div", { className: "not-prose flex items-center gap-3", children: /* @__PURE__ */ jsxs(Select, { value: currentValue, onValueChange: handleValueChange, disabled: isLoading, children: [
|
|
16363
16364
|
/* @__PURE__ */ jsx(
|
|
@@ -25641,8 +25642,23 @@ const PollCreator = ({ choices, onChange }) => {
|
|
|
25641
25642
|
};
|
|
25642
25643
|
const handleFileUpload = async (files) => {
|
|
25643
25644
|
if (!files || !canAddMore) return;
|
|
25644
|
-
|
|
25645
|
+
let filesArray = files.slice(0, remainingSlots);
|
|
25645
25646
|
const startIndex = internalChoices.length;
|
|
25647
|
+
filesArray = await Promise.all(
|
|
25648
|
+
filesArray.map(async (file) => {
|
|
25649
|
+
if (file.type.startsWith("image/")) {
|
|
25650
|
+
try {
|
|
25651
|
+
const compressed = await imageCompression(file, {
|
|
25652
|
+
maxSizeMB: 10
|
|
25653
|
+
});
|
|
25654
|
+
return compressed;
|
|
25655
|
+
} catch (error) {
|
|
25656
|
+
return file;
|
|
25657
|
+
}
|
|
25658
|
+
}
|
|
25659
|
+
return file;
|
|
25660
|
+
})
|
|
25661
|
+
);
|
|
25646
25662
|
const placeholders = filesArray.map((_, i2) => ({
|
|
25647
25663
|
type: "placeholder",
|
|
25648
25664
|
key: `placeholder-${Date.now()}-${i2}`
|
|
@@ -32435,7 +32451,7 @@ const MentionList = forwardRef((props, ref) => {
|
|
|
32435
32451
|
});
|
|
32436
32452
|
MentionList.displayName = "MentionList";
|
|
32437
32453
|
const isReactNativeWebView = () => typeof window !== "undefined" && window.ReactNativeWebView !== void 0;
|
|
32438
|
-
const mentionService = (api, mfs, store) => {
|
|
32454
|
+
const mentionService = (api, mfs, store, user) => {
|
|
32439
32455
|
const fetchMentions = async () => {
|
|
32440
32456
|
const params = store.getState().getMentionParams();
|
|
32441
32457
|
if (!params) {
|
|
@@ -32443,7 +32459,7 @@ const mentionService = (api, mfs, store) => {
|
|
|
32443
32459
|
}
|
|
32444
32460
|
const { groupId, postId } = params;
|
|
32445
32461
|
const response = postId ? await mfs.getRecommendationPost(groupId, postId, 0, 999) : await mfs.getRecommendationGroup(groupId, 0, 999);
|
|
32446
|
-
|
|
32462
|
+
const apiResults = response.entries?.filter((item) => Boolean(item?.user_data))?.map(
|
|
32447
32463
|
(item) => ({
|
|
32448
32464
|
id: item?.user_data?.id,
|
|
32449
32465
|
label: item?.user_data?.name,
|
|
@@ -32454,7 +32470,22 @@ const mentionService = (api, mfs, store) => {
|
|
|
32454
32470
|
type: MentionType.User,
|
|
32455
32471
|
from: PostType.Post
|
|
32456
32472
|
})
|
|
32457
|
-
);
|
|
32473
|
+
) ?? [];
|
|
32474
|
+
if (user) {
|
|
32475
|
+
const loggedInUserMention = {
|
|
32476
|
+
id: user.id,
|
|
32477
|
+
label: user.name,
|
|
32478
|
+
avatar: user.avatar,
|
|
32479
|
+
inThisThread: 1,
|
|
32480
|
+
name: user.name,
|
|
32481
|
+
selectId: user.username,
|
|
32482
|
+
type: MentionType.User,
|
|
32483
|
+
from: PostType.Post
|
|
32484
|
+
};
|
|
32485
|
+
const filteredResults = apiResults.filter((item) => item.id !== user.id);
|
|
32486
|
+
return [loggedInUserMention, ...filteredResults];
|
|
32487
|
+
}
|
|
32488
|
+
return apiResults;
|
|
32458
32489
|
};
|
|
32459
32490
|
const fetchHashtags = async () => {
|
|
32460
32491
|
const { selectedGroupId, groupId } = store.getState();
|
|
@@ -32526,8 +32557,8 @@ function createSuggestion(char, fetchItems) {
|
|
|
32526
32557
|
}
|
|
32527
32558
|
};
|
|
32528
32559
|
}
|
|
32529
|
-
const configureMentionExtension = (api, mfs, store) => {
|
|
32530
|
-
const service = mentionService(api, mfs, store);
|
|
32560
|
+
const configureMentionExtension = (api, mfs, store, user) => {
|
|
32561
|
+
const service = mentionService(api, mfs, store, user);
|
|
32531
32562
|
return Mention.configure({
|
|
32532
32563
|
HTMLAttributes: {
|
|
32533
32564
|
class: "inline-block px-1.5 py-0.5 rounded font-medium no-underline cursor-pointer transition-all duration-200"
|
|
@@ -33268,7 +33299,7 @@ const getPlaceholderExtension = (placeholder) => Placeholder.configure({
|
|
|
33268
33299
|
// emptyEditorClass:
|
|
33269
33300
|
// 'first:before:content-[attr(data-placeholder)] before:text-muted-foreground before:float-left before:h-0 before:pointer-events-none',
|
|
33270
33301
|
});
|
|
33271
|
-
const getMentionExtension = (core, mfs, store) => configureMentionExtension(core, mfs, store);
|
|
33302
|
+
const getMentionExtension = (core, mfs, store, user) => configureMentionExtension(core, mfs, store, user);
|
|
33272
33303
|
const getExtensions = ({ editorType, api, store, user }) => {
|
|
33273
33304
|
const extensionMap = {
|
|
33274
33305
|
[EditorTypes.Blog]: getDefaultExtensions,
|
|
@@ -33300,12 +33331,12 @@ const getDefaultExtensions = ({ api, store, user }) => {
|
|
|
33300
33331
|
api: core
|
|
33301
33332
|
}),
|
|
33302
33333
|
LinkPreview,
|
|
33303
|
-
getMentionExtension(core, mfs, store),
|
|
33334
|
+
getMentionExtension(core, mfs, store, user),
|
|
33304
33335
|
SmartMediaUpload.configure({ api: fileStore }),
|
|
33305
33336
|
SmartLinkPaste.configure({ api: core })
|
|
33306
33337
|
];
|
|
33307
33338
|
};
|
|
33308
|
-
const getPollExtensions = ({ api, store }) => {
|
|
33339
|
+
const getPollExtensions = ({ api, store, user }) => {
|
|
33309
33340
|
const { core, mfs } = api;
|
|
33310
33341
|
return [
|
|
33311
33342
|
PollDoc,
|
|
@@ -33316,7 +33347,7 @@ const getPollExtensions = ({ api, store }) => {
|
|
|
33316
33347
|
getPlaceholderExtension("Ask a Question"),
|
|
33317
33348
|
EnterHardBreak,
|
|
33318
33349
|
Poll,
|
|
33319
|
-
getMentionExtension(core, mfs, store)
|
|
33350
|
+
getMentionExtension(core, mfs, store, user)
|
|
33320
33351
|
];
|
|
33321
33352
|
};
|
|
33322
33353
|
const getMediaExtensions = ({ api, store, user }) => {
|
|
@@ -33344,7 +33375,7 @@ const getMediaExtensions = ({ api, store, user }) => {
|
|
|
33344
33375
|
// selectable: false,
|
|
33345
33376
|
draggable: false
|
|
33346
33377
|
}),
|
|
33347
|
-
getMentionExtension(core, mfs, store),
|
|
33378
|
+
getMentionExtension(core, mfs, store, user),
|
|
33348
33379
|
SmartMediaUpload.configure({ api: fileStore }),
|
|
33349
33380
|
SmartLinkPaste.configure({ api: core, autoEmbed: false, autoLinkSelection: false })
|
|
33350
33381
|
];
|
|
@@ -33611,7 +33642,8 @@ const PostBuilderEditorInstance = ({
|
|
|
33611
33642
|
clearOnSuccess,
|
|
33612
33643
|
onCreatePost,
|
|
33613
33644
|
className,
|
|
33614
|
-
store
|
|
33645
|
+
store,
|
|
33646
|
+
placement
|
|
33615
33647
|
}) => {
|
|
33616
33648
|
const [isDragging, setIsDragging] = useState(false);
|
|
33617
33649
|
const { trackPublish } = useAnalyticsTracking();
|
|
@@ -33677,11 +33709,12 @@ const PostBuilderEditorInstance = ({
|
|
|
33677
33709
|
"div",
|
|
33678
33710
|
{
|
|
33679
33711
|
className: cn(
|
|
33680
|
-
"post-builder-editor bg-background border rounded-md overflow-hidden
|
|
33712
|
+
"post-builder-editor bg-background border rounded-md overflow-hidden max-h-full grow flex flex-col overflow-y-auto transition-all duration-300 ease-in-out",
|
|
33713
|
+
placement === EditorPlacement.Comment ? "min-h-32" : "min-h-60",
|
|
33681
33714
|
className
|
|
33682
33715
|
),
|
|
33683
33716
|
children: [
|
|
33684
|
-
/* @__PURE__ */ jsx(EditorTypeTabs, { editorTab, onSwitchEditorTab: onSwitchEditor }),
|
|
33717
|
+
placement !== EditorPlacement.Comment && /* @__PURE__ */ jsx(EditorTypeTabs, { editorTab, onSwitchEditorTab: onSwitchEditor }),
|
|
33685
33718
|
/* @__PURE__ */ jsx(
|
|
33686
33719
|
Toolbar,
|
|
33687
33720
|
{
|
|
@@ -33735,6 +33768,8 @@ const PostBuilderEditorInstanceWithDialog = ({
|
|
|
33735
33768
|
hideGroupSelector,
|
|
33736
33769
|
open,
|
|
33737
33770
|
onOpenChange,
|
|
33771
|
+
onGroupSelect,
|
|
33772
|
+
placement,
|
|
33738
33773
|
...rest
|
|
33739
33774
|
}) => {
|
|
33740
33775
|
const { trackAbandon } = useAnalyticsTracking();
|
|
@@ -33758,11 +33793,11 @@ const PostBuilderEditorInstanceWithDialog = ({
|
|
|
33758
33793
|
/* @__PURE__ */ jsxs(DialogHeader, { children: [
|
|
33759
33794
|
/* @__PURE__ */ jsx(DialogTitle, { className: "sr-only", children: "Post Builder Modal" }),
|
|
33760
33795
|
!hideGroupSelector && /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-3", children: [
|
|
33761
|
-
/* @__PURE__ */ jsx(GroupSelector, { user, store }),
|
|
33796
|
+
/* @__PURE__ */ jsx(GroupSelector, { user, store, onGroupSelect }),
|
|
33762
33797
|
/* @__PURE__ */ jsx(DialogClose, { asChild: true, children: /* @__PURE__ */ jsx(Button, { variant: "outline", size: "icon", children: /* @__PURE__ */ jsx(X, {}) }) })
|
|
33763
33798
|
] })
|
|
33764
33799
|
] }),
|
|
33765
|
-
/* @__PURE__ */ jsx(PostBuilderEditorInstance, { ...rest, store })
|
|
33800
|
+
/* @__PURE__ */ jsx(PostBuilderEditorInstance, { ...rest, store, placement })
|
|
33766
33801
|
]
|
|
33767
33802
|
}
|
|
33768
33803
|
) });
|
|
@@ -33831,7 +33866,8 @@ const PostBuilderEditor = ({
|
|
|
33831
33866
|
openModal,
|
|
33832
33867
|
onModalOpenChange,
|
|
33833
33868
|
isSubmitting,
|
|
33834
|
-
onCreatePost
|
|
33869
|
+
onCreatePost,
|
|
33870
|
+
onGroupSelect
|
|
33835
33871
|
}) => {
|
|
33836
33872
|
const [editorTab, setEditorTab] = useState(EditorTypes.Media);
|
|
33837
33873
|
const [sessionId, setSessionId] = useState("");
|
|
@@ -33887,7 +33923,7 @@ const PostBuilderEditor = ({
|
|
|
33887
33923
|
/* @__PURE__ */ jsx(EditorContext.Provider, { value: providerValue, children: openModal ? /* @__PURE__ */ jsx(
|
|
33888
33924
|
PostBuilderEditorInstanceWithDialog,
|
|
33889
33925
|
{
|
|
33890
|
-
placement
|
|
33926
|
+
placement,
|
|
33891
33927
|
hideGroupSelector,
|
|
33892
33928
|
user,
|
|
33893
33929
|
editor,
|
|
@@ -33899,10 +33935,11 @@ const PostBuilderEditor = ({
|
|
|
33899
33935
|
onOpenChange: onModalOpenChange,
|
|
33900
33936
|
onCreatePost,
|
|
33901
33937
|
isSubmitting,
|
|
33902
|
-
clearOnSuccess
|
|
33938
|
+
clearOnSuccess,
|
|
33939
|
+
onGroupSelect
|
|
33903
33940
|
}
|
|
33904
33941
|
) : /* @__PURE__ */ jsxs("div", { className: "prose-blockquote: flex-1 flex flex-col space-y-3 max-w-full max-h-[calc(100dvh-7rem)]", children: [
|
|
33905
|
-
!hideGroupSelector && /* @__PURE__ */ jsx(GroupSelector, { user, store }),
|
|
33942
|
+
!hideGroupSelector && /* @__PURE__ */ jsx(GroupSelector, { user, store, onGroupSelect }),
|
|
33906
33943
|
/* @__PURE__ */ jsx(
|
|
33907
33944
|
PostBuilderEditorInstance,
|
|
33908
33945
|
{
|
|
@@ -33913,7 +33950,8 @@ const PostBuilderEditor = ({
|
|
|
33913
33950
|
store,
|
|
33914
33951
|
isSubmitting,
|
|
33915
33952
|
onCreatePost,
|
|
33916
|
-
clearOnSuccess
|
|
33953
|
+
clearOnSuccess,
|
|
33954
|
+
placement
|
|
33917
33955
|
}
|
|
33918
33956
|
)
|
|
33919
33957
|
] }) }),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@select-org/select-post-builder",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.26",
|
|
4
4
|
"description": "A reusable, extensible Post Builder widget for the Select platform and beyond.",
|
|
5
5
|
"main": "./dist/post-builder.cjs.js",
|
|
6
6
|
"module": "./dist/post-builder.js",
|