@select-org/select-post-builder 1.1.57 → 1.2.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 +75 -23
- package/dist/post-builder.cjs.js +27 -27
- package/dist/post-builder.css +1 -1
- package/dist/post-builder.js +5658 -5409
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -85,6 +85,16 @@ declare type BaseProps = {
|
|
|
85
85
|
disableNavigationWarning?: boolean;
|
|
86
86
|
/** Tiptap JSONContent to pre-populate the editor with (takes precedence over localStorage draft) */
|
|
87
87
|
initialContent?: JSONContent;
|
|
88
|
+
/**
|
|
89
|
+
* Deferred media (uid → File/Blob/remote URL) to re-attach and upload once the
|
|
90
|
+
* editor is mounted with `initialContent` — used by a host restoring an
|
|
91
|
+
* unauthenticated composer after the auth round-trip. Resume runs per editor
|
|
92
|
+
* instance (not via one-shot `onReady`), so it lands on whichever instance is
|
|
93
|
+
* finally rendered even across the mount-time useEditor re-create. Nodes whose
|
|
94
|
+
* uid is absent from the map are dropped (bytes unrecoverable). Omit for all
|
|
95
|
+
* normal composing — it is then a no-op.
|
|
96
|
+
*/
|
|
97
|
+
resumeDeferredMedia?: Map<string, File | Blob | string>;
|
|
88
98
|
/**
|
|
89
99
|
* Initial tab to land on when the editor first mounts. Applied on first mount
|
|
90
100
|
* only — subsequent prop changes are ignored. Same semantics as `initialContent`.
|
|
@@ -95,6 +105,13 @@ declare type BaseProps = {
|
|
|
95
105
|
hideSubmitButton?: boolean;
|
|
96
106
|
/** Fires when the user switches between editor tabs (Media, Blog, Poll) */
|
|
97
107
|
onEditorTabChange?: (tab: EditorTypes) => void;
|
|
108
|
+
/**
|
|
109
|
+
* Optional override for the editor's empty-state placeholder text. When
|
|
110
|
+
* provided, replaces the default "What's on your mind, {name}" prompt so a
|
|
111
|
+
* host can show context-aware copy (e.g. "Send a private comment..." vs
|
|
112
|
+
* "Send a group comment..."). Omit to keep the default.
|
|
113
|
+
*/
|
|
114
|
+
placeholder?: string;
|
|
98
115
|
};
|
|
99
116
|
|
|
100
117
|
declare type CreatePostCallbackPayload = {
|
|
@@ -105,16 +122,20 @@ declare type CreatePostCallbackPayload = {
|
|
|
105
122
|
json: JSONContent;
|
|
106
123
|
text: string;
|
|
107
124
|
/**
|
|
108
|
-
* Per-item upload state for
|
|
109
|
-
* `allowSendWhileUploading` is on
|
|
110
|
-
* submit time. Each entry
|
|
111
|
-
*
|
|
112
|
-
*
|
|
125
|
+
* Per-item upload state for media the host may need to persist. Populated
|
|
126
|
+
* when `allowSendWhileUploading` is on OR `unauthenticatedMode` is on, for
|
|
127
|
+
* items with blob: URLs at submit time. Each entry always carries `blob`
|
|
128
|
+
* (the source File for host persistence). For in-flight uploads
|
|
129
|
+
* (allowSendWhileUploading), `promise` resolves to the final hosted item and
|
|
130
|
+
* `abort` cancels the underlying axios request. For deferred blobs
|
|
131
|
+
* (unauthenticatedMode) both `promise` and `abort` are undefined — the bytes
|
|
132
|
+
* were never uploaded; the host persists the blob and replays it after auth
|
|
133
|
+
* via `resumeDeferredUploads`.
|
|
113
134
|
*/
|
|
114
135
|
pendingUploads?: Map<string, {
|
|
115
136
|
blob: File | Blob;
|
|
116
|
-
promise
|
|
117
|
-
abort
|
|
137
|
+
promise?: Promise<PostCreationMediaItem | PollPostMediaOptionItem>;
|
|
138
|
+
abort?: () => void;
|
|
118
139
|
}>;
|
|
119
140
|
};
|
|
120
141
|
|
|
@@ -226,6 +247,20 @@ export declare interface PostBuilderConfig {
|
|
|
226
247
|
* are unaffected.
|
|
227
248
|
*/
|
|
228
249
|
allowSendWhileUploading?: boolean;
|
|
250
|
+
/**
|
|
251
|
+
* When true the host has no authenticated session. The editor:
|
|
252
|
+
* - defers media uploads (nodes keep local previews; no filestore calls),
|
|
253
|
+
* - surfaces those deferred blobs via `pendingUploads` at submit regardless
|
|
254
|
+
* of `allowSendWhileUploading`, so the host can persist and resume them
|
|
255
|
+
* after auth,
|
|
256
|
+
* - suppresses URL resolution (no link previews / iframe resolve — the
|
|
257
|
+
* /v1/url/resolve endpoint requires a JWT),
|
|
258
|
+
* - hides the voice, quick-GIF and media-search toolbar affordances.
|
|
259
|
+
* The flag is fixed at editor creation and baked into the extensions;
|
|
260
|
+
* changing it after mount requires remounting the editor to take effect.
|
|
261
|
+
* Defaults to false; existing consumers are unaffected.
|
|
262
|
+
*/
|
|
263
|
+
unauthenticatedMode?: boolean;
|
|
229
264
|
}
|
|
230
265
|
|
|
231
266
|
export declare interface PostBuilderControls {
|
|
@@ -243,6 +278,12 @@ export declare interface PostBuilderControls {
|
|
|
243
278
|
} | null;
|
|
244
279
|
/** Clear editor content and localStorage draft */
|
|
245
280
|
clearEditor: () => void;
|
|
281
|
+
/**
|
|
282
|
+
* Re-enqueue uploads for nodes attached while unauthenticated (deferred: true).
|
|
283
|
+
* Map key = node uid; value = raw File/Blob (file-kind) or remote URL string (url-kind).
|
|
284
|
+
* Nodes with no map entry are deleted (bytes unrecoverable).
|
|
285
|
+
*/
|
|
286
|
+
resumeDeferredUploads: (media: Map<string, File | Blob | string>) => void;
|
|
246
287
|
}
|
|
247
288
|
|
|
248
289
|
export declare const PostBuilderEditor: FC<PostBuilderEditorProps>;
|
|
@@ -322,7 +363,7 @@ declare interface PostBuilderI18nKeys {
|
|
|
322
363
|
uploadsInProgressKey: string;
|
|
323
364
|
}
|
|
324
365
|
|
|
325
|
-
export declare const PostBuilderProvider: ({ children, apiBaseURL, authToken, toI18N, i18nKeys, logEvent, allowSendWhileUploading, }: PostBuilderConfig) => JSX_2.Element;
|
|
366
|
+
export declare const PostBuilderProvider: ({ children, apiBaseURL, authToken, toI18N, i18nKeys, logEvent, allowSendWhileUploading, unauthenticatedMode, }: PostBuilderConfig) => JSX_2.Element;
|
|
326
367
|
|
|
327
368
|
declare type PostCreationData = {
|
|
328
369
|
body: string;
|
|
@@ -507,6 +548,32 @@ declare module '@tiptap/core' {
|
|
|
507
548
|
}
|
|
508
549
|
|
|
509
550
|
|
|
551
|
+
declare module '@tiptap/core' {
|
|
552
|
+
interface Commands<ReturnType> {
|
|
553
|
+
smartMediaUpload: {
|
|
554
|
+
insertMediaWithUpload: (params: {
|
|
555
|
+
source: File | Blob | string;
|
|
556
|
+
type: MediaNodeTypes;
|
|
557
|
+
mediaType?: MediaItemType;
|
|
558
|
+
caption?: string;
|
|
559
|
+
searchFrom?: ImageSearchFrom;
|
|
560
|
+
}) => ReturnType;
|
|
561
|
+
/**
|
|
562
|
+
* Re-enqueue uploads for media nodes attached while unauthenticated
|
|
563
|
+
* (`attrs.deferred === true`). Map key = node uid; value = the raw
|
|
564
|
+
* File/Blob for file-kind nodes, which the host persists from
|
|
565
|
+
* `pendingUploads` across the auth redirect. URL-kind deferred nodes are
|
|
566
|
+
* NOT surfaced via `pendingUploads` (getPendingUpload requires a blob) —
|
|
567
|
+
* their remote URL rides in the doc JSON on `attrs.src`, so the host
|
|
568
|
+
* supplies that string here from the persisted node. Nodes with no entry
|
|
569
|
+
* in the map are deleted (bytes unrecoverable — the host toasts separately).
|
|
570
|
+
*/
|
|
571
|
+
resumeDeferredUploads: (media: Map<string, File | Blob | string>) => ReturnType;
|
|
572
|
+
};
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
|
|
510
577
|
declare module '@tiptap/core' {
|
|
511
578
|
interface Commands<ReturnType> {
|
|
512
579
|
linkPreview: {
|
|
@@ -540,18 +607,3 @@ declare module '@tiptap/core' {
|
|
|
540
607
|
};
|
|
541
608
|
}
|
|
542
609
|
}
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
declare module '@tiptap/core' {
|
|
546
|
-
interface Commands<ReturnType> {
|
|
547
|
-
smartMediaUpload: {
|
|
548
|
-
insertMediaWithUpload: (params: {
|
|
549
|
-
source: File | Blob | string;
|
|
550
|
-
type: MediaNodeTypes;
|
|
551
|
-
mediaType?: MediaItemType;
|
|
552
|
-
caption?: string;
|
|
553
|
-
searchFrom?: ImageSearchFrom;
|
|
554
|
-
}) => ReturnType;
|
|
555
|
-
};
|
|
556
|
-
}
|
|
557
|
-
}
|