@select-org/select-post-builder 1.1.59 → 1.2.6
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 +69 -24
- package/dist/post-builder.cjs.js +23 -23
- package/dist/post-builder.css +1 -1
- package/dist/post-builder.js +4988 -4742
- 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`.
|
|
@@ -112,16 +122,20 @@ declare type CreatePostCallbackPayload = {
|
|
|
112
122
|
json: JSONContent;
|
|
113
123
|
text: string;
|
|
114
124
|
/**
|
|
115
|
-
* Per-item upload state for
|
|
116
|
-
* `allowSendWhileUploading` is on
|
|
117
|
-
* submit time. Each entry
|
|
118
|
-
*
|
|
119
|
-
*
|
|
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`.
|
|
120
134
|
*/
|
|
121
135
|
pendingUploads?: Map<string, {
|
|
122
136
|
blob: File | Blob;
|
|
123
|
-
promise
|
|
124
|
-
abort
|
|
137
|
+
promise?: Promise<PostCreationMediaItem | PollPostMediaOptionItem>;
|
|
138
|
+
abort?: () => void;
|
|
125
139
|
}>;
|
|
126
140
|
};
|
|
127
141
|
|
|
@@ -233,6 +247,20 @@ export declare interface PostBuilderConfig {
|
|
|
233
247
|
* are unaffected.
|
|
234
248
|
*/
|
|
235
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;
|
|
236
264
|
}
|
|
237
265
|
|
|
238
266
|
export declare interface PostBuilderControls {
|
|
@@ -250,6 +278,12 @@ export declare interface PostBuilderControls {
|
|
|
250
278
|
} | null;
|
|
251
279
|
/** Clear editor content and localStorage draft */
|
|
252
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;
|
|
253
287
|
}
|
|
254
288
|
|
|
255
289
|
export declare const PostBuilderEditor: FC<PostBuilderEditorProps>;
|
|
@@ -329,7 +363,7 @@ declare interface PostBuilderI18nKeys {
|
|
|
329
363
|
uploadsInProgressKey: string;
|
|
330
364
|
}
|
|
331
365
|
|
|
332
|
-
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;
|
|
333
367
|
|
|
334
368
|
declare type PostCreationData = {
|
|
335
369
|
body: string;
|
|
@@ -498,22 +532,6 @@ declare module '@tiptap/core' {
|
|
|
498
532
|
}
|
|
499
533
|
|
|
500
534
|
|
|
501
|
-
declare module '@tiptap/core' {
|
|
502
|
-
interface Commands<ReturnType> {
|
|
503
|
-
iframe: {
|
|
504
|
-
/**
|
|
505
|
-
* Insert an iframe node into the document
|
|
506
|
-
*/
|
|
507
|
-
setIframe: (options: {
|
|
508
|
-
src: string;
|
|
509
|
-
width?: string;
|
|
510
|
-
height?: string;
|
|
511
|
-
}) => ReturnType;
|
|
512
|
-
};
|
|
513
|
-
}
|
|
514
|
-
}
|
|
515
|
-
|
|
516
|
-
|
|
517
535
|
declare module '@tiptap/core' {
|
|
518
536
|
interface Commands<ReturnType> {
|
|
519
537
|
smartMediaUpload: {
|
|
@@ -524,6 +542,17 @@ declare module '@tiptap/core' {
|
|
|
524
542
|
caption?: string;
|
|
525
543
|
searchFrom?: ImageSearchFrom;
|
|
526
544
|
}) => ReturnType;
|
|
545
|
+
/**
|
|
546
|
+
* Re-enqueue uploads for media nodes attached while unauthenticated
|
|
547
|
+
* (`attrs.deferred === true`). Map key = node uid; value = the raw
|
|
548
|
+
* File/Blob for file-kind nodes, which the host persists from
|
|
549
|
+
* `pendingUploads` across the auth redirect. URL-kind deferred nodes are
|
|
550
|
+
* NOT surfaced via `pendingUploads` (getPendingUpload requires a blob) —
|
|
551
|
+
* their remote URL rides in the doc JSON on `attrs.src`, so the host
|
|
552
|
+
* supplies that string here from the persisted node. Nodes with no entry
|
|
553
|
+
* in the map are deleted (bytes unrecoverable — the host toasts separately).
|
|
554
|
+
*/
|
|
555
|
+
resumeDeferredUploads: (media: Map<string, File | Blob | string>) => ReturnType;
|
|
527
556
|
};
|
|
528
557
|
}
|
|
529
558
|
}
|
|
@@ -562,3 +591,19 @@ declare module '@tiptap/core' {
|
|
|
562
591
|
};
|
|
563
592
|
}
|
|
564
593
|
}
|
|
594
|
+
|
|
595
|
+
|
|
596
|
+
declare module '@tiptap/core' {
|
|
597
|
+
interface Commands<ReturnType> {
|
|
598
|
+
iframe: {
|
|
599
|
+
/**
|
|
600
|
+
* Insert an iframe node into the document
|
|
601
|
+
*/
|
|
602
|
+
setIframe: (options: {
|
|
603
|
+
src: string;
|
|
604
|
+
width?: string;
|
|
605
|
+
height?: string;
|
|
606
|
+
}) => ReturnType;
|
|
607
|
+
};
|
|
608
|
+
}
|
|
609
|
+
}
|