@select-org/select-post-builder 1.1.47 → 1.1.48
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 +64 -29
- package/dist/post-builder.cjs.js +47 -47
- package/dist/post-builder.js +76 -2
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -4,6 +4,21 @@ import { JSONContent as JSONContent_2 } from '@tiptap/core';
|
|
|
4
4
|
import { JSX as JSX_2 } from 'react/jsx-runtime';
|
|
5
5
|
import { ReactNode } from 'react';
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* Walks the editor JSON and updates the media node whose `attrs.uid === itemKey`
|
|
9
|
+
* with the hosted URL + payload from a resolved upload result. Returns a new
|
|
10
|
+
* doc; never mutates the input. If no matching node is found, returns the input.
|
|
11
|
+
*/
|
|
12
|
+
export declare function applyResolvedMediaItem(jsonBody: JSONContent_2 | undefined, itemKey: string, resolvedItem: ResolvedMediaItem): JSONContent_2 | undefined;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Walks a serialized htmlBody string, finds the `[data-media][data-uid=itemKey]`
|
|
16
|
+
* wrapper and rewrites it to point at the hosted URL + payload from a resolved
|
|
17
|
+
* upload result. Mirrors `applyResolvedMediaItem` for the JSON form. If no
|
|
18
|
+
* matching node is found, returns the input unchanged.
|
|
19
|
+
*/
|
|
20
|
+
export declare function applyResolvedMediaItemToHtml(html: string | undefined, itemKey: string, resolvedItem: ResolvedMediaItem_2): string | undefined;
|
|
21
|
+
|
|
7
22
|
declare type AppUserPayload = {
|
|
8
23
|
background: string;
|
|
9
24
|
username: string;
|
|
@@ -321,11 +336,31 @@ export declare type PublishEventDetails = {
|
|
|
321
336
|
failureReason?: string;
|
|
322
337
|
};
|
|
323
338
|
|
|
339
|
+
declare type ResolvedMediaItem = PostCreationMediaItem | PollPostMediaOptionItem;
|
|
340
|
+
|
|
341
|
+
declare type ResolvedMediaItem_2 = PostCreationMediaItem | PollPostMediaOptionItem;
|
|
342
|
+
|
|
324
343
|
declare enum SpecialType {
|
|
325
344
|
POST = 0,
|
|
326
345
|
FEATURED_POST = 1
|
|
327
346
|
}
|
|
328
347
|
|
|
348
|
+
/**
|
|
349
|
+
* Walks a serialized htmlBody string and removes media wrappers whose upload
|
|
350
|
+
* did not complete (data-src missing or blob:-prefixed). Empty
|
|
351
|
+
* `[data-media-group]` wrappers left behind are also removed. Mirrors
|
|
352
|
+
* `stripPendingMediaFromJsonBody` for the JSON form.
|
|
353
|
+
*/
|
|
354
|
+
export declare function stripPendingMediaFromHtml(html: string | undefined): string | undefined;
|
|
355
|
+
|
|
356
|
+
/**
|
|
357
|
+
* Walks the editor JSON and removes media nodes whose upload did not complete
|
|
358
|
+
* (uploading: true OR src starts with 'blob:'). Also removes empty mediaGroup
|
|
359
|
+
* wrappers left behind. Used by failure / boot-GC paths to keep stripped drafts
|
|
360
|
+
* consistent with the items[] array.
|
|
361
|
+
*/
|
|
362
|
+
export declare function stripPendingMediaFromJsonBody(jsonBody: JSONContent_2 | undefined): JSONContent_2 | undefined;
|
|
363
|
+
|
|
329
364
|
declare type WithModalProps = BaseProps & {
|
|
330
365
|
openModal: boolean;
|
|
331
366
|
onModalOpenChange: (open: boolean) => void;
|
|
@@ -380,27 +415,14 @@ declare module '@tiptap/core' {
|
|
|
380
415
|
|
|
381
416
|
declare module '@tiptap/core' {
|
|
382
417
|
interface Commands<ReturnType> {
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
updateLink: (uid: string, attrs: Partial<Omit<LinkMarkAttrs, 'uid'>>) => ReturnType;
|
|
392
|
-
/**
|
|
393
|
-
* Update media node attributes by uid
|
|
394
|
-
*/
|
|
395
|
-
updateLinkByUid: (uid: string, attrs: Partial<LinkMarkAttrs>) => ReturnType;
|
|
396
|
-
/**
|
|
397
|
-
* Delete link preview node by uid
|
|
398
|
-
*/
|
|
399
|
-
deleteLinkByUid: (uid: string) => ReturnType;
|
|
400
|
-
/**
|
|
401
|
-
* Re-run unfurl resolution for existing links after content rehydration.
|
|
402
|
-
*/
|
|
403
|
-
rehydrateLinkPreviews: () => 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;
|
|
404
426
|
};
|
|
405
427
|
}
|
|
406
428
|
}
|
|
@@ -453,14 +475,27 @@ declare module '@tiptap/core' {
|
|
|
453
475
|
|
|
454
476
|
declare module '@tiptap/core' {
|
|
455
477
|
interface Commands<ReturnType> {
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
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;
|
|
464
499
|
};
|
|
465
500
|
}
|
|
466
501
|
}
|