@select-org/select-post-builder 1.1.48 → 1.1.49

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 CHANGED
@@ -75,6 +75,12 @@ declare type BaseProps = {
75
75
  disableNavigationWarning?: boolean;
76
76
  /** Tiptap JSONContent to pre-populate the editor with (takes precedence over localStorage draft) */
77
77
  initialContent?: JSONContent;
78
+ /**
79
+ * Initial tab to land on when the editor first mounts. Applied on first mount
80
+ * only — subsequent prop changes are ignored. Same semantics as `initialContent`.
81
+ * Default: `EditorTypes.Media`.
82
+ */
83
+ initialTab?: EditorTypes;
78
84
  /** When true, the submit/post button in the toolbar is hidden */
79
85
  hideSubmitButton?: boolean;
80
86
  /** Fires when the user switches between editor tabs (Media, Blog, Poll) */
@@ -102,6 +108,11 @@ declare type CreatePostCallbackPayload = {
102
108
  }>;
103
109
  };
104
110
 
111
+ export declare interface DraftRehydrateRequestDetail {
112
+ groupId: string;
113
+ editorType?: EditorTypes;
114
+ }
115
+
105
116
  export declare enum EditorPlacement {
106
117
  Feed = "Feed",
107
118
  Modal = "Modal",
@@ -116,6 +127,18 @@ export declare enum EditorTypes {
116
127
  Poll = "Poll"
117
128
  }
118
129
 
130
+ /**
131
+ * Ensures a poll has at least two choices. The feed renderer requires >=2 to
132
+ * display a poll. When given exactly one choice, returns a two-element array
133
+ * by duplicating the choice with a fresh `option_id` and the appropriate
134
+ * `option_color`. When given zero or >=2, returns the input untouched.
135
+ *
136
+ * Used by `generatePollPostPayload` for fresh sends and by the host's resend
137
+ * path so that a failed-then-stripped poll draft (which can collapse to a
138
+ * single hosted item) still produces a renderable post.
139
+ */
140
+ export declare const ensurePollMinimum: (items: PollChoiceItem[]) => PollChoiceItem[];
141
+
119
142
  declare interface ImageInfo {
120
143
  width: number;
121
144
  height: number;
@@ -220,7 +243,8 @@ export declare enum PostBuilderEvents {
220
243
  POST_PUBLISH_ATTEMPTED = "select:post_publish_attempted",
221
244
  POST_PUBLISH_SUCCESSFUL = "select:post_publish_success",
222
245
  POST_PUBLISH_FAILED = "select:post_publish_failed",
223
- POST_SESSION_ROTATED = "select:post_session_rotated"
246
+ POST_SESSION_ROTATED = "select:post_session_rotated",
247
+ DRAFT_REHYDRATE_REQUEST = "select:draft_rehydrate_request"
224
248
  }
225
249
 
226
250
  declare interface PostBuilderI18nKeys {
@@ -415,14 +439,27 @@ declare module '@tiptap/core' {
415
439
 
416
440
  declare module '@tiptap/core' {
417
441
  interface Commands<ReturnType> {
418
- smartMediaUpload: {
419
- insertMediaWithUpload: (params: {
420
- source: File | Blob | string;
421
- type: MediaNodeTypes;
422
- mediaType?: MediaItemType;
423
- caption?: string;
424
- searchFrom?: ImageSearchFrom;
425
- }) => ReturnType;
442
+ customLink: {
443
+ /**
444
+ * Insert a new link mark with preview
445
+ */
446
+ insertLink: (attrs: LinkMarkAttrs) => ReturnType;
447
+ /**
448
+ * Update an existing link mark with its preview
449
+ */
450
+ updateLink: (uid: string, attrs: Partial<Omit<LinkMarkAttrs, 'uid'>>) => ReturnType;
451
+ /**
452
+ * Update media node attributes by uid
453
+ */
454
+ updateLinkByUid: (uid: string, attrs: Partial<LinkMarkAttrs>) => ReturnType;
455
+ /**
456
+ * Delete link preview node by uid
457
+ */
458
+ deleteLinkByUid: (uid: string) => ReturnType;
459
+ /**
460
+ * Re-run unfurl resolution for existing links after content rehydration.
461
+ */
462
+ rehydrateLinkPreviews: () => ReturnType;
426
463
  };
427
464
  }
428
465
  }
@@ -444,6 +481,21 @@ declare module '@tiptap/core' {
444
481
  }
445
482
 
446
483
 
484
+ declare module '@tiptap/core' {
485
+ interface Commands<ReturnType> {
486
+ smartMediaUpload: {
487
+ insertMediaWithUpload: (params: {
488
+ source: File | Blob | string;
489
+ type: MediaNodeTypes;
490
+ mediaType?: MediaItemType;
491
+ caption?: string;
492
+ searchFrom?: ImageSearchFrom;
493
+ }) => ReturnType;
494
+ };
495
+ }
496
+ }
497
+
498
+
447
499
  declare module '@tiptap/core' {
448
500
  interface Commands<ReturnType> {
449
501
  linkPreview: {
@@ -471,31 +523,3 @@ declare module '@tiptap/core' {
471
523
  };
472
524
  }
473
525
  }
474
-
475
-
476
- declare module '@tiptap/core' {
477
- interface Commands<ReturnType> {
478
- customLink: {
479
- /**
480
- * Insert a new link mark with preview
481
- */
482
- insertLink: (attrs: LinkMarkAttrs) => ReturnType;
483
- /**
484
- * Update an existing link mark with its preview
485
- */
486
- updateLink: (uid: string, attrs: Partial<Omit<LinkMarkAttrs, 'uid'>>) => ReturnType;
487
- /**
488
- * Update media node attributes by uid
489
- */
490
- updateLinkByUid: (uid: string, attrs: Partial<LinkMarkAttrs>) => ReturnType;
491
- /**
492
- * Delete link preview node by uid
493
- */
494
- deleteLinkByUid: (uid: string) => ReturnType;
495
- /**
496
- * Re-run unfurl resolution for existing links after content rehydration.
497
- */
498
- rehydrateLinkPreviews: () => ReturnType;
499
- };
500
- }
501
- }