@select-org/select-post-builder 1.1.1 → 1.1.2
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 +16 -16
- package/dist/post-builder.cjs.js +11 -2
- package/dist/post-builder.js +11 -2
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -221,6 +221,22 @@ declare module '@tiptap/core' {
|
|
|
221
221
|
}
|
|
222
222
|
|
|
223
223
|
|
|
224
|
+
declare module '@tiptap/core' {
|
|
225
|
+
interface Commands<ReturnType> {
|
|
226
|
+
iframe: {
|
|
227
|
+
/**
|
|
228
|
+
* Insert an iframe node into the document
|
|
229
|
+
*/
|
|
230
|
+
setIframe: (options: {
|
|
231
|
+
src: string;
|
|
232
|
+
width?: string;
|
|
233
|
+
height?: string;
|
|
234
|
+
}) => ReturnType;
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
|
|
224
240
|
declare module '@tiptap/core' {
|
|
225
241
|
interface Commands<ReturnType> {
|
|
226
242
|
media: {
|
|
@@ -245,22 +261,6 @@ declare module '@tiptap/core' {
|
|
|
245
261
|
}
|
|
246
262
|
|
|
247
263
|
|
|
248
|
-
declare module '@tiptap/core' {
|
|
249
|
-
interface Commands<ReturnType> {
|
|
250
|
-
iframe: {
|
|
251
|
-
/**
|
|
252
|
-
* Insert an iframe node into the document
|
|
253
|
-
*/
|
|
254
|
-
setIframe: (options: {
|
|
255
|
-
src: string;
|
|
256
|
-
width?: string;
|
|
257
|
-
height?: string;
|
|
258
|
-
}) => ReturnType;
|
|
259
|
-
};
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
|
|
264
264
|
declare module '@tiptap/core' {
|
|
265
265
|
interface Commands<ReturnType> {
|
|
266
266
|
smartMediaUpload: {
|
package/dist/post-builder.cjs.js
CHANGED
|
@@ -30761,6 +30761,15 @@ const getPollItemsPayload = (json) => {
|
|
|
30761
30761
|
const items = poll[0].attrs?.choices;
|
|
30762
30762
|
return { items };
|
|
30763
30763
|
};
|
|
30764
|
+
const isValidItem = (item) => {
|
|
30765
|
+
if (!item) return false;
|
|
30766
|
+
const linkItem = item;
|
|
30767
|
+
const mediaItem = item;
|
|
30768
|
+
const isValidLinkItem = linkItem?.linkUrl;
|
|
30769
|
+
const mediaItemSources = mediaItem?.sources;
|
|
30770
|
+
const isValidMediaItem = mediaItemSources?.original?.url || mediaItemSources?.thumbnail?.url || mediaItemSources?.placeholder?.url;
|
|
30771
|
+
return Boolean(isValidLinkItem || isValidMediaItem);
|
|
30772
|
+
};
|
|
30764
30773
|
const generateHtmlPostPayload = ({
|
|
30765
30774
|
editor,
|
|
30766
30775
|
sendCrossMention
|
|
@@ -30777,13 +30786,13 @@ const generateHtmlPostPayload = ({
|
|
|
30777
30786
|
(node) => node?.type === "text" && (node?.marks?.some((val) => val?.type !== "customLink") ?? true)
|
|
30778
30787
|
)?.at(0);
|
|
30779
30788
|
const isEmbedOnly = isOnlyContentNode(json, "iframe");
|
|
30780
|
-
const body = isEmbedOnly ? previewItemEmbed?.attrs?.previewPayload?.linkTitle ?? "" : secondaryText?.text ?? firstText?.text ?? "";
|
|
30789
|
+
const body = isEmbedOnly ? previewItemEmbed?.attrs?.previewPayload?.linkTitle ?? previewItemEmbed?.attrs?.src ?? "" : secondaryText?.text ?? firstText?.text ?? "";
|
|
30781
30790
|
console.log({ firstText });
|
|
30782
30791
|
const items = [
|
|
30783
30792
|
previewItemMedia?.attrs?.payload,
|
|
30784
30793
|
previewItemEmbed?.attrs?.previewPayload,
|
|
30785
30794
|
linkPreviewItem
|
|
30786
|
-
]?.filter(
|
|
30795
|
+
]?.filter(isValidItem)?.filter((_, index2) => index2 === 0);
|
|
30787
30796
|
const htmlBody = html2;
|
|
30788
30797
|
return {
|
|
30789
30798
|
...commons,
|
package/dist/post-builder.js
CHANGED
|
@@ -30731,6 +30731,15 @@ const getPollItemsPayload = (json) => {
|
|
|
30731
30731
|
const items = poll[0].attrs?.choices;
|
|
30732
30732
|
return { items };
|
|
30733
30733
|
};
|
|
30734
|
+
const isValidItem = (item) => {
|
|
30735
|
+
if (!item) return false;
|
|
30736
|
+
const linkItem = item;
|
|
30737
|
+
const mediaItem = item;
|
|
30738
|
+
const isValidLinkItem = linkItem?.linkUrl;
|
|
30739
|
+
const mediaItemSources = mediaItem?.sources;
|
|
30740
|
+
const isValidMediaItem = mediaItemSources?.original?.url || mediaItemSources?.thumbnail?.url || mediaItemSources?.placeholder?.url;
|
|
30741
|
+
return Boolean(isValidLinkItem || isValidMediaItem);
|
|
30742
|
+
};
|
|
30734
30743
|
const generateHtmlPostPayload = ({
|
|
30735
30744
|
editor,
|
|
30736
30745
|
sendCrossMention
|
|
@@ -30747,13 +30756,13 @@ const generateHtmlPostPayload = ({
|
|
|
30747
30756
|
(node) => node?.type === "text" && (node?.marks?.some((val) => val?.type !== "customLink") ?? true)
|
|
30748
30757
|
)?.at(0);
|
|
30749
30758
|
const isEmbedOnly = isOnlyContentNode(json, "iframe");
|
|
30750
|
-
const body = isEmbedOnly ? previewItemEmbed?.attrs?.previewPayload?.linkTitle ?? "" : secondaryText?.text ?? firstText?.text ?? "";
|
|
30759
|
+
const body = isEmbedOnly ? previewItemEmbed?.attrs?.previewPayload?.linkTitle ?? previewItemEmbed?.attrs?.src ?? "" : secondaryText?.text ?? firstText?.text ?? "";
|
|
30751
30760
|
console.log({ firstText });
|
|
30752
30761
|
const items = [
|
|
30753
30762
|
previewItemMedia?.attrs?.payload,
|
|
30754
30763
|
previewItemEmbed?.attrs?.previewPayload,
|
|
30755
30764
|
linkPreviewItem
|
|
30756
|
-
]?.filter(
|
|
30765
|
+
]?.filter(isValidItem)?.filter((_, index2) => index2 === 0);
|
|
30757
30766
|
const htmlBody = html2;
|
|
30758
30767
|
return {
|
|
30759
30768
|
...commons,
|
package/package.json
CHANGED