@openim/im-composer 1.0.3 → 1.0.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.mts CHANGED
@@ -256,6 +256,8 @@ interface IMComposerProps {
256
256
  mentionProvider?: (query: string) => Promise<Member[]>;
257
257
  /** Maximum number of mentions allowed */
258
258
  maxMentions?: number;
259
+ /** Called when mention limit is exceeded */
260
+ onMentionLimitExceeded?: () => void;
259
261
  /** Custom render function for mention list items */
260
262
  renderMentionItem?: (props: {
261
263
  member: Member;
@@ -285,6 +287,25 @@ interface IMComposerProps {
285
287
  };
286
288
  /** Image upload handler with optional progress callback */
287
289
  uploadImage?: UploadImageFn;
290
+ /** Rich mode toolbar configuration */
291
+ richToolbarConfig?: {
292
+ undoRedo?: boolean;
293
+ heading?: boolean;
294
+ list?: boolean;
295
+ blockquote?: boolean;
296
+ codeBlock?: boolean;
297
+ bold?: boolean;
298
+ italic?: boolean;
299
+ strike?: boolean;
300
+ code?: boolean;
301
+ underline?: boolean;
302
+ highlight?: boolean;
303
+ link?: boolean;
304
+ superscript?: boolean;
305
+ subscript?: boolean;
306
+ textAlign?: boolean;
307
+ image?: boolean;
308
+ };
288
309
  /** Keymap configuration */
289
310
  keymap?: {
290
311
  send?: SendKeymap;
@@ -358,6 +379,40 @@ interface MentionSuggestionState {
358
379
  */
359
380
  declare const IMComposer: React__default.ForwardRefExoticComponent<IMComposerProps & React__default.RefAttributes<IMComposerRef>>;
360
381
 
382
+ interface RichToolbarConfig {
383
+ /** Show undo/redo buttons */
384
+ undoRedo?: boolean;
385
+ /** Show heading dropdown */
386
+ heading?: boolean;
387
+ /** Show list dropdown */
388
+ list?: boolean;
389
+ /** Show blockquote button */
390
+ blockquote?: boolean;
391
+ /** Show code block button */
392
+ codeBlock?: boolean;
393
+ /** Show bold button */
394
+ bold?: boolean;
395
+ /** Show italic button */
396
+ italic?: boolean;
397
+ /** Show strikethrough button */
398
+ strike?: boolean;
399
+ /** Show inline code button */
400
+ code?: boolean;
401
+ /** Show underline button */
402
+ underline?: boolean;
403
+ /** Show highlight button */
404
+ highlight?: boolean;
405
+ /** Show link button */
406
+ link?: boolean;
407
+ /** Show superscript button */
408
+ superscript?: boolean;
409
+ /** Show subscript button */
410
+ subscript?: boolean;
411
+ /** Show text align buttons */
412
+ textAlign?: boolean;
413
+ /** Show image upload button */
414
+ image?: boolean;
415
+ }
361
416
  interface RichEditorProps {
362
417
  placeholder?: string;
363
418
  disabled?: boolean;
@@ -366,6 +421,8 @@ interface RichEditorProps {
366
421
  onSend?: () => void;
367
422
  onChange?: () => void;
368
423
  sendKeymap?: 'enter' | 'ctrlEnter' | 'cmdEnter';
424
+ /** Toolbar configuration */
425
+ toolbarConfig?: RichToolbarConfig;
369
426
  }
370
427
  interface RichEditorRef {
371
428
  editor: Editor | null;
@@ -489,6 +546,8 @@ interface UsePlainEditorOptions {
489
546
  mentionProvider?: (query: string) => Promise<Member[]>;
490
547
  /** Max mentions */
491
548
  maxMentions?: number;
549
+ /** Called when mention limit is exceeded */
550
+ onMentionLimitExceeded?: () => void;
492
551
  /** Called when mention state changes */
493
552
  onMentionStateChange?: (state: MentionSuggestionState) => void;
494
553
  /** Called when files are pasted */
@@ -614,4 +673,4 @@ declare function sanitizeLinkUrl(url: string): string | null;
614
673
  */
615
674
  declare function sanitizeImageUrl(url: string): string | null;
616
675
 
617
- export { type Attachment, type AttachmentLimitReason, AttachmentPreview, type AttachmentPreviewProps, type ComposerDraft, type EditorMode, IMComposer, type IMComposerLocale, type IMComposerProps, type IMComposerRef, LocaleProvider, type MarkdownMessagePayload, type Member, type MentionInfo, MentionList, type MentionListProps, type MessagePayload, type PlainMessagePayload, QuoteBar, type QuoteBarProps, type QuoteInfo, RichEditor, type RichEditorProps, type RichEditorRef, type SendKeymap, type UploadImageFn, type UploadImageResult, type UploadProgressEvent, type UseAttachmentsOptions, type UseAttachmentsReturn, type UsePlainEditorOptions, type UsePlainEditorReturn, createAttachment, createMentionInfo, defaultLocale, editorToMarkdown, extractPlainTextWithMentions, formatFileSize, isAllowedImageProtocol, isAllowedLinkProtocol, markdownToEditorContent, revokeAllAttachmentUrls, revokeAttachmentUrl, sanitizeImageUrl, sanitizeLinkUrl, useAttachments, useLocale, usePlainEditor, validateFile, validateMentionIndices };
676
+ export { type Attachment, type AttachmentLimitReason, AttachmentPreview, type AttachmentPreviewProps, type ComposerDraft, type EditorMode, IMComposer, type IMComposerLocale, type IMComposerProps, type IMComposerRef, LocaleProvider, type MarkdownMessagePayload, type Member, type MentionInfo, MentionList, type MentionListProps, type MessagePayload, type PlainMessagePayload, QuoteBar, type QuoteBarProps, type QuoteInfo, RichEditor, type RichEditorProps, type RichEditorRef, type RichToolbarConfig, type SendKeymap, type UploadImageFn, type UploadImageResult, type UploadProgressEvent, type UseAttachmentsOptions, type UseAttachmentsReturn, type UsePlainEditorOptions, type UsePlainEditorReturn, createAttachment, createMentionInfo, defaultLocale, editorToMarkdown, extractPlainTextWithMentions, formatFileSize, isAllowedImageProtocol, isAllowedLinkProtocol, markdownToEditorContent, revokeAllAttachmentUrls, revokeAttachmentUrl, sanitizeImageUrl, sanitizeLinkUrl, useAttachments, useLocale, usePlainEditor, validateFile, validateMentionIndices };
package/dist/index.d.ts CHANGED
@@ -256,6 +256,8 @@ interface IMComposerProps {
256
256
  mentionProvider?: (query: string) => Promise<Member[]>;
257
257
  /** Maximum number of mentions allowed */
258
258
  maxMentions?: number;
259
+ /** Called when mention limit is exceeded */
260
+ onMentionLimitExceeded?: () => void;
259
261
  /** Custom render function for mention list items */
260
262
  renderMentionItem?: (props: {
261
263
  member: Member;
@@ -285,6 +287,25 @@ interface IMComposerProps {
285
287
  };
286
288
  /** Image upload handler with optional progress callback */
287
289
  uploadImage?: UploadImageFn;
290
+ /** Rich mode toolbar configuration */
291
+ richToolbarConfig?: {
292
+ undoRedo?: boolean;
293
+ heading?: boolean;
294
+ list?: boolean;
295
+ blockquote?: boolean;
296
+ codeBlock?: boolean;
297
+ bold?: boolean;
298
+ italic?: boolean;
299
+ strike?: boolean;
300
+ code?: boolean;
301
+ underline?: boolean;
302
+ highlight?: boolean;
303
+ link?: boolean;
304
+ superscript?: boolean;
305
+ subscript?: boolean;
306
+ textAlign?: boolean;
307
+ image?: boolean;
308
+ };
288
309
  /** Keymap configuration */
289
310
  keymap?: {
290
311
  send?: SendKeymap;
@@ -358,6 +379,40 @@ interface MentionSuggestionState {
358
379
  */
359
380
  declare const IMComposer: React__default.ForwardRefExoticComponent<IMComposerProps & React__default.RefAttributes<IMComposerRef>>;
360
381
 
382
+ interface RichToolbarConfig {
383
+ /** Show undo/redo buttons */
384
+ undoRedo?: boolean;
385
+ /** Show heading dropdown */
386
+ heading?: boolean;
387
+ /** Show list dropdown */
388
+ list?: boolean;
389
+ /** Show blockquote button */
390
+ blockquote?: boolean;
391
+ /** Show code block button */
392
+ codeBlock?: boolean;
393
+ /** Show bold button */
394
+ bold?: boolean;
395
+ /** Show italic button */
396
+ italic?: boolean;
397
+ /** Show strikethrough button */
398
+ strike?: boolean;
399
+ /** Show inline code button */
400
+ code?: boolean;
401
+ /** Show underline button */
402
+ underline?: boolean;
403
+ /** Show highlight button */
404
+ highlight?: boolean;
405
+ /** Show link button */
406
+ link?: boolean;
407
+ /** Show superscript button */
408
+ superscript?: boolean;
409
+ /** Show subscript button */
410
+ subscript?: boolean;
411
+ /** Show text align buttons */
412
+ textAlign?: boolean;
413
+ /** Show image upload button */
414
+ image?: boolean;
415
+ }
361
416
  interface RichEditorProps {
362
417
  placeholder?: string;
363
418
  disabled?: boolean;
@@ -366,6 +421,8 @@ interface RichEditorProps {
366
421
  onSend?: () => void;
367
422
  onChange?: () => void;
368
423
  sendKeymap?: 'enter' | 'ctrlEnter' | 'cmdEnter';
424
+ /** Toolbar configuration */
425
+ toolbarConfig?: RichToolbarConfig;
369
426
  }
370
427
  interface RichEditorRef {
371
428
  editor: Editor | null;
@@ -489,6 +546,8 @@ interface UsePlainEditorOptions {
489
546
  mentionProvider?: (query: string) => Promise<Member[]>;
490
547
  /** Max mentions */
491
548
  maxMentions?: number;
549
+ /** Called when mention limit is exceeded */
550
+ onMentionLimitExceeded?: () => void;
492
551
  /** Called when mention state changes */
493
552
  onMentionStateChange?: (state: MentionSuggestionState) => void;
494
553
  /** Called when files are pasted */
@@ -614,4 +673,4 @@ declare function sanitizeLinkUrl(url: string): string | null;
614
673
  */
615
674
  declare function sanitizeImageUrl(url: string): string | null;
616
675
 
617
- export { type Attachment, type AttachmentLimitReason, AttachmentPreview, type AttachmentPreviewProps, type ComposerDraft, type EditorMode, IMComposer, type IMComposerLocale, type IMComposerProps, type IMComposerRef, LocaleProvider, type MarkdownMessagePayload, type Member, type MentionInfo, MentionList, type MentionListProps, type MessagePayload, type PlainMessagePayload, QuoteBar, type QuoteBarProps, type QuoteInfo, RichEditor, type RichEditorProps, type RichEditorRef, type SendKeymap, type UploadImageFn, type UploadImageResult, type UploadProgressEvent, type UseAttachmentsOptions, type UseAttachmentsReturn, type UsePlainEditorOptions, type UsePlainEditorReturn, createAttachment, createMentionInfo, defaultLocale, editorToMarkdown, extractPlainTextWithMentions, formatFileSize, isAllowedImageProtocol, isAllowedLinkProtocol, markdownToEditorContent, revokeAllAttachmentUrls, revokeAttachmentUrl, sanitizeImageUrl, sanitizeLinkUrl, useAttachments, useLocale, usePlainEditor, validateFile, validateMentionIndices };
676
+ export { type Attachment, type AttachmentLimitReason, AttachmentPreview, type AttachmentPreviewProps, type ComposerDraft, type EditorMode, IMComposer, type IMComposerLocale, type IMComposerProps, type IMComposerRef, LocaleProvider, type MarkdownMessagePayload, type Member, type MentionInfo, MentionList, type MentionListProps, type MessagePayload, type PlainMessagePayload, QuoteBar, type QuoteBarProps, type QuoteInfo, RichEditor, type RichEditorProps, type RichEditorRef, type RichToolbarConfig, type SendKeymap, type UploadImageFn, type UploadImageResult, type UploadProgressEvent, type UseAttachmentsOptions, type UseAttachmentsReturn, type UsePlainEditorOptions, type UsePlainEditorReturn, createAttachment, createMentionInfo, defaultLocale, editorToMarkdown, extractPlainTextWithMentions, formatFileSize, isAllowedImageProtocol, isAllowedLinkProtocol, markdownToEditorContent, revokeAllAttachmentUrls, revokeAttachmentUrl, sanitizeImageUrl, sanitizeLinkUrl, useAttachments, useLocale, usePlainEditor, validateFile, validateMentionIndices };