@select-org/select-post-builder 1.1.44 → 1.1.46

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
@@ -1,5 +1,6 @@
1
1
  import { FC } from 'react';
2
2
  import { JSONContent } from '@tiptap/react';
3
+ import { JSONContent as JSONContent_2 } from '@tiptap/core';
3
4
  import { JSX as JSX_2 } from 'react/jsx-runtime';
4
5
  import { ReactNode } from 'react';
5
6
 
@@ -52,6 +53,12 @@ declare type BaseProps = {
52
53
  onDirtyStateChange?: (isDirty: boolean) => void;
53
54
  onReady?: (controls: PostBuilderControls) => void;
54
55
  disableNavigationWarning?: boolean;
56
+ /** Tiptap JSONContent to pre-populate the editor with (takes precedence over localStorage draft) */
57
+ initialContent?: JSONContent;
58
+ /** When true, the submit/post button in the toolbar is hidden */
59
+ hideSubmitButton?: boolean;
60
+ /** Fires when the user switches between editor tabs (Media, Blog, Poll) */
61
+ onEditorTabChange?: (tab: EditorTypes) => void;
55
62
  };
56
63
 
57
64
  export declare enum EditorPlacement {
@@ -62,6 +69,12 @@ export declare enum EditorPlacement {
62
69
  Global = "Global"
63
70
  }
64
71
 
72
+ export declare enum EditorTypes {
73
+ Media = "Post",
74
+ Blog = "Blog",
75
+ Poll = "Poll"
76
+ }
77
+
65
78
  declare interface ImageInfo {
66
79
  width: number;
67
80
  height: number;
@@ -137,6 +150,17 @@ export declare interface PostBuilderControls {
137
150
  saveDraft: () => void;
138
151
  discardDraft: () => void;
139
152
  keepEditing: () => void;
153
+ /** Set editor content programmatically (e.g. pre-populate AI-generated text) */
154
+ setContent: (content: JSONContent_2) => void;
155
+ /** Extract current editor content without triggering submit */
156
+ getContent: () => {
157
+ html: string;
158
+ json: JSONContent_2;
159
+ text: string;
160
+ payload: Partial<PostCreationData>;
161
+ } | null;
162
+ /** Clear editor content and localStorage draft */
163
+ clearEditor: () => void;
140
164
  }
141
165
 
142
166
  export declare const PostBuilderEditor: FC<PostBuilderEditorProps>;
@@ -320,34 +344,6 @@ declare module '@tiptap/core' {
320
344
  }
321
345
 
322
346
 
323
- declare module '@tiptap/core' {
324
- interface Commands<ReturnType> {
325
- customLink: {
326
- /**
327
- * Insert a new link mark with preview
328
- */
329
- insertLink: (attrs: LinkMarkAttrs) => ReturnType;
330
- /**
331
- * Update an existing link mark with its preview
332
- */
333
- updateLink: (uid: string, attrs: Partial<Omit<LinkMarkAttrs, 'uid'>>) => ReturnType;
334
- /**
335
- * Update media node attributes by uid
336
- */
337
- updateLinkByUid: (uid: string, attrs: Partial<LinkMarkAttrs>) => ReturnType;
338
- /**
339
- * Delete link preview node by uid
340
- */
341
- deleteLinkByUid: (uid: string) => ReturnType;
342
- /**
343
- * Re-run unfurl resolution for existing links after content rehydration.
344
- */
345
- rehydrateLinkPreviews: () => ReturnType;
346
- };
347
- }
348
- }
349
-
350
-
351
347
  declare module '@tiptap/core' {
352
348
  interface Commands<ReturnType> {
353
349
  iframe: {
@@ -379,6 +375,34 @@ declare module '@tiptap/core' {
379
375
  }
380
376
 
381
377
 
378
+ declare module '@tiptap/core' {
379
+ interface Commands<ReturnType> {
380
+ customLink: {
381
+ /**
382
+ * Insert a new link mark with preview
383
+ */
384
+ insertLink: (attrs: LinkMarkAttrs) => ReturnType;
385
+ /**
386
+ * Update an existing link mark with its preview
387
+ */
388
+ updateLink: (uid: string, attrs: Partial<Omit<LinkMarkAttrs, 'uid'>>) => ReturnType;
389
+ /**
390
+ * Update media node attributes by uid
391
+ */
392
+ updateLinkByUid: (uid: string, attrs: Partial<LinkMarkAttrs>) => ReturnType;
393
+ /**
394
+ * Delete link preview node by uid
395
+ */
396
+ deleteLinkByUid: (uid: string) => ReturnType;
397
+ /**
398
+ * Re-run unfurl resolution for existing links after content rehydration.
399
+ */
400
+ rehydrateLinkPreviews: () => ReturnType;
401
+ };
402
+ }
403
+ }
404
+
405
+
382
406
  declare module '@tiptap/core' {
383
407
  interface Commands<ReturnType> {
384
408
  linkPreview: {